diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 188ee09952d00c60b4bd58212b15c27722a04483..d31fc030c14b4b685073693025a0109cfc585887 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1896,11 +1896,6 @@ class Commande extends CommonObject $price = price2num($price); $subprice = price2num($subprice); - - // TODO: utile ? - $LigneOld = new OrderLine($this->db); - $LigneOld->fetch($rowid); - // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET"; $sql.= " description='".addslashes($desc)."'"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 9a865648e64f25f33e0f3129f8c2368388fc43af..71b308ec4099b9354392bd09879d5e9a35de9953 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1709,284 +1709,6 @@ else $commande->printLinesList($lines,1); } } - - - /* - $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, '; - $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,'; - $sql.= ' l.total_ht, l.total_tva, l.total_ttc,'; - $sql.= ' l.date_start,'; - $sql.= ' l.date_end,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, '; - $sql.= ' p.description as product_desc'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; - $sql.= ' WHERE l.fk_commande = '.$commande->id; - $sql.= ' ORDER BY l.rang ASC, l.rowid'; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - - print '<table class="noborder" width="100%">'; - if ($num) - { - print '<tr class="liste_titre">'; - print '<td>'.$langs->trans('Description').'</td>'; - print '<td align="right" width="50">'.$langs->trans('VAT').'</td>'; - print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; - print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; - print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>'; - print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>'; - print '<td width="48" colspan="3"> </td>'; - print "</tr>\n"; - } - $var=true; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - - // Show product and description - $type=$objp->product_type?$objp->product_type:$objp->fk_product_type; - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($objp->date_start)) $type=1; - if (! empty($objp->date_end)) $type=1; - - // Ligne en mode visu - if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid) - { - print '<tr '.$bc[$var].'>'; - if ($objp->fk_product > 0) - { - print '<td>'; - print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne - - // Show product and description - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $product_static->libelle=$objp->product_label; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$objp->product_label; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); - print $html->textwithtooltip($text,$description,3,'','',$i); - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - - // Add description in form - if ($conf->global->PRODUIT_DESC_IN_FORM) - { - print ($objp->description && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; - } - - print '</td>'; - } - else - { - print '<td>'; - print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne - if (($objp->info_bits & 2) == 2) - { - print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$commande->socid.'">'; - print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); - print '</a>'; - if ($objp->description) - { - if ($objp->description == '(CREDIT_NOTE)') - { - require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'); - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); - } - else - { - print ' - '.nl2br($objp->description); - } - } - } - else - { - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - print $text.' '.nl2br($objp->description); - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - } - print '</td>'; - } - - print '<td align="right" nowrap="nowrap">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>'; - print '<td align="right" nowrap="nowrap">'.price($objp->subprice).'</td>'; - print '<td align="right">'; - if (($objp->info_bits & 2) != 2) - { - print $objp->qty; - } - else print ' '; - print '</td>'; - - //Remise percent (negative or positive) - if (!empty($objp->remise_percent)) - { - print '<td align="right">'.dol_print_reduction($objp->remise_percent,$langs).'</td>'; - } - else - { - print '<td> </td>'; - } - - // Montant total HT - print '<td align="right" nowrap="nowrap">'.price($objp->total_ht).'</td>'; - - // Icone d'edition et suppression - if ($commande->statut == 0 && $user->rights->commande->creer) - { - print '<td align="center">'; - if (($objp->info_bits & 2) == 2) - { - // Ligne remise predefinie, on ne permet pas modif - } - else - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=editline&rowid='.$objp->rowid.'#'.$objp->rowid.'">'; - print img_edit(); - print '</a>'; - } - print '</td>'; - print '<td align="center">'; - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=ask_deleteline&lineid='.$objp->rowid.'">'; - print img_delete(); - print '</a></td>'; - if ($num > 1) - { - print '<td align="center">'; - if ($i > 0) - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=up&rowid='.$objp->rowid.'">'; - print img_up(); - print '</a>'; - } - if ($i < $num-1) - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=down&rowid='.$objp->rowid.'">'; - print img_down(); - print '</a>'; - } - print '</td>'; - } - } - else - { - print '<td colspan="3"> </td>'; - } - print '</tr>'; - } - - // Ligne en mode update - if ($_GET['action'] == 'editline' && $user->rights->commande->creer && $_GET['rowid'] == $objp->rowid) - { - print '<form action="'.$_SERVER["PHP_SELF"].'#'.$objp->rowid.'" method="post">'; - print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="action" value="updateligne">'; - print '<input type="hidden" name="id" value="'.$commande->id.'">'; - print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">'; - print '<tr '.$bc[$var].'>'; - print '<td>'; - print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne - - - // Show product and description - if ($objp->fk_product > 0) - { - print '<input type="hidden" name="productid" value="'.$objp->fk_product.'">'; - $product_static->type=$objp->fk_product_type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $product_static->libelle=$objp->product_label; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$objp->product_label; - print $text; - print '<br>'; - } - else - { - print $html->select_type_of_lines($objp->product_type,'type',1); - if ($conf->product->enabled && $conf->service->enabled) print '<br>'; - } - - // Editor wysiwyg - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('eldesc',$objp->description,140,'dolibarr_details'); - $doleditor->Create(); - } - else - { - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - print '<textarea name="eldesc" class="flat" cols="70" rows="'.$nbrows.'">'; - print dol_htmlentitiesbr_decode($objp->description); - print '</textarea>'; - } - print '</td>'; - print '<td align="right">'; - if($soc->tva_assuj == "0") - print '<input type="hidden" name="tva_tx" value="0">0'; - else - print $html->select_tva('tva_tx',$objp->tva_tx,$mysoc,$soc); - print '</td>'; - print '<td align="right"><input size="5" type="text" class="flat" name="pu" value="'.price($objp->subprice,0,'',0).'"></td>'; - print '<td align="right">'; - if (($objp->info_bits & 2) != 2) - { - print '<input size="2" type="text" class="flat" name="qty" value="'.$objp->qty.'">'; - } - else print ' '; - print '</td>'; - print '<td align="right" nowrap="nowrap">'; - if (($objp->info_bits & 2) != 2) - { - print '<input size="1" type="text" class="flat" name="elremise_percent" value="'.$objp->remise_percent.'">%'; - } - else print ' '; - print '</td>'; - print '<td align="center" colspan="4"><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>'; - - // Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) - // Start and end dates selector - print '<tr '.$bc[$var].'>'; - print '<td colspan="9">'.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $html->select_date($db->jdate($objp->date_start),'date_start',$usehm,$usehm,$objp->date_start?0:1,"updateligne"); - print ' '.$langs->trans('to').' '; - print $html->select_date($db->jdate($objp->date_end),'date_end',$usehm,$usehm,$objp->date_end?0:1,"updateligne"); - print '</td>'; - print '</tr>'; - - print '</form>'; - } - - $total = $total + ($objp->qty * $objp->price); - $i++; - } - $db->free($resql); - - $numlines=$num; - } - else - { - dol_print_error($db); - } - */ /* * Form to add new line