print '</div>';
 }
 /*
  * Correct stock
  */
 if ($action == "correction") {
     print_titre($langs->trans("StockCorrection"));
     print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
     print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     print '<input type="hidden" name="action" value="correct_stock">';
     print '<table class="border" width="100%">';
     // Warehouse
     print '<tr>';
     print '<td width="20%">' . $langs->trans("Product") . '</td>';
     print '<td width="20%">';
     print $form->select_produits(GETPOST('productid'), 'product_id', empty($conf->global->STOCK_SUPPORTS_SERVICES) ? '0' : '');
     print '</td>';
     print '<td width="20%">';
     print '<select name="mouvement" class="flat">';
     print '<option value="0">' . $langs->trans("Add") . '</option>';
     print '<option value="1">' . $langs->trans("Delete") . '</option>';
     print '</select></td>';
     print '<td width="20%">' . $langs->trans("NumberOfUnit") . '</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
     print '</tr>';
     // Label
     print '<tr>';
     print '<td width="20%">' . $langs->trans("Label") . '</td>';
     print '<td colspan="4">';
     print '<input type="text" name="label" size="40" value="">';
     print '</td>';
     print '</tr>';
Example #2
0
    } else {
        print '<td align="right" colspan="2">';
        print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name"));
        print '</td>';
    }
    print "</tr>\n";
    print '</form>';
    if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
        $var = !$var;
        print '<form action="adherent.php" method="POST">';
        print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
        print '<input type="hidden" name="action" value="update">';
        print '<input type="hidden" name="constname" value="ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS">';
        print '<tr ' . $bc[$var] . '><td>' . $langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS") . '</td>';
        print '<td>';
        $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'constvalue_ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS');
        print '</td><td align="center" width="80">';
        print '<input type="submit" class="button" value="' . $langs->trans("Update") . '" name="Button">';
        print '</td>';
    }
    print "</tr>\n";
    print '</form>';
}
print '</table>';
print '<br>';
/*
 * Edition info modele document
 */
$constantes = array('ADHERENT_CARD_TYPE', 'ADHERENT_CARD_HEADER_TEXT', 'ADHERENT_CARD_TEXT', 'ADHERENT_CARD_TEXT_RIGHT', 'ADHERENT_CARD_FOOTER_TEXT');
print load_fiche_titre($langs->trans("MembersCards"), '', '');
form_constantes($constantes);
 $search_soc = GETPOST('search_soc');
 if (!empty($search_soc)) {
     $filter['soc.nom'] = $search_soc;
 }
 if ($action == 'add_customer_price') {
     // Create mode
     print_fiche_titre($langs->trans('PriceByCustomer'));
     print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '" method="POST">';
     print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
     print '<input type="hidden" name="action" value="add_customer_price_confirm">';
     print '<input type="hidden" name="socid" value="' . $soc->id . '">';
     print '<table class="border" width="100%">';
     print '<tr>';
     print '<td>' . $langs->trans('Product') . '</td>';
     print '<td>';
     print $form->select_produits('', 'prodid', '', 0);
     print '</td>';
     print '</tr>';
     // VAT
     print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
     print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
     print '</td></tr>';
     // Price base
     print '<tr><td width="15%">';
     print $langs->trans('PriceBase');
     print '</td>';
     print '<td>';
     print $form->select_PriceBaseType($object->price_base_type, "price_base_type");
     print '</td>';
     print '</tr>';
     // Price
Example #4
0
 print '<table class="noborder" width="100%">';
 print '<tr>';
 print '<td>' . $langs->trans('ProductsAndServices') . '</td>';
 print '<td>' . $langs->trans('Qty') . '</td>';
 print '<td>' . $langs->trans('ReductionShort') . '</td>';
 print '<td> &nbsp; &nbsp; </td>';
 if (!empty($conf->service->enabled)) {
     print '<td>' . $langs->trans('ServiceLimitedDuration') . '</td>';
 }
 print '</tr>';
 for ($i = 1; $i <= $NBLINES; $i++) {
     print '<tr>';
     print '<td>';
     // multiprix
     if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
         $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size, $soc->price_level);
     } else {
         $form->select_produits('', 'idprod' . $i, '', $conf->product->limit_size);
     }
     print '</td>';
     print '<td><input type="text" size="2" name="qty' . $i . '" value="1"></td>';
     print '<td class="nowrap"><input type="text" size="1" name="remise_percent' . $i . '" value="' . $soc->remise_percent . '">%</td>';
     print '<td>&nbsp;</td>';
     // Si le module service est actif, on propose des dates de debut et fin a la ligne
     if (!empty($conf->service->enabled)) {
         print '<td class="nowrap">';
         print '<table class="nobordernopadding"><tr class="nocellnopadd">';
         print '<td class="nobordernopadding nowrap">';
         print $langs->trans('From') . ' ';
         print '</td><td class="nobordernopadding nowrap">';
         print $form->select_date('', 'date_start' . $i, $usehm, $usehm, 1, "add", 1, 0, 1);
Example #5
0
 } else {
     $showclassifyform = 1;
     $typeid = Categorie::TYPE_PRODUCT;
     // Form to add record into a category
     if ($showclassifyform) {
         print '<br>';
         print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';
         print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
         print '<input type="hidden" name="typeid" value="' . $typeid . '">';
         print '<input type="hidden" name="type" value="' . $typeid . '">';
         print '<input type="hidden" name="id" value="' . $object->id . '">';
         print '<input type="hidden" name="action" value="addintocategory">';
         print '<table class="noborder" width="100%">';
         print '<tr class="liste_titre"><td width="40%">';
         print $langs->trans("AddProductServiceIntoCategory") . ' &nbsp;';
         print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1);
         print '</td><td>';
         print '<input type="submit" class="button" value="' . $langs->trans("ClassifyInCategory") . '"></td>';
         print '</tr>';
         print '</table>';
         print '</form>';
     }
     print "<br>";
     print "<table class='noborder' width='100%'>\n";
     print '<tr class="liste_titre"><td colspan="3">' . $langs->trans("ProductsAndServices") . "</td></tr>\n";
     if (count($prods) > 0) {
         $var = true;
         foreach ($prods as $prod) {
             $var = !$var;
             print "\t<tr " . $bc[$var] . ">\n";
             print '<td class="nowrap" valign="top">';
print getTitleFieldOfList($langs->trans('Qty'), 0, $_SERVER["PHP_SELF"], '', $param, '', 'align="center" class="tagtd"', $sortfield, $sortorder);
print getTitleFieldOfList('', 0);
print '</tr>';
print '<tr ' . $bc[$var] . '>';
// Product
print '<td>';
$filtertype = 0;
if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
    $filtertype = '';
}
if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) {
    $limit = '';
} else {
    $limit = $conf->global->PRODUIT_LIMIT_SIZE;
}
print $form->select_produits($id_product, 'productid', $filtertype, $limit);
print '</td>';
// In warehouse
print '<td>';
print $formproduct->selectWarehouses($id_sw, 'id_sw', '', 1);
print '</td>';
// Out warehouse
print '<td>';
print $formproduct->selectWarehouses($id_tw, 'id_tw', '', 1);
print '</td>';
// Qty
print '<td align="center"><input type="text" size="4" class="flat" name="qty" value="' . $qty . '"></td>';
// Button to add line
if (!$listofdata) {
    print '<td align="right"><input type="submit" class="button" name="addline" value="' . dol_escape_htmltag($titletoadd) . '"></td>';
}
Example #7
0
	init_gendoc_button();
	jQuery("#select_fk_barcode_type").change(function() {
		init_gendoc_button();
	});
	jQuery("#forbarcode").keyup(function() {
		init_gendoc_button()
	});
});
</script>';
// Checkbox to select from free text
print '<input id="fillmanually" type="radio" ' . (!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually' ? 'checked ' : '') . 'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> ' . $langs->trans("FillBarCodeTypeAndValueManually") . ' &nbsp; ';
print '<br>';
print '<input id="fillfromproduct" type="radio" ' . (GETPOST("selectorforbarcode") == 'fillfromproduct' ? 'checked ' : '') . 'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> ' . $langs->trans("FillBarCodeTypeAndValueFromProduct") . ' &nbsp; ';
print '<br>';
print '<div class="showforproductselector">';
$form->select_produits(GETPOST('productid'), 'productid', '');
print ' &nbsp; <input type="submit" id="submitproduct" name="submitproduct" class="button" value="' . dol_escape_htmltag($langs->trans("GetBarCode")) . '">';
print '</div>';
print '<input id="fillfromthirdparty" type="radio" ' . (GETPOST("selectorforbarcode") == 'fillfromthirdparty' ? 'checked ' : '') . 'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> ' . $langs->trans("FillBarCodeTypeAndValueFromThirdParty") . ' &nbsp; ';
print '<br>';
print '<div class="showforthirdpartyselector">';
print $form->select_company(GETPOST('socid'), 'socid', '', 1, 0, 0, array(), 0, 'minwidth300');
print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="' . dol_escape_htmltag($langs->trans("GetBarCode")) . '">';
print '</div>';
print '<br>';
if ($producttmp->id > 0) {
    print $langs->trans("BarCodeDataForProduct", '') . ' ' . $producttmp->getNomUrl(1) . '<br>';
}
if ($thirdpartytmp->id > 0) {
    print $langs->trans("BarCodeDataForThirdparty", '') . ' ' . $thirdpartytmp->getNomUrl(1) . '<br>';
}
    /**
     * Overloading the doActions function : replacing the parent's function with the one below
     *
     * @param   array()         $parameters     Hook metadatas (context, etc...)
     * @param   CommonObject    &$object        The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
     * @param   string          &$action        Current action (if set). Generally create or edit or null
     * @param   HookManager     $hookmanager    Hook manager propagated to allow calling another hook
     * @return  int                             < 0 on error, 0 on success, 1 to replace standard code
     */
    function formAddObjectLine($parameters, &$object, &$action, $hookmanager)
    {
        $TContext = explode(':', $parameters['context']);
        if (in_array('ordersuppliercard', $TContext) || in_array('invoicesuppliercard', $TContext)) {
            global $db, $conf, $mysoc;
            $form = new Form($db);
            $seller = new Societe($db);
            $seller->fetch($object->thirdparty->id);
            $colspan = in_array('ordersuppliercard', $TContext) ? 3 : 4;
            ?>
            <tr class="liste_titre nodrag nodrop">
                <td>Ajout nouvelle ligne avec prix à la volée</td>
                <td align="right">TVA</td>
                <td align="right">Qté</td>
                <td align="right">Total HT</td>
                <td align="right">Réf.</td>
                <td colspan="<?php 
            echo $colspan + 1;
            ?>
">&nbsp;</td>
            </tr>
            <tr class="impair">
                <td><?php 
            $form->select_produits(GETPOST('idprod_qsp'), 'idprod_qsp', '', $conf->product->limit_size, 1, -1);
            ?>
</td>
                <td align="right"><?php 
            echo $form->load_tva('tva_tx_qsp', isset($_POST["tva_tx_qsp"]) ? $_POST["tva_tx_qsp"] : -1, $seller, $mysoc);
            ?>
</td>
                <td align="right"><input type="text" value="1" class="flat" id="qty_qsp" name="qty_qsp" size="2"></td>
                <td align="right"><input type="text" value="" class="flat" id="price_ht_qsp" name="price_ht_qsp" size="5"></td>
                <td align="right"><input type="text" value="" class="flat" id="ref_qsp" name="ref_qsp" size="5"></td>
                <td align="right">&nbsp;</td>
                <td colspan="<?php 
            echo $colspan;
            ?>
"><input type="button" name="bt_add_qsp" id="bt_add_qsp" value="Créer le prix et ajouter" class="button"/></td>
            </tr>
            <script type="text/javascript">
                $(document).ready(function() {
                    $("#bt_add_qsp").click(function() {
                        $(this).fadeOut();

                        $.ajax({
                            url : "<?php 
            echo dol_buildpath('/quicksupplierprice/script/interface.php', 1);
            ?>
"
                            ,data:{
                                put:'updateprice'
                                ,idprod:$("#idprod_qsp").val()
                                ,ref_search:$('#search_idprod_qsp').val()
                                ,fk_supplier:<?php 
            echo !empty($object->socid) ? $object->socid : $object->fk_soc;
            ?>
                                ,price:$("#price_ht_qsp").val()
                                ,qty:$("#qty_qsp").val()
                                ,tvatx:$("#tva_tx_qsp").val()
                                ,ref:$("#ref_qsp").val()
                            }
                            ,method:"post"
                            ,dataType:'json'
                        }).done(function(data) {
                            console.log(data);
                            if(data.id>0) {

                                setforpredef();

                                $("#dp_desc").val( data.dp_desc );
                                $("#idprodfournprice").replaceWith('<input type="hidden" name="idprodfournprice" id="idprodfournprice" value="'+data.id+'" />' );

                                $("#qty").val($("#qty_qsp").val());

                                $("#addline").click();
                            }
                            else{
                                alert("Il y a une erreur dans votre saisie : "+data.error);
                            }

                        });
                    });

                });




            </script>
            <?php 
        }
        return 0;
        // or return 1 to replace standard code
    }
Example #9
0
$selected = 3;
print $form->selectarray('testselecta', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1);
print '<br><br>';
print "Test 4b: a select<br>\n";
$array = array(1 => 'Value 1', 2 => 'Value 2', 3 => 'Value 3');
$selected = 3;
print $form->selectarray('testselectb', $array, $selected, 1, 0, 0, 'style="min-width: 250px;"', 0, 0, 0, '', '', 1);
print '<br><br>' . "\n";
print "Test 4c: Select array with no js forced<br>\n";
$array = array(1 => 'Value 1', 2 => 'Value 2', 3 => 'Value 3');
print $form->selectarray('selectarray', $array);
print '<br><br>' . "\n";
print "Test 4d: a select with ajax refresh and with onchange call of url<br>\n";
$selected = -1;
print $form->selectArrayAjax('testselectc', DOL_URL_ROOT . '/core/ajax/selectsearchbox.php', $selected, 'style="min-width: 250px;"', '', 0, 1, '', 1);
print '<br><br>' . "\n";
// Test5a: form->select_thirdparty
print "Test 5a: Select thirdparty<br>\n";
print $form->select_company(0, 'thirdpartytest');
print '<br><br>' . "\n";
// Test5b: form->select_product
print "Test 5b: Select product (using ajax)<br>\n";
$form->select_produits(0, 'producttest');
print '<br><br>' . "\n";
// Test5c: a multiselect
print "Test 5c: a multiselect<br>\n";
$array = array(1 => 'Value 1', 2 => 'Value 2', 3 => 'Value 3');
$arrayselected = array(1, 3);
print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, '', 0, 250);
llxFooter();
$db->close();
Example #10
0
print_fiche_titre($text);

// Show tabs
$head=marges_prepare_head($user);
$titre=$langs->trans("Margins");
$picto='margin';
dol_fiche_head($head, 'productMargins', $titre, 0, $picto);

print '<form method="post" name="sel">';
print '<table class="border" width="100%">';

if ($id > 0) {

  print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
  print '<td colspan="4">';
  print $form->select_produits($id,'id','',20,0,1,2,'',1);
  print '</td></tr>';

  print '<tr><td width="20%">'.$langs->trans('AllProducts').'</td>';
  print '<td colspan="4"><input type="checkbox" id="all" /></td></tr>';

  if (! $sortorder) $sortorder="DESC";
  if (! $sortfield) $sortfield="f.datef";
}
else {
	print '<tr><td width="20%">'.$langs->trans('ChooseProduct/Service').'</td>';
	print '<td colspan="4">';
	print $form->select_produits('','id','',20,0,1,2,'',1);
	print '</td></tr>';

}
Example #11
0
		if ($conf->product->enabled || $conf->service->enabled)
		{
			$lib=$langs->trans("ProductsAndServices");

			print '<table class="border" width="100%">';
			print '<tr>';
			print '<td>'.$lib.'</td>';
			print '<td>'.$langs->trans("Qty").'</td>';
			print '<td>'.$langs->trans("ReductionShort").'</td>';
			print '</tr>';
			for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++)
			{
				print '<tr><td>';
				// multiprix
				if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
				$html->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level);
				else
				$html->select_produits('',"idprod".$i,'',$conf->product->limit_size);
				print '</td>';
				print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
				print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_client.'">%</td>';
				print '</tr>';
			}

			print "</table>";

		}
		else
		{
			print '&nbsp;';
		}
Example #12
0
			print "</tr>\n";

			$var=false;

			// Service sur produit predefini
			print '<form name="addline" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">';
			print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
			print '<input type="hidden" name="action" value="addline">';
			print '<input type="hidden" name="mode" value="predefined">';
			print '<input type="hidden" name="id" value="'.$id.'">';

			print "<tr $bc[$var]>";
			print '<td colspan="3">';
			// multiprix
			if($conf->global->PRODUIT_MULTIPRICES)
				$form->select_produits('','idprod',1,$conf->product->limit_size,$object->societe->price_level);
			else
				$form->select_produits('','idprod',1,$conf->product->limit_size);
			if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
			print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
			print '</td>';

			print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
			print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="'.$object->societe->remise_client.'">%</td>';
			print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
			print '</tr>'."\n";

			print "<tr $bc[$var]>";
			print '<td colspan="8">';
			print $langs->trans("DateStartPlanned").' ';
			$form->select_date('',"date_start",$usehm,$usehm,1,"addline");
function fiche_preview(&$object, &$TData)
{
    global $langs, $user, $db, $conf;
    //var_dump($_REQUEST);exit;
    $origin = GETPOST('origin');
    $head = null;
    if ($object->element == 'propal') {
        $head = propal_prepare_head($object);
    } else {
        $head = commande_prepare_head($object);
    }
    if (empty($user->rights->importdevis->myactions)) {
        accessforbidden();
        exit;
    }
    $form = new Form($db);
    llxHeader();
    $title = $langs->trans('Import');
    if ($origin == 'propal') {
        dol_fiche_head($head, 'importdevis', $title, 0, 'propal');
    } else {
        dol_fiche_head($head, 'importdevis', $title, 0, 'commande');
    }
    ?>
		<style type="text/css">
			#table_before_import tr.title_line td.for_line > * {
				display:none;
			}
			
			#table_before_import tr.line_line td.for_title > * {
				display:none;
			}
			
			.for_line select{
				white-space:normal;
				width:300px;
			}
			.ui-dialog {
			    overflow: visible !important;  /* or 'visible' whatever */
			}
		</style>
		
		<script type="text/javascript">
			$(function() {
				var old_type;
				
				$('#to_parse .type select').unbind().click(function() { old_type = $(this).val(); }).change(function() {
					switchClass($(this));
				});
				
				$( "#pop-edit-product-link" ).dialog({
			      modal: true,
			      autoOpen: false,
			      title:"Lier un produit à cette ligne",
			      buttons: {
			        "Lier ce produit": function() {
			        	
			          var fk_product = $('#fk_product_to_link').val() ;
			          var k = $(this).attr('k');	
			          $input = $('tr[k='+k+'] input[rel=fk_product]');
			         //console.log($input);
			         
			          $.ajax({
			          	url:"<?php 
    echo dol_buildpath('/product/ajax/products.php', 1);
    ?>
?action=fetch&id="+fk_product
			          	,dataType:'json'
			          }).done(function(product) {
			          	
			          	$('span[rel="ref-product"][k='+k+']').html(product.ref);
			          	$input.val(fk_product);
			          	console.log(product);
			          	
			          });
			        		
			          $( this ).dialog( "close" );
			        }
			      }
			    });
				
				function switchClass(element)
				{
					var type_value = $(element).val();
	
					if (type_value == 'title') 
					{
						$(element).parent().parent().addClass('liste_titre title_line');
						$(element).parent().parent().removeClass('line_line');
					}
					else 
					{
						$(element).parent().parent().addClass('line_line');
						$(element).parent().parent().removeClass('liste_titre title_line');
						
						if (old_type == 'title' && type_value == 'line')
						{
							while (element.length > 0)
							{
								element = $(element).parent().parent().next().find('td.type').children('select');
								
								if (element.val() == 'title') break;
								
								element.children('option[value=nomenclature]').attr('selected', true);
							}
							
						}
					}
				}
			});
			
			var imp_is_all_check = true;
			function checkAndUncheckAllImport()
			{
				if (imp_is_all_check)
				{
					imp_is_all_check = false;
					$("#to_parse tr .check_imp").attr('checked', false).prop('checked', false);
				}
				else
				{
					imp_is_all_check = true;
					$("#to_parse tr .check_imp").attr('checked', true).prop('checked', true);
				}
			}
			
			function edit_product_link(k) {
				$div = $('#pop-edit-product-link');
				$div.attr('k', k);
				
				$div.dialog('open');
			}
			
		</script>
		<div id="pop-edit-product-link" class="ui-dialog"  >
			<?php 
    $form->select_produits('', 'fk_product_to_link');
    ?>
		</div>
		<table id="table_before_import" width="100%" class="border">
			<tr>
				<td width="25%"><?php 
    echo $langs->trans('Ref');
    ?>
</td>
				<td colspan="3"><div style="vertical-align: middle"><div class="inline-block floatleft refid"><?php 
    echo $object->ref;
    ?>
</div></div></td>
			</tr>
			<tr>
				<td><?php 
    echo $langs->trans('Company');
    ?>
</td>MO-1
				<td colspan="3"><?php 
    echo $object->thirdparty->getNomUrl(1);
    ?>
</td>
			</tr>
			<tr>
				<td colspan="4">
					
						<?php 
    $PDOdb = new TPDOdb();
    $formCore = new TFormCore('auto', 'to_parse', 'post');
    echo $formCore->hidden('action', 'import_data');
    echo $formCore->hidden('id', $object->id);
    echo $formCore->hidden('origin', $origin);
    echo $formCore->hidden('token', $_SESSION['newtoken']);
    echo $formCore->hidden('data', base64_encode(serialize($TData)));
    ?>
							<table class="border" width="100%">
								<tr class="liste_titre">
									<th onclick="javascript:checkAndUncheckAllImport();" style="cursor:pointer;" title="sélectionner/désélectionner tous">Imp.</th>
									<th>Type</th>
									<?php 
    if ($conf->subtotal->enabled) {
        ?>
<th>Niveau</th><?php 
    }
    ?>
									<th>Produit</th>
									<th>Label</th>
									<th>Qté</th>
									<?php 
    if (!empty($conf->global->PRODUCT_USE_UNITS)) {
        ?>
<th>Unité</th><?php 
    }
    ?>
									<th>Prix Achat</th>
									<th>Prix</th>
									<?php 
    if (!empty($conf->global->IMPORTPROPAL_USE_MAJ_ON_NOMENCLATURE)) {
        ?>
									<th>Ligne d'origine</th>
									<?php 
    }
    ?>
								</tr>
							<?php 
    if (!empty($conf->global->IMPORTPROPAL_USE_MAJ_ON_NOMENCLATURE)) {
        $TPropalDet = array();
        foreach ($object->lines as $line) {
            $label = !empty($line->label) ? $line->label : $line->desc;
            $label .= ' (qté : ' . $line->qty . ', total HT : ' . $line->total_ht . ')';
            $TPropalDet[$line->id] = $label;
        }
    }
    $class = '';
    //var_dump($TData);
    $TWorkstation = TWorkstation::getWorstations($PDOdb);
    foreach ($TData as $k => &$row) {
        //var_dump($row);MO-1
        $workstation = new TWorkstation();
        //var_dump($workstation->loadBy($PDOdb, $row['workstation'], 'code'));
        //var_dump($workstation);exit;
        if (!empty($row['ref'])) {
            $res = $workstation->loadBy($PDOdb, $row['ref'], 'code');
            if ($res > 0) {
                $row['type'] = 'workstation';
                $id_workstation = $workstation->getId();
                //var_dump($workstation);
            }
        }
        $type = $row['type'];
        if ($type == 'title') {
            $class = '';
            print '<tr class="' . $class . ' liste_titre title_line">';
            print '<td>' . $formCore->checkbox1('', 'TData[' . $k . '][to_import]', 1, true, '', 'check_imp') . '</td>';
            print '<td class="type">' . $form->selectarray('TData[' . $k . '][type]', getTypeLine(), $row['type']) . '</td>';
            print '<td class="for_title">' . $form->selectarray('TData[' . $k . '][level]', getLevelTitle(), $row['level']) . '</td>';
            print '<td class="for_line">';
            //$form->select_produits(0, 'TData['.$k.'][fk_product]');
            print '</td>';
            print '<td>' . $formCore->texte('', 'TData[' . $k . '][label]', $row['label'], 50, 255) . '</td>';
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][qty]', $row['qty'], 3, 20) . '</td>';
            if (!empty($conf->global->PRODUCT_USE_UNITS)) {
                print '<td class="for_line"></td>';
            }
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][price]', $row['price'], 10, 20) . '</td>';
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][price]', $row['price'], 10, 20) . '</td>';
        } elseif ($type == 'workstation') {
            //var_dump($type);
            $class = '';
            print '<tr class="' . $class . ' workstation_line">';
            print '<td>' . $formCore->checkbox1('', 'TData[' . $k . '][to_import]', 1, true, '', 'check_imp') . '</td>';
            print '<td class="type">' . $form->selectarray('TData[' . $k . '][type]', getTypeLine(), $row['type']) . '</td>';
            print '<td></td>';
            print '<td class="for_line">';
            echo $formCore->combo('', 'TData[' . $k . '][fk_workstation]', $TWorkstation, $id_workstation);
            print '</td>';
            print '<td>' . $row['workstation'] . '</td>';
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][qty]', $row['qty'], 3, 20) . '</td>';
            if (!empty($conf->global->PRODUCT_USE_UNITS)) {
                print '<td class="for_line"></td>';
            }
            print '<td></td>';
            print '<td></td>';
        } else {
            $class = $class == 'impair' ? 'pair' : 'impair';
            print '<tr class="line_line ' . $class . '" k="' . $k . '">';
            print '<td>' . $formCore->checkbox1('', 'TData[' . $k . '][to_import]', 1, true, '', 'check_imp') . '</td>';
            print '<td class="type">' . $form->selectarray('TData[' . $k . '][type]', getTypeLine(), $row['type']) . '</td>';
            if ($conf->subtotal->enabled) {
                print '<td class="for_title">' . $form->selectarray('TData[' . $k . '][level]', getLevelTitle(), $row['level']) . '</td>';
            }
            print '<td class="for_line">';
            if (!empty($row['product_ref'])) {
                $p = new Product($db);
                $p->fetch(null, $row['product_ref']);
                $fk_product = $p->id;
            } else {
                $fk_product = 0;
            }
            print '<span rel="ref-product" k="' . $k . '">' . ($fk_product > 0 ? $p->getNomUrl(1) : 'N/A') . '</span> <a href="javascript:edit_product_link(' . $k . ')">' . img_edit('Changer le produit de destination') . '</a>';
            //$form->select_produits($fk_product, 'TData['.$k.'][fk_product]');
            echo $formCore->hidden('TData[' . $k . '][fk_product]', $fk_product, ' rel="fk_product" ');
            echo $formCore->hidden('TData[' . $k . '][product_ref]', $row['product_ref'], ' rel="product_ref" ');
            print '</td>';
            print '<td>' . $formCore->texte('', 'TData[' . $k . '][label]', $row['label'], 80, 255);
            print '<table>';
            print '<tr>';
            print '<td>Longueur : ' . $formCore->texte('', 'TData[' . $k . '][length]', $row['length'], 15, 255) . '</td>';
            print '<td>Largeur : ' . $formCore->texte('', 'TData[' . $k . '][width]', $row['width'], 15, 255) . '</td>';
            print '<td>Hauteur : ' . $formCore->texte('', 'TData[' . $k . '][height]', $row['height'], 15, 255) . '</td>';
            print '<td>Poids : ' . $formCore->texte('', 'TData[' . $k . '][weight]', $row['weight'], 15, 255) . '</td>';
            print '</tr>';
            print '</table>';
            print '</td>';
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][qty]', $row['qty'], 3, 20) . '</td>';
            if (!empty($conf->global->PRODUCT_USE_UNITS)) {
                print '<td class="for_line">' . $form->selectUnits($row['fk_unit'], 'TData[' . $k . '][fk_unit]', 1) . '</td>';
            }
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][buy_price]', $row['buy_price'], 10, 20) . '</td>';
            print '<td class="for_line">' . $formCore->texte('', 'TData[' . $k . '][price]', $row['price'], 10, 20) . '</td>';
        }
        if (!empty($conf->global->IMPORTPROPAL_USE_MAJ_ON_NOMENCLATURE)) {
            print '<td class="for_line">' . $form->selectarray('TData[' . $k . '][fk_propaldet]', $TPropalDet, '', 1) . '</td>';
        }
        print '</tr>';
    }
    //exit;
    ?>
							</table>
							<div class="tabsAction">
								<?php 
    echo $langs->trans('DeleteLinesBeforeImport');
    ?>
 <input id="delete_lines_before_import" name="delete_lines_before_import" type="checkbox" value="1" />
								<input class="button" type="submit" value="<?php 
    echo $langs->trans('Import');
    ?>
" />
							</div>
							<?php 
    $formCore->end();
    ?>
				</td>
			</tr>
		</table>
	<?php 
    dol_fiche_end();
    llxFooter();
}
Example #14
0
 print '<td align="right">' . $langs->trans("ReductionShort") . '</td>';
 print '<td>&nbsp;</td>';
 print '<td>&nbsp;</td>';
 print "</tr>\n";
 $var = false;
 // Service sur produit predefini
 print '<form name="addline" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 print '<input type="hidden" name="action" value="addline">';
 print '<input type="hidden" name="mode" value="predefined">';
 print '<input type="hidden" name="id" value="' . $object->id . '">';
 print "<tr " . $bc[$var] . ">";
 print '<td colspan="3">';
 // multiprix
 if ($conf->global->PRODUIT_MULTIPRICES) {
     $form->select_produits('', 'idprod', 1, $conf->product->limit_size, $object->thirdparty->price_level);
 } else {
     $form->select_produits('', 'idprod', 1, $conf->product->limit_size);
 }
 print '<textarea name="desc" cols="70" rows="' . ROWS_2 . '"></textarea>';
 print '</td>';
 print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
 print '<td align="right" nowrap><input type="text" class="flat" size="1" name="premise" value="' . $object->thirdparty->remise_client . '">%</td>';
 print '<td align="center" colspan="2" rowspan="2"><input type="submit" class="button" value="' . $langs->trans("Add") . '"></td>';
 print '</tr>' . "\n";
 print "<tr " . $bc[$var] . ">";
 print '<td colspan="8">';
 print $langs->trans("DateStartPlanned") . ' ';
 $form->select_date('', "date_start", $usehm, $usehm, 1, "addline");
 print ' &nbsp; ' . $langs->trans("DateEndPlanned") . ' ';
 $form->select_date('', "date_end", $usehm, $usehm, 1, "addline");
function _fiche(&$PDOdb, &$assetOf, $mode = 'edit', $fk_product_to_add = 0, $fk_nomenclature = 0)
{
    global $langs, $db, $conf, $user, $hookmanager;
    /***************************************************
     * PAGE
     *
     * Put here all code to build page
     ****************************************************/
    $parameters = array('id' => $assetOf->getId());
    $reshook = $hookmanager->executeHooks('doActions', $parameters, $assetOf, $mode);
    // Note that $action and $object may have been modified by hook
    //pre($assetOf,true);
    llxHeader('', $langs->trans('OFAsset'), '', '');
    print dol_get_fiche_head(ofPrepareHead($assetOf, 'assetOF'), 'fiche', $langs->trans('OFAsset'));
    ?>
<style type="text/css">
		#assetChildContener .OFMaster {
			
			background:#fff;
			-webkit-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52);
			-moz-box-shadow:    4px 4px 5px 0px rgba(50, 50, 50, 0.52);
			box-shadow:         4px 4px 5px 0px rgba(50, 50, 50, 0.52);
			
			margin-bottom:20px;
		}
		
	</style>
		<div class="OFContent" rel="<?php 
    echo $assetOf->getId();
    ?>
">	<?php 
    $TPrixFournisseurs = array();
    //$form=new TFormCore($_SERVER['PHP_SELF'],'formeq'.$assetOf->getId(),'POST');
    //Affichage des erreurs
    if (!empty($assetOf->errors)) {
        ?>
		<br><div class="error">
		<?php 
        foreach ($assetOf->errors as $error) {
            echo $error . "<br>";
            setEventMessage($error, 'errors');
        }
        $assetOf->errors = array();
        ?>
		</div><br>
		<?php 
    }
    $form = new TFormCore();
    $form->Set_typeaff($mode);
    $doliform = new Form($db);
    if (!empty($_REQUEST['fk_product'])) {
        echo $form->hidden('fk_product', $_REQUEST['fk_product']);
    }
    $TBS = new TTemplateTBS();
    $liste = new TListviewTBS('asset');
    $TBS->TBS->protect = false;
    $TBS->TBS->noerr = true;
    $PDOdb = new TPDOdb();
    $TNeeded = array();
    $TToMake = array();
    $TNeeded = _fiche_ligne($form, $assetOf, "NEEDED");
    $TToMake = _fiche_ligne($form, $assetOf, "TO_MAKE");
    $TIdCommandeFourn = $assetOf->getElementElement($PDOdb);
    $HtmlCmdFourn = '';
    if (count($TIdCommandeFourn)) {
        foreach ($TIdCommandeFourn as $idcommandeFourn) {
            $cmd = new CommandeFournisseur($db);
            $cmd->fetch($idcommandeFourn);
            $HtmlCmdFourn .= $cmd->getNomUrl(1) . " - " . $cmd->getLibStatut(0);
        }
    }
    ob_start();
    $doliform->select_produits('', 'fk_product', '', $conf->product->limit_size, 0, -1, 2, '', 3, array());
    $select_product = ob_get_clean();
    $Tid = array();
    //$Tid[] = $assetOf->rowid;
    if ($assetOf->getId() > 0) {
        $assetOf->getListeOFEnfants($PDOdb, $Tid);
    }
    $TWorkstation = array();
    foreach ($assetOf->TAssetWorkstationOF as $k => &$TAssetWorkstationOF) {
        $ws =& $TAssetWorkstationOF->ws;
        $TWorkstation[] = array('libelle' => '<a href="' . dol_buildpath('workstation/workstation.php?id=' . $ws->rowid . '&action=view', 2) . '">' . $ws->name . '</a>', 'fk_user' => visu_checkbox_user($PDOdb, $form, $ws->fk_usergroup, $TAssetWorkstationOF->users, 'TAssetWorkstationOF[' . $k . '][fk_user][]', $assetOf->status), 'fk_project_task' => visu_project_task($db, $TAssetWorkstationOF->fk_project_task, $form->type_aff, 'TAssetWorkstationOF[' . $k . '][progress]'), 'fk_task' => visu_checkbox_task($PDOdb, $form, $TAssetWorkstationOF->fk_asset_workstation, $TAssetWorkstationOF->tasks, 'TAssetWorkstationOF[' . $k . '][fk_task][]', $assetOf->status), 'nb_hour' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour]', $TAssetWorkstationOF->nb_hour, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour * 3600) : price($TAssetWorkstationOF->nb_hour)), 'nb_hour_real' => $assetOf->status == 'OPEN' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour_real]', $TAssetWorkstationOF->nb_hour_real, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour_real * 3600) : price($TAssetWorkstationOF->nb_hour_real)), 'nb_days_before_beginning' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_days_before_beginning]', $TAssetWorkstationOF->nb_days_before_beginning, 3, 10) : $TAssetWorkstationOF->nb_days_before_beginning, 'delete' => $mode == 'edit' && $assetOf->status == 'DRAFT' ? '<a href="javascript:deleteWS(' . $assetOf->getId() . ',' . $TAssetWorkstationOF->getId() . ');">' . img_picto('Supprimer', 'delete.png') . '</a>' : '', 'note_private' => $assetOf->status == 'DRAFT' && $mode == 'edit' ? $form->zonetexte('', 'TAssetWorkstationOF[' . $k . '][note_private]', $TAssetWorkstationOF->note_private, 50, 1) : $TAssetWorkstationOF->note_private, 'rang' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][rang]', $TAssetWorkstationOF->rang, 3, 10) : $TAssetWorkstationOF->rang, 'id' => $ws->getId());
    }
    $client = new Societe($db);
    if ($assetOf->fk_soc > 0) {
        $client->fetch($assetOf->fk_soc);
    }
    $commande = new Commande($db);
    if ($assetOf->fk_commande > 0) {
        $commande->fetch($assetOf->fk_commande);
    }
    $TOFParent = array_merge(array(0 => ''), $assetOf->getCanBeParent($PDOdb));
    $hasParent = false;
    if (!empty($assetOf->fk_assetOf_parent)) {
        $TAssetOFParent = new TAssetOF();
        $TAssetOFParent->load($PDOdb, $assetOf->fk_assetOf_parent);
        $hasParent = true;
    }
    $parameters = array('id' => $assetOf->getId());
    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $assetOf, $mode);
    // Note that $action and $object may have been modified by hook
    if ($fk_product_to_add > 0) {
        $product_to_add = new Product($db);
        $product_to_add->fetch($fk_product_to_add);
        $link_product_to_add = $product_to_add->getNomUrl(1) . ' ' . $product_to_add->label;
        $quantity_to_create = $form->texte('', 'quantity_to_create', 1, 3, 255);
    } else {
        $link_product_to_add = '';
        $quantity_to_create = '';
    }
    print $TBS->render('tpl/fiche_of.tpl.php', array('TNeeded' => $TNeeded, 'TTomake' => $TToMake, 'workstation' => $TWorkstation), array('assetOf' => array('id' => $assetOf->getId(), 'numero' => $assetOf->getId() > 0 ? '<a href="fiche_of.php?id=' . $assetOf->getId() . '">' . $assetOf->getNumero($PDOdb) . '</a>' : $assetOf->getNumero($PDOdb), 'ordre' => $form->combo('', 'ordre', TAssetOf::$TOrdre, $assetOf->ordre), 'fk_commande' => $assetOf->fk_commande == 0 ? '' : $commande->getNomUrl(1), 'commande_fournisseur' => $HtmlCmdFourn, 'date_besoin' => $form->calendrier('', 'date_besoin', $assetOf->date_besoin, 12, 12), 'date_lancement' => $form->calendrier('', 'date_lancement', $assetOf->date_lancement, 12, 12), 'temps_estime_fabrication' => price($assetOf->temps_estime_fabrication, 0, '', 1, -1, 2), 'temps_reel_fabrication' => price($assetOf->temps_reel_fabrication, 0, '', 1, -1, 2), 'fk_soc' => $mode == 'edit' ? $doliform->select_company($assetOf->fk_soc, 'fk_soc', 'client=1', 1) : ($client->id ? $client->getNomUrl(1) : ''), 'fk_project' => custom_select_projects(-1, $assetOf->fk_project, 'fk_project', $mode), 'note' => $form->zonetexte('', 'note', $assetOf->note, 80, 5), 'quantity_to_create' => $quantity_to_create, 'product_to_create' => $link_product_to_add, 'status' => $form->combo('', 'status', TAssetOf::$TStatus, $assetOf->status), 'statustxt' => TAssetOf::$TStatus[$assetOf->status], 'idChild' => !empty($Tid) ? '"' . implode('","', $Tid) . '"' : '', 'url' => dol_buildpath('/of/fiche_of.php', 2), 'url_liste' => $assetOf->getId() ? dol_buildpath('/of/fiche_of.php?id=' . $assetOf->getId(), 2) : dol_buildpath('/of/liste_of.php', 2), 'fk_product_to_add' => $fk_product_to_add, 'fk_nomenclature' => $fk_nomenclature, 'fk_assetOf_parent' => $assetOf->fk_assetOf_parent ? $assetOf->fk_assetOf_parent : '', 'link_assetOf_parent' => $hasParent ? '<a href="' . dol_buildpath('/of/fiche_of.php?id=' . $TAssetOFParent->rowid, 2) . '">' . $TAssetOFParent->numero . '</a>' : '', 'total_cost' => price($assetOf->total_cost, 0, '', 1, -1, 2), 'total_estimated_cost' => price($assetOf->total_estimated_cost, 0, '', 1, -1, 2), 'mo_cost' => price($assetOf->mo_cost, 0, '', 1, -1, 2), 'mo_estimated_cost' => price($assetOf->mo_estimated_cost, 0, '', 1, -1, 2), 'compo_cost' => price($assetOf->compo_cost, 0, '', 1, -1, 2), 'compo_estimated_cost' => price($assetOf->compo_estimated_cost, 0, '', 1, -1, 2), 'current_cost_for_to_make' => price($assetOf->current_cost_for_to_make, 0, '', 1, -1, 2)), 'view' => array('mode' => $mode, 'status' => $assetOf->status, 'allow_delete_of_finish' => $user->rights->of->of->allow_delete_of_finish, 'ASSET_USE_MOD_NOMENCLATURE' => (int) $conf->nomenclature->enabled, 'OF_MINIMAL_VIEW_CHILD_OF' => (int) $conf->global->OF_MINIMAL_VIEW_CHILD_OF, 'select_product' => $select_product, 'select_workstation' => $form->combo('', 'fk_asset_workstation', TWorkstation::getWorstations($PDOdb), -1), 'actionChild' => $mode == 'edit' ? __get('actionChild', 'edit') : __get('actionChild', 'view'), 'use_lot_in_of' => (int) (!empty($conf->asset->enabled) && !empty($conf->global->USE_LOT_IN_OF)), 'use_project_task' => (int) $conf->global->ASSET_USE_PROJECT_TASK, 'defined_user_by_workstation' => (int) $conf->global->ASSET_DEFINED_USER_BY_WORKSTATION, 'defined_task_by_workstation' => (int) $conf->global->ASSET_DEFINED_OPERATION_BY_WORKSTATION, 'defined_workstation_by_needed' => (int) $conf->global->ASSET_DEFINED_WORKSTATION_BY_NEEDED, 'defined_manual_wharehouse' => (int) $conf->global->ASSET_MANUAL_WAREHOUSE, 'hasChildren' => (int) (!empty($Tid)), 'user_id' => $user->id, 'workstation_module_activate' => (int) $conf->workstation->enabled, 'show_cost' => (int) $user->rights->of->of->price), 'rights' => array('show_ws_time' => $user->rights->of->of->show_ws_time)));
    echo $form->end_form();
    llxFooter('$Date: 2011/07/31 22:21:57 $ - $Revision: 1.19 $');
}
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = remiseAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module104921Name"), 0, "remise@remise");
function _saveConst($db, $name, $val)
{
    if (!empty($val)) {
        dolibarr_set_const($db, $name, $val);
        return true;
    }
    return false;
}
$form = new Form($db);
print '<form name="formIDServiceToUse" method="POST" action="" />';
$form->select_produits($conf->global->REMISE_ID_SERVICE_TO_USE, 'idservice', 1, $conf->product->limit_size, $buyer->price_level);
print '<input type="hidden" name="action" value="saveIDServiceToUse" />';
print '<input type="SUBMIT" name="subIDServiceToUse" value="Utiliser ce service" />';
print '</form>';
print '<form name="formIDCategToExclude" method="POST" action="" />';
print 'Sélection catégorie : ';
print $form->select_all_categories(0, $conf->global->REMISE_ID_CATEG_TO_EXCLUDE, 'idcategtoexclude');
print '<input type="hidden" name="action" value="saveIDCategToExclude" />';
print '<input type="SUBMIT" name="subIDServiceToUse" value="Exclure cette catégorie" />';
print '</form>';
?>
<br />
<table width="100%" class="noborder" style="background-color: #fff;">
    <tr class="liste_titre">
        <td colspan="2"><?php 
echo $langs->trans('Parameters');