Exemple #1
0
		if ($id_fourn <= 0)
		{
			//print "eee".$_POST["id_fourn"];
			$error++;
			$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")).'</div>';
		}

		if (! $error)
		{
			$ret=$product->add_fournisseur($user, $id_fourn, $ref_fourn);
			if ($ret == -3)
			{
				$error++;

				$product->fetch($product->product_id_already_linked);
				$productLink = $product->getNomUrl(1,'supplier');

				$mesg='<div class="error">'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink).'</div>';
			}
			else if ($ret < 0)
			{
				$error++;
				$mesg='<div class="error">'.$product->error.'</div>';
			}
		}

		if (! $error)
		{
			if ($_POST["qty"])
			{
				if ($_POST["price"] >= 0)
Exemple #2
0
 }
 if ($objp->code_buy_l != $objp->code_buy_p) {
     $code_buy_p_l_differ = 'color:red';
 }
 print "<tr {$bc[$var]}>";
 // Ref Invoice
 $facturefourn_static->ref = $objp->ref;
 $facturefourn_static->id = $objp->facid;
 print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
 // Ref Supplier Invoice
 $productfourn_static->ref = $objp->product_ref;
 $productfourn_static->id = $objp->product_id;
 $productfourn_static->type = $objp->type;
 print '<td>';
 if ($productfourn_static->id) {
     print $productfourn_static->getNomUrl(1);
 } else {
     print '&nbsp;';
 }
 print '</td>';
 print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
 // TODO: we should set a user defined value to adjust user square / wide screen size
 $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
 print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
 print '<td align="right">';
 print price($objp->price);
 print '</td>';
 if ($objp->vat_tx_l != $objp->vat_tx_p) {
     $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
 }
 print '<td style="' . $code_vat_differ . '" align="center">';
         print '<td>&nbsp;</td><td>&nbsp;</td>';
     }
     print "</tr>";
 }
 // Edit line
 if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && $_GET["rowid"] == $line->id) {
     print "\n";
     print '<tr ' . $bc[$var] . '>';
     print '<td>';
     print '<input type="hidden" name="elrowid" value="' . $_GET['rowid'] . '">';
     print '<a name="' . $line->id . '"></a>';
     // ancre pour retourner sur la ligne
     if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && $line->fk_product > 0) {
         $product_static = new ProductFournisseur($db);
         $product_static->fetch_opt($line->fk_product);
         $text = $product_static->getNomUrl(1, 'supplier');
         $text .= ' - ' . $product_static->libelle;
         $description = $conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->description);
         print $form->textwithtooltip($text, $description, 3, '', '', $i);
         // Show range
         print_date_range($date_start, $date_end);
         print '<br>';
     } else {
         $forceall = 1;
         // For suppliers, we always show all types
         print $form->select_type_of_lines($line->product_type, 'type', 1, 0, $forceall);
         if ($forceall || !empty($conf->product->enabled) && !empty($conf->service->enabled) || empty($conf->product->enabled) && empty($conf->service->enabled)) {
             print '<br>';
         }
     }
     if (is_object($hookmanager)) {
     print '<td align="right" class="nowrap"><input size="1" name="remise_percent" type="text" value="' . $object->lines[$i]->remise_percent . '"><span class="hideonsmartphone">%</span></td>';
     print '<td align="right" class="nowrap">&nbsp;</td>';
     print '<td align="right" class="nowrap">&nbsp;</td>';
     print '<td align="center" colspan="2"><input type="submit" class="button" name="save" value="' . $langs->trans('Save') . '">';
     print '<br><input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
     print '</tr>';
 } else {
     print '<tr id="row-' . $object->lines[$i]->rowid . '" ' . $bc[$var] . '>';
     // Show product and description
     print '<td>';
     if ($object->lines[$i]->fk_product) {
         print '<a name="' . $object->lines[$i]->rowid . '"></a>';
         // ancre pour retourner sur la ligne
         $product_static = new ProductFournisseur($db);
         $product_static->fetch($object->lines[$i]->fk_product);
         $text = $product_static->getNomUrl(1);
         $text .= ' - ' . $product_static->libelle;
         $description = $conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($object->lines[$i]->description);
         print $form->textwithtooltip($text, $description, 3, '', '', $i);
         // Show range
         print_date_range($date_start, $date_end);
         // Add description in form
         if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
             print $object->lines[$i]->description && $object->lines[$i]->description != $product_static->libelle ? '<br>' . dol_htmlentitiesbr($object->lines[$i]->description) : '';
         }
     }
     // Description - Editor wysiwyg
     if (!$object->lines[$i]->fk_product) {
         if ($type == 1) {
             $text = img_object($langs->trans('Service'), 'service');
         } else {