diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 152dde9dee3..5541c726d64 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1414,7 +1414,11 @@ if (empty($reshook)) $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } } unset($_POST['prod_entry_mode']); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0f90ba6d935..739135b9809 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3504,7 +3504,7 @@ class Facture extends CommonInvoice /** * Create a document onto disk according to template module. * - * @param string $modele Force template to use ('' to not force) + * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. * @param Translate $outputlangs objet lang a utiliser pour traduction * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description @@ -3532,22 +3532,24 @@ class Facture extends CommonInvoice $modelpath = "core/modules/facture/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + + return $result; } /** * Gets the smallest reference available for a new cycle * * @return int >= 1 if OK, -1 if error - * - * */ function newCycle() { - $sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture'; + $sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f'; + $sql.= " WHERE f.entity in (".getEntity('facture').")"; $resql = $this->db->query($sql); if ($resql) { - if ($resql->num_rows > 0) { + if ($resql->num_rows > 0) + { $res = $this->db->fetch_array($resql); $ref = $res['max(situation_cycle_ref)']; $ref++; @@ -3557,7 +3559,7 @@ class Facture extends CommonInvoice $this->db->free($resql); return $ref; } else { - $this->error = $this->db->error(); + $this->error = $this->db->lasterror(); dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); return -1; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 566f887ba52..77877a37cb2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3406,13 +3406,13 @@ abstract class CommonObject /** * Common function for all objects extending CommonObject for generating documents * - * @param string $modelspath Relative folder where models are placed - * @param string $modele Model to use - * @param Translate $outputlangs Language to use - * @param int $hidedetails 1 to hide details. 0 by default - * @param int $hidedesc 1 to hide product description. 0 by default - * @param int $hideref 1 to hide product reference. 0 by default - * @return int 1 if OK -1 if not OK + * @param string $modelspath Relative folder where generators are placed + * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. + * @param Translate $outputlangs Language to use + * @param int $hidedetails 1 to hide details. 0 by default + * @param int $hidedesc 1 to hide product description. 0 by default + * @param int $hideref 1 to hide product reference. 0 by default + * @return int >0 if OK, <0 if KO */ protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref) { @@ -3426,7 +3426,7 @@ abstract class CommonObject @set_time_limit(120); error_reporting($err); - // If selected modele is a filename template (then $modele="modelname:filename") + // If selected model is a filename template (then $modele="modelname" or "modelname:filename") $tmp=explode(':',$modele,2); if (! empty($tmp[1])) { @@ -3456,7 +3456,7 @@ abstract class CommonObject if ($filefound) break; } - // Charge le modele + // If generator was found if ($filefound) { require_once $file; @@ -3464,6 +3464,47 @@ abstract class CommonObject $obj = new $classname($this->db); //$obj->message = $message; + // If generator is ODT, we must have srctemplatepath defined, if not we set it. + if ($obj->type == 'odt' && empty($srctemplatepath)) + { + $varfortemplatedir=$obj->scandir; + if ($varfortemplatedir && ! empty($conf->global->$varfortemplatedir)) + { + $dirtoscan=$conf->global->$varfortemplatedir; + + $listoffiles=array(); + + // Now we add first model found in directories scanned + $listofdir=explode(',',$dirtoscan); + foreach($listofdir as $key=>$tmpdir) + { + $tmpdir=trim($tmpdir); + $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); + if (! $tmpdir) { unset($listofdir[$key]); continue; } + if (is_dir($tmpdir)) + { + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0); + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); + } + } + + if (count($listoffiles)) + { + foreach($listoffiles as $record) + { + $srctemplatepath=$record['fullname']; + break; + } + } + } + + if (empty($srctemplatepath)) + { + $this->error='ErrorGenerationAskedForOdtTemplateWithNoSrcFileFound'; + return -1; + } + } + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; @@ -3483,14 +3524,15 @@ abstract class CommonObject else { $outputlangs->charset_output=$sav_charset_output; - dol_print_error($this->db,"Error generating document for ".__CLASS__.". Error: ".$obj->error); + dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors); return -1; } } else { - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); + $this->error=$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); + dol_print_error('',$this->error); return -1; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 417c9284f68..7cf0e4ff91c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1649,7 +1649,7 @@ function isValidEmail($address, $acceptsupervisorkey=0) /** * Return true if phone number syntax is ok * TODO Decide what to do with this - * + * * @param string $phone phone (Ex: "0601010101") * @return boolean true if phone syntax is OK, false if KO or empty string */ @@ -2474,10 +2474,11 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0) * * @param DoliDB $db Database handler * @param mixed $error String or array of errors strings to show + * @param array $errors Array of errors * @return void * @see dol_htmloutput_errors */ -function dol_print_error($db='',$error='') +function dol_print_error($db='',$error='',$errors=null) { global $conf,$langs,$argv; global $dolibarr_main_prod; @@ -2550,12 +2551,15 @@ function dol_print_error($db='',$error='') $syslog.=", db_error=".$db->lasterror(); } - if ($error) + if ($error || $errors) { $langs->load("errors"); - if (is_array($error)) $errors=$error; - else $errors=array($error); + // Merge all into $errors array + if (is_array($error) && is_array($errors)) $errors=array_merge($error,$errors); + elseif (is_array($error)) $errors=$error; + elseif (is_array($errors)) $errors=array_merge(array($error),$errors); + else $errors=array_merge(array($error)); foreach($errors as $msg) { @@ -2564,7 +2568,7 @@ function dol_print_error($db='',$error='') { $out.="".$langs->trans("Message").": ".$msg."
\n" ; } - else // Mode CLI + else // Mode CLI { $out.='> '.$langs->transnoentities("Message").":\n".$msg."\n" ; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 41cb4f7ab23..f7da56da39c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -58,6 +58,7 @@ $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); $type=GETPOST('type','int'); $action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view'); +$cancel=GETPOST('cancel'); $confirm=GETPOST('confirm','alpha'); $socid=GETPOST('socid','int'); if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -98,6 +99,8 @@ $hookmanager->initHooks(array('productcard','globalcard')); * Actions */ +if ($cancel) $action = ''; + $createbarcode=empty($conf->barcode->enabled)?0:1; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->creer_advance)) $createbarcode=0; @@ -520,19 +523,45 @@ if (empty($reshook)) } - // Add product into proposal - if ($object->id > 0 && $action == 'addinpropal') + // Add product into object + if ($object->id > 0 && $action == 'addin') { - $propal = new Propal($db); - $result=$propal->fetch(GETPOST('propalid')); - if ($result <= 0) + if (GETPOST('propalid') > 0) { - dol_print_error($db,$propal->error); - exit; + $propal = new Propal($db); + $result=$propal->fetch(GETPOST('propalid')); + if ($result <= 0) + { + dol_print_error($db,$propal->error); + exit; + } + $thirpdartyid = $propal->socid; + } + elseif (GETPOST('commandeid') > 0) + { + $commande = new Commande($db); + $result=$commande->fetch(GETPOST('commandeid')); + if ($result <= 0) + { + dol_print_error($db,$commande->error); + exit; + } + $thirpdartyid = $commande->socid; + } + elseif (GETPOST('factureid') > 0) + { + $facture = new Facture($db); + $result=$facture->fetch(GETPOST('factureid')); + if ($result <= 0) + { + dol_print_error($db,$facture->error); + exit; + } + $thirpdartyid = $facture->socid; } $soc = new Societe($db); - $result=$soc->fetch($propal->socid); + $result=$soc->fetch($thirpdartyid); if ($result <= 0) { dol_print_error($db,$soc->error); @@ -589,254 +618,116 @@ if (empty($reshook)) } } - $result = $propal->addline( - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, // localtax1 - $localtax2_tx, // localtax2 - $object->id, - GETPOST('remise_percent'), - $price_base_type, - $pu_ttc, - 0, - 0, - -1, - 0, - 0, - 0, - 0, - '', - '', - '', - 0, - $object->fk_unit - ); - if ($result > 0) + if (GETPOST('propalid') > 0) { - header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id); - return; + $result = $propal->addline( + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, // localtax1 + $localtax2_tx, // localtax2 + $object->id, + GETPOST('remise_percent'), + $price_base_type, + $pu_ttc, + 0, + 0, + -1, + 0, + 0, + 0, + 0, + '', + '', + '', + 0, + $object->fk_unit + ); + if ($result > 0) + { + header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id); + return; + } + + setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors'); } - - setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors'); - } - - // Add product into order - if ($object->id > 0 && $action == 'addincommande') - { - $commande = new Commande($db); - $result=$commande->fetch(GETPOST('commandeid')); - if ($result <= 0) + elseif (GETPOST('commandeid') > 0) { - dol_print_error($db,$commande->error); - exit; + $result = $commande->addline( + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, // localtax1 + $localtax2_tx, // localtax2 + $object->id, + GETPOST('remise_percent'), + '', + '', + $price_base_type, + $pu_ttc, + '', + '', + 0, + -1, + 0, + 0, + null, + 0, + '', + 0, + $object->fk_unit + ); + + if ($result > 0) + { + header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".$commande->id); + exit; + } } - - $soc = new Societe($db); - $result=$soc->fetch($commande->socid); - if ($result <= 0) - { - dol_print_error($db,$soc->error); - exit; - } - - $desc = $object->description; - - $tva_tx = get_default_tva($mysoc, $soc, $object->id); - $localtax1_tx= get_localtax($tva_tx, 1, $soc); - $localtax2_tx= get_localtax($tva_tx, 2, $soc); - - - $pu_ht = $object->price; - $pu_ttc = $object->price_ttc; - $price_base_type = $object->price_base_type; - - // If multiprice - if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - { - $pu_ht = $object->multiprices[$soc->price_level]; - $pu_ttc = $object->multiprices_ttc[$soc->price_level]; - $price_base_type = $object->multiprices_base_type[$soc->price_level]; - } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + elseif (GETPOST('factureid') > 0) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + $result = $facture->addline( + $desc, + $pu_ht, + GETPOST('qty'), + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $object->id, + GETPOST('remise_percent'), + '', + '', + '', + '', + '', + $price_base_type, + $pu_ttc, + Facture::TYPE_STANDARD, + -1, + 0, + '', + 0, + 0, + null, + 0, + '', + 0, + 100, + '', + $object->fk_unit + ); - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $object->id,'t.fk_soc' => $soc->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines [0]->price); - $pu_ttc = price($prodcustprice->lines [0]->price_ttc); - $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; - } - } + if ($result > 0) + { + header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id); + exit; + } } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $object->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } - - $result = $commande->addline( - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, // localtax1 - $localtax2_tx, // localtax2 - $object->id, - GETPOST('remise_percent'), - '', - '', - $price_base_type, - $pu_ttc, - '', - '', - 0, - -1, - 0, - 0, - null, - 0, - '', - 0, - $object->fk_unit - ); - - if ($result > 0) - { - header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".$commande->id); - exit; - } - } - - // Add product into invoice - if ($object->id > 0 && $action == 'addinfacture' && $user->rights->facture->creer) - { - $facture = New Facture($db); - $result=$facture->fetch(GETPOST('factureid')); - if ($result <= 0) - { - dol_print_error($db,$facture->error); - exit; - } - - $soc = new Societe($db); - $soc->fetch($facture->socid); - if ($result <= 0) - { - dol_print_error($db,$soc->error); - exit; - } - - $desc = $object->description; - - $tva_tx = get_default_tva($mysoc, $soc, $object->id); - $localtax1_tx= get_localtax($tva_tx, 1, $soc); - $localtax2_tx= get_localtax($tva_tx, 2, $soc); - - $pu_ht = $object->price; - $pu_ttc = $object->price_ttc; - $price_base_type = $object->price_base_type; - - // If multiprice - if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - { - $pu_ht = $object->multiprices[$soc->price_level]; - $pu_ttc = $object->multiprices_ttc[$soc->price_level]; - $price_base_type = $object->multiprices_base_type[$soc->price_level]; - } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) - { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $object->id,'t.fk_soc' => $soc->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines [0]->price); - $pu_ttc = price($prodcustprice->lines [0]->price_ttc); - $price_base_type = $prodcustprice->lines [0]->price_base_type; - $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; - } - } - } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $object->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } - - $result = $facture->addline( - $desc, - $pu_ht, - GETPOST('qty'), - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $object->id, - GETPOST('remise_percent'), - '', - '', - '', - '', - '', - $price_base_type, - $pu_ttc, - Facture::TYPE_STANDARD, - -1, - 0, - '', - 0, - 0, - null, - 0, - '', - 0, - 100, - '', - $object->fk_unit - ); - - if ($result > 0) - { - header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id); - exit; - } } } -if (GETPOST("cancel") == $langs->trans("Cancel")) -{ - $action = ''; - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; -} /* @@ -1815,42 +1706,23 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("propal"); - $html .= ''; - $html .= ''.$langs->trans("AddToDraftProposals").''; - $html .= ''; - $html .= ''; - $var=true; $otherprop = $propal->liste_array(2,1,0); - $html .= '
'; - $html .= ''; - $html .= ''; + if (is_array($otherprop) && count($otherprop)) { $var=!$var; $html .= ''; - $html .= ''; } else - { + { $html .= "'; } - $html .= '
'; - $html .= ''; - $html .= $langs->trans("Proposals").''; + $html .= $langs->trans("AddToDraftProposals").''; $html .= $form->selectarray("propalid", $otherprop, 0, 1); $html .= '
'.$langs->trans("Quantity").' '; - $html .= ''.$langs->trans("ReductionShort").'(%) '; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= '
"; $html .= $langs->trans("NoDraftProposals"); $html .= '
'; - $html .= '
'; - - $html .= ''; - $html .= ''; } // Commande @@ -1860,30 +1732,15 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("orders"); - $html .= ''; - $html .= ''.$langs->trans("AddToDraftOrders").''; - $html .= ''; - $html .= ''; - $var=true; $othercom = $commande->liste_array(2, 1, null); - $html .= '
'; - $html .= ''; - $html .= ''; if (is_array($othercom) && count($othercom)) { $var=!$var; $html .= ''; - $html .= ''; } else { @@ -1891,11 +1748,6 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $html .= $langs->trans("NoDraftOrders"); $html .= ''; } - $html .= '
'; - $html .= ''; - $html .= $langs->trans("Orders").''; + $html .= $langs->trans("AddToDraftOrders").''; $html .= $form->selectarray("commandeid", $othercom, 0, 1); $html .= '
'.$langs->trans("Quantity").' '; - $html .= ''.$langs->trans("ReductionShort").'(%) '; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= '
'; - $html .= '
'; - - $html .= ''; - $html .= ''; } // Factures @@ -1905,30 +1757,15 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("bills"); - $html .= ''; - $html .= ''.$langs->trans("AddToDraftInvoices").''; - $html .= ''; - $html .= ''; - $var=true; $otherinvoice = $invoice->liste_array(2, 1, null); - $html .= '
'; - $html .= ''; - $html .= ''; if (is_array($otherinvoice) && count($otherinvoice)) { $var=!$var; $html .= ''; - $html .= ''; } else { @@ -1936,20 +1773,31 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $html .= $langs->trans("NoDraftInvoices"); $html .= ''; } - $html .= '
'; - $html .= ''; - $html .= $langs->trans("Invoice").''; + $html .= $langs->trans("AddToDraftInvoices").''; $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= '
'.$langs->trans("Quantity").' '; - $html .= ''.$langs->trans("ReductionShort").'(%) '; - $html .= ''; - $html .= ''; - $html .= ''; - $html .= '
'; - $html .= '
'; - - $html .= ''; - $html .= ''; } //If any text is going to be printed, then we show the table if (!empty($html)) { - print ''; + print ''; + print ''; + print ''; + + print load_fiche_titre($langs->trans("Add"),'',''); + + $html .= ''; + + print '
'.$langs->trans("Quantity").' '; + $html .= ''.$langs->trans("ReductionShort").'(%) '; + $html .= ''; + $html .= '
'; print $html; print '
'; - print '
'; + + print '
'; + print ''; + print '
'; + + print ''; } } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 9d7a9215ef1..abeb8fdf995 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -523,20 +523,20 @@ if ($id || $ref) $param="&id=".$product->id; print ''; print_liste_field_titre($langs->trans("Suppliers"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print ''.$langs->trans("SupplierRef").''; + print_liste_field_titre($langs->trans("SupplierRef")); if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre($langs->trans("Availability"),$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("PriceQtyMinHT").''; + print_liste_field_titre($langs->trans("VATRate")); + print_liste_field_titre($langs->trans("PriceQtyMinHT")); print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); - print ''.$langs->trans("DiscountQtyMin").''; + print_liste_field_titre($langs->trans("DiscountQtyMin")); print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); // Charges ???? if ($conf->global->PRODUCT_CHARGES) { - if (! empty($conf->margin->enabled)) print ''.$langs->trans("UnitCharges").''; + if (! empty($conf->margin->enabled)) print_liste_field_titre($langs->trans("UnitCharges")); } - print ''; + print_liste_field_titre(''); print "\n"; $product_fourn = new ProductFournisseur($db); diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 7cbd9898204..2f0e903b8c5 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -65,7 +65,7 @@ else

This page is a sample of page using tables. It is designed to make test with
-- css (edit page to change to test another css)
+- css (add parameter &theme=newthem to test another theme or edit css of current theme)
- jmobile (add parameter dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)
- dataTables
- tablednd
@@ -115,9 +115,13 @@ This page is a sample of page using tables. It is designed to make test with
-


Example 1 : Standard table => Use this if you need the drag and drop for lines
+


Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines
initAsSpecimen(); + $sortfield='aaa'; $sortorder='ASC'; $tasksarray=array(1,2,3); // To force having several lines @@ -130,14 +134,14 @@ if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/aj trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?> trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?> -a1b1c1 -a2b2c2 +getNomUrl(1); ?>b1c1 +a2b2c2
-


Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable => Use this for long result tables
+


Example 2 : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for long result tables
@@ -221,9 +225,11 @@ $('xxxth').replaceWith( - - - trans('zzz'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); ?> + + + trans('Column C'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); + ?> @@ -292,7 +298,7 @@ $('xxxth').replaceWith(
-


Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this, but AVOID IT if possible, for tables that need to have a different form for each line (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

+


Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)

-
line3
-
dfsdf
-
ffdsfsd
-
aaaa
+
Title A
+
title B
+
title C
+
title D
-
+
line4
dfsdf
bbbb
-
+
line5
dfsdf
bbbb
+
+
line6
+
jghjgh
+
5
+
lll
+
snakeColumn A