diff --git a/dev/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf b/dev/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf new file mode 100644 index 00000000000..1c0d0c91e73 Binary files /dev/null and b/dev/iso-normes/format_FEC-Lien_outil_de_test_agréé.pdf differ diff --git a/dev/iso-normes/format_FEC.pdf b/dev/iso-normes/format_FEC.pdf index 2b577030550..ad62797a190 100644 Binary files a/dev/iso-normes/format_FEC.pdf and b/dev/iso-normes/format_FEC.pdf differ diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index a54aac470e5..ed8f8ed976e 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -166,7 +166,11 @@ class modMyModule extends DolibarrModules // Add here list of php file(s) stored in core/boxes that contains class to show a box. $this->boxes = array(); // List of boxes // Example: - //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); + //$this->boxes=array( + // 0=>array('file'=>'myboxa.php@mymodule','note'=>'','enabledbydefaulton'=>'Home'), + // 1=>array('file'=>'myboxb.php@mymodule','note'=>''), + // 2=>array('file'=>'myboxc.php@mymodule','note'=>'') + //); // Cronjobs $this->cronjobs = array(); // List of cron jobs entries to add diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 7f0ff1fc7d4..03f70955527 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -88,7 +88,7 @@ $extrafields = new ExtraFields($db); ********************************************************************/ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index dec170ae169..834e0b07e2f 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -124,7 +124,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab ********************************************************************/ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b6f412d5480..951a07d3171 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -44,13 +44,14 @@ $search_doc_ref = GETPOST("search_doc_ref"); $search_account = GETPOST("search_account"); $search_thirdparty = GETPOST("search_thirdparty"); $search_journal = GETPOST("search_journal"); +$limit = $conf->liste_limit; if ($sortorder == "") $sortorder = "ASC"; if ($sortfield == "") $sortfield = "bk.rowid"; -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $formventilation = new FormVentilation($db); $formother = new FormOther($db); diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index ce6d10f9730..fe185fd1118 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -36,6 +36,7 @@ $langs->load("accountancy"); $page = GETPOST("page"); $sortorder = GETPOST("sortorder"); $sortfield = GETPOST("sortfield"); +$limit = $conf->liste_limit; // Filter $year = GETPOST("year", 'int'); @@ -52,7 +53,7 @@ if ($sortorder == "") if ($sortfield == "") $sortfield = "bk.rowid"; -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; llxHeader('', $langs->trans("Bookkeeping")); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 06574f7ae10..8d629175902 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -98,7 +98,8 @@ abstract class ActionsAdherentCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 823866f8ce6..66c1ae1ce56 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -180,21 +180,21 @@ else // Always show vat rates with vat 0 $s=2/7;$qty=1;$vat=0; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=1;$vat=0; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=0; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; @@ -230,7 +230,7 @@ else for ($qty=1; $qty<=2; $qty++) { $s=10/3; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; @@ -245,14 +245,14 @@ else // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. $s=10/3;$qty=1;$vat=10; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=10; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; @@ -272,8 +272,8 @@ else $s2=2/7; // Round by line - $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0); - $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); + $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); $total_ht = $tmparray1[0] + $tmparray2[0]; $total_tva = $tmparray1[1] + $tmparray2[1]; $total_ttc = $tmparray1[2] + $tmparray2[2]; @@ -296,7 +296,7 @@ else // Global round $subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU'))); - $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0); + $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0,$mysoc); $total_ht = $tmparray3[0]; $total_tva = $tmparray3[1]; $total_ttc = $tmparray3[2]; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index f9cee8a75f3..04183bed336 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -503,7 +503,7 @@ print ''; print ''; print ''; print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; -print ''; +$variablename='DELIVERY_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 604b426b800..05fe548daff 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -124,10 +124,12 @@ if ($action == 'send' && ! $_POST['cancel']) if ($result) { setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs'); + setEventMessages($smsfile->error, $smsfile->errors, 'mesgs'); } else { setEventMessages($langs->trans("ResultKo"), null, 'errors'); + setEventMessages($smsfile->error, $smsfile->errors, 'errors'); } $action=''; diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 296ced0f172..fd67bf9e2ae 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -89,7 +89,7 @@ class Facturation */ public function ajoutArticle() { - global $conf,$db; + global $conf,$db,$mysoc; $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; @@ -118,7 +118,7 @@ class Facturation } // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,0); + $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,$mysoc); // Calcul du total ht sans remise $total_ht = $resultarray[0]; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index cc7bafa9f5d..20796db24f4 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -32,9 +32,10 @@ $result=restrictedArea($user,'mailing'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 645bdc580b4..fbaf00e53db 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -105,7 +105,10 @@ if ($_socid > 0) print ''; + print '>'.$i; + $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; + if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); + print ''; } print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 250687a5c02..cda28c80b37 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2901,8 +2901,7 @@ class Propal extends CommonObject /** - * \class PropaleLigne - * \brief Class to manage commercial proposal lines + * Class to manage commercial proposal lines */ class PropaleLigne extends CommonObjectLine { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8176d1f3c63..de32e30c5e6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1222,7 +1222,7 @@ class Commande extends CommonOrder $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type,'', $localtaxes_type); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b35aa1628f3..b7caa472425 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -67,13 +67,13 @@ $result = restrictedArea($user, 'commande', $id,''); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); +$limit = $conf->liste_limit; if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield='c.rowid'; if (! $sortorder) $sortorder='DESC'; -$limit = $conf->liste_limit; $viewstatut=GETPOST('viewstatut'); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index c3c5f7dd80b..7c849f67f50 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -46,13 +46,13 @@ $search_company=GETPOST('search_company','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); +$limit = $conf->liste_limit; if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.dated"; -$limit = $conf->liste_limit; $year=GETPOST("year"); $month=GETPOST("month"); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9ce11ee5abf..4d3c194bce1 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2837,7 +2837,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print ''; if ($action == 'editthirdparty') { - $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid'); + $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid','client>0'); } else { print '  ' . $soc->getNomUrl(1, 'compta'); print '   '; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 204092b257a..35238d71a2f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -405,6 +405,8 @@ class FactureRec extends Facture */ function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null) { + global $mysoc; + $facid=$this->id; dol_syslog("FactureRec::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG); @@ -437,7 +439,7 @@ class FactureRec extends Facture // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b58d2052b99..60f931ba90c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2401,18 +2401,20 @@ class Facture extends CommonInvoice /** * Update invoice line with percentage * - * @param FactureLigne $line Invoice line - * @param int $percent Percentage + * @param FactureLigne $line Invoice line + * @param int $percent Percentage * @return void */ function update_percent($line, $percent) { + global $mysoc; + include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); // Cap percentages to 100 if ($percent > 100) $percent = 100; $line->situation_percent = $percent; - $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, '', '', $percent); + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, $mysoc, '', $percent); $line->total_ht = $tabprice[0]; $line->total_tva = $tabprice[1]; $line->total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 707ad32eec7..0d0d1835732 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -77,14 +77,14 @@ if ($option == 'late') $filter = 'paye:0'; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='f.datef'; -$limit = $conf->liste_limit; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index c322863efc1..f4451178e71 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -43,12 +43,12 @@ $search_account = GETPOST('search_account','int'); $search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="dp"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 6e3d31364ce..0a5c2cd1572 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -57,12 +57,12 @@ $search_amount=GETPOST("search_amount"); $search_company=GETPOST("search_company"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; diff --git a/htdocs/compta/ventilation/list.php b/htdocs/compta/ventilation/list.php index 03a1b658cd2..264673049ad 100644 --- a/htdocs/compta/ventilation/list.php +++ b/htdocs/compta/ventilation/list.php @@ -47,12 +47,12 @@ llxHeader('','Ventilation'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 7e43270a32c..3d6b792d99b 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -94,7 +94,8 @@ abstract class ActionsContactCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index dc2734b28a1..ac7411b49c3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -36,7 +36,9 @@ $langs->load("companies"); $langs->load("suppliers"); // Security check +$id = GETPOST('id','int'); $contactid = GETPOST('id','int'); +$ref = ''; // There is no ref for contacts if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid,''); @@ -150,13 +152,20 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } +$object=new Contact($db); +if (($id > 0 || ! empty($ref)) && $action != 'add') +{ + $result=$object->fetch($id,$ref); + if ($result < 0) dol_print_error($db); +} + /* * Actions */ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index b6819fdd87f..4456df76f83 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -149,9 +149,10 @@ class CSMSFile $sms->message=$this->message; $res=$sms->SmsSend(); + $this->error = $sms->error; + $this->errors = $sms->errors; if ($res <= 0) { - $this->error=$sms->error; dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERR); } else diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index a8bb07e6ec6..6851c124743 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -179,13 +179,14 @@ class Canvas } /** - * Shared method for canvas to execute actions + * Shared method for canvas to execute actions. + * @deprecated Use the doActions of hooks instead of this. + * This function is called if you add a doActions class inside your canvas. Try to not + * do that and add action code into a hook instead. * * @param string $action Action string * @param int $id Object id * @return mixed Return return code of doActions of canvas - * @deprecated This function is called if you add a doActions class inside your canvas. Try to not - * do that and add action code into a hook instead. * @see http://wiki.dolibarr.org/index.php/Canvas_development */ function doActions(&$action='view', $id=0) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 18580c4b6cc..a5643c26dc5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2017,8 +2017,8 @@ class Form { $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); } - $opt.= ' - '.$duration_value.' '.$langs->trans($dur[$duration_unit]); - $outval.=' - '.$duration_value.' '.$langs->transnoentities($dur[$duration_unit]); + $opt.= ' - '.$duration_value.' '.($dur[$duration_unit]?$langs->trans($dur[$duration_unit]):''); + $outval.=' - '.$duration_value.' '.($dur[$duration_unit]?$langs->transnoentities($dur[$duration_unit]):''); } $opt.= "\n"; diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php new file mode 100644 index 00000000000..1a608f6bc2e --- /dev/null +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -0,0 +1,50 @@ +entity.')'; +//print $sql; +$resql=$this->db->query($sql); +if ($resql) // This can fail when class is used on old database (during migration for example) +{ + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname=$keyforaliasextra.'.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $tmpkeys=array_keys($tmpparam['options']); + $tmp=array_shift($tmpkeys); + } + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]=$keyforelement; + } +} +// End add axtra fields diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 6e6da6bd686..502e83010f7 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -91,6 +91,19 @@ function accounting_prepare_head(AccountingAccount $object) return $head; } +/** + * Return accounting account without zero on the right + * + * @param string $account Accounting account + * @return string String without zero on the right + */ +function clean_account($account) +{ + $account = rtrim($account,"0"); + + return $account; +} + /** * Return general accounting account with defined length * @@ -131,7 +144,7 @@ function length_accountg($account) */ function length_accounta($accounta) { - global $conf, $langs; + global $conf; $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 24a1c87182a..8390e1f10a0 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -183,52 +183,23 @@ class modCommande extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - // Add extra fields - $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.')'; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='order'; - } - } - // End add extra fields + $keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='commandedet'; $keyforelement='order_line'; $keyforaliasextra='extra2'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande as c'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_extrafields as extra ON c.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet_extrafields as extra2 on cd.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande'; $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('commande',1).')'; } diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 72437d80b90..0b237c02c77 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -185,46 +185,12 @@ class modFacture extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'"; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='facture'; - } - } - // End add axtra fields + $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='facturedet'; $keyforelement='invoice_line'; $keyforaliasextra='extra2'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; @@ -233,7 +199,9 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facturedet as fd'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet_extrafields as extra2 on fd.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture',1).')'; $r++; @@ -247,46 +215,8 @@ class modFacture extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','p.fk_bank'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture'"; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='facture'; - } - } - // End add axtra fields + $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 62fe7d2defe..65f5a4729b5 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -176,52 +176,23 @@ class modPropale extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - // Add extra fields - $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.')'; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='propal'; - } - } - // End add extra fields + $keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='propaldet'; $keyforelement='propal_line'; $keyforaliasextra='extra2'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra3'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet_extrafields as extra2 on cd.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('propal',1).')'; } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 0a91e59593d..9477e91837e 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -34,13 +34,13 @@ $langs->load("donations"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); +$limit = $conf->liste_limit; if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.datedon"; -$limit = $conf->liste_limit; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; $search_all=GETPOST('sall','alpha'); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 36d85366805..dfe848808c8 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -224,7 +224,7 @@ if (empty($reshook)) $ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int')); if ($ret < 0) { - $mesg='
'.$object->error.'
'; + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } @@ -237,7 +237,7 @@ if (empty($reshook)) $ret=$object->addline_batch($batch_line[$i]); if ($ret < 0) { - $mesg='
'.$object->error.'
'; + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } @@ -249,14 +249,14 @@ if (empty($reshook)) $ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment. if ($ret <= 0) { - $mesg='
'.$object->error.'
'; + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } } else { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'
'; + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip")), null, 'errors'); $error++; } @@ -287,7 +287,7 @@ if (empty($reshook)) } else { - $mesg=$object->error; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -337,19 +337,18 @@ if (empty($reshook)) } else { - $langs->load("errors"); - setEventMessages($langs->trans($object->error), null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } - - else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate))) + // TODO add alternative status + /*else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate))) { $result = $object->setStatut(0); if ($result < 0) { - $mesg = $object->error; + setEventMessages($object->error, $object->errors, 'errors'); } - } + }*/ else if ($action == 'setdate_livraison' && $user->rights->expedition->creer) { @@ -360,7 +359,7 @@ if (empty($reshook)) $result=$object->set_date_livraison($user,$datedelivery); if ($result < 0) { - $mesg='
'.$object->error.'
'; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -485,8 +484,6 @@ if ($action == 'create') setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors'); } - dol_htmloutput_mesg($mesg); - if ($origin) { $classname = ucfirst($origin); @@ -928,8 +925,6 @@ else if ($id || $ref) if ($object->id > 0) { - dol_htmloutput_mesg($mesg); - if (!empty($object->origin)) { $typeobject = $object->origin; @@ -943,8 +938,6 @@ else if ($id || $ref) $head=shipping_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); - dol_htmloutput_mesg($mesg); - /* * Confirmation de la suppression */ diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index d7bfc9aed98..2513de4caaa 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1068,6 +1068,7 @@ class Expedition extends CommonObject break; } } + if ($error) break; // break for loop incase of error } } } @@ -1180,7 +1181,7 @@ class Expedition extends CommonObject */ function fetch_lines() { - global $conf; + global $conf, $mysoc; // TODO: recuperer les champs du document associe a part $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked"; @@ -1256,7 +1257,7 @@ class Expedition extends CommonObject $line->volume_units = $obj->volume_units; // For invoicing - $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type); // We force type to 0 + $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) $line->qty = $line->qty_shipped; $line->total_ht = $tabprice[0]; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 5339538901e..bee47fe25bd 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -43,15 +43,14 @@ $optioncss = GETPOST('optioncss','alpha'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); +$limit = $conf->liste_limit; if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; -$limit = $conf->liste_limit; $viewstatut=GETPOST('viewstatut'); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index aa36b690619..30642ad09c5 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -886,7 +886,8 @@ if ($action == "addline") $object_ligne->fk_expensereport = $_POST['fk_expensereport']; $type = 0; // TODO What if service ? - $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); + $seller = ''; // seller is unknown + $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller); $object_ligne->vatrate = price2num($vatrate); $object_ligne->total_ttc = $tmp[2]; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 502125faf61..0d1dc22971a 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -93,15 +93,15 @@ $sortfield = GETPOST("sortfield"); $page = GETPOST("page"); if (!$sortorder) $sortorder="DESC"; if (!$sortfield) $sortfield="d.date_debut"; +$limit = $conf->liste_limit; if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; $sql.= " d.date_debut, d.date_fin,"; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 896d8c6a4fa..35224cb7780 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -44,9 +44,10 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid,'fichinter'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); +$limit = $conf->liste_limit; $page = GETPOST('page','int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; @@ -55,7 +56,6 @@ if (! $sortfield) if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date"; else $sortfield="f.ref"; } -$limit = $conf->liste_limit; $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha'); $search_company=GETPOST('search_company','alpha'); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1888cdc8adc..236eca113ff 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -996,7 +996,7 @@ class CommandeFournisseur extends CommonOrder { $result = -1; $this->error = $langs->trans('NotAuthorized'); - $this->errors[] = $lanfs->trans('NotAuthorized'); + $this->errors[] = $langs->trans('NotAuthorized'); dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR); } return $result ; diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql new file mode 100644 index 00000000000..f8a74fec247 --- /dev/null +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -0,0 +1,25 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 4.0.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +ALTER TABLE llx_accounting_bookkeeping ADD COLUMN validated tinyint DEFAULT 0 NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 660dd4745b3..dca4b70a5d5 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -35,5 +35,6 @@ CREATE TABLE llx_accounting_bookkeeping fk_user_author integer NOT NULL, import_key varchar(14), code_journal varchar(10) DEFAULT NULL, - piece_num integer NOT NULL + piece_num integer NOT NULL, + validated tinyint DEFAULT 0 NOT NULL -- 0 line not validated / 1 line validated (No deleting / No modification) ) ENGINE=innodb; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a5d43a0d95e..8729dedc0a5 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1292,7 +1292,10 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf) function migrate_price_facture($db,$langs,$conf) { $err=0; - + + $tmpmysoc=new Societe($db); + $tmpmysoc->setMysoc($conf); + $db->begin(); print ''; @@ -1333,7 +1336,7 @@ function migrate_price_facture($db,$langs,$conf) $facligne= new FactureLigne($db); $facligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate, 0, 0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate, 0, 0,$remise_percent_global,'HT',$info_bits,$facligne->product_type,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1407,6 +1410,9 @@ function migrate_price_facture($db,$langs,$conf) */ function migrate_price_propal($db,$langs,$conf) { + $tmpmysoc=new Societe($db); + $tmpmysoc->setMysoc($conf); + $db->begin(); print ''; @@ -1445,7 +1451,7 @@ function migrate_price_propal($db,$langs,$conf) $propalligne= new PropaleLigne($db); $propalligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,$propalligne->product_type,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1552,9 +1558,9 @@ function migrate_price_contrat($db,$langs,$conf) // On met a jour les 3 nouveaux champs $contratligne= new ContratLigne($db); //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis - $contratligne->id=$rowid; + $contratligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,0,'HT',$info_bits,0,$tmpmysoc); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,0,'HT',$info_bits,$contratligne->product_type,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1603,6 +1609,9 @@ function migrate_price_commande($db,$langs,$conf) { $db->begin(); + $tmpmysoc=new Societe($db); + $tmpmysoc->setMysoc($conf); + print ''; print '
'; @@ -1639,7 +1648,7 @@ function migrate_price_commande($db,$langs,$conf) $commandeligne= new OrderLine($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,$commandeligne->product_type,$tmpmysoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1716,7 +1725,10 @@ function migrate_price_commande($db,$langs,$conf) function migrate_price_commande_fournisseur($db,$langs,$conf) { $db->begin(); - + + $tmpmysoc=new Societe($db); + $tmpmysoc->setMysoc($conf); + print ''; print '
'; @@ -1753,7 +1765,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $commandeligne= new CommandeFournisseurLigne($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,0); + $result=calcul_price_total($qty,$pu,$remise_percent,$vatrate,0,0,$remise_percent_global,'HT',$info_bits,$commandeligne->product_type,$tmpsoc); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f345e59891a..8c850fdabd3 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -252,7 +252,7 @@ UnitPmp=Net unit VWAP CostPmpHT=Net total VWAP ProductUsedForBuild=Auto consumed by production ProductBuilded=Production completed -ProductsMultiPrice=Product multi-price +ProductsMultiPrice=Products and prices for each price level ProductsOrServiceMultiPrice=Customer prices (of products or services, multi-prices) ProductSellByQuarterHT=Products turnover quarterly before tax ServiceSellByQuarterHT=Services turnover quarterly before tax diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 4844d9f8e59..fe73419c98b 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -38,9 +38,10 @@ $status=GETPOST('status'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield="p.date_fin"; @@ -48,8 +49,6 @@ if (! $sortorder) $sortorder="DESC"; if ($page < 0) { $page = 0; } -$limit = $conf->liste_limit; -$offset = $limit * $page; $langs->load("opensurvey"); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 77b14b24c7a..33a84719ba7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -149,21 +149,21 @@ if (empty($reshook)) else $errors[] = 'FailedToValidateBarCode'; $error++; - setEventMessage($errors,'errors'); + setEventMessages($errors, null, 'errors'); } } if ($action == 'setaccountancy_code_buy') { $result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy')); - if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); + if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors'); $action=""; } if ($action == 'setaccountancy_code_sell') { $result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell')); - if ($result < 0) setEventMessage(join(',',$object->errors), 'errors'); + if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors'); $action=""; } @@ -174,17 +174,23 @@ if (empty($reshook)) if (! GETPOST('label')) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), null, 'errors'); $action = "create"; $error++; } if (empty($ref)) { - setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), null, 'errors'); $action = "create"; $error++; } - + if (GETPOST('duration_value') && ! GETPOST('duration_unit')) + { + setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Unit')), 'errors'); + $action = "create"; + $error++; + } + if (! $error) { $units = GETPOST('units', 'int'); @@ -224,7 +230,8 @@ if (empty($reshook)) if ($result < 0) { $error++; - setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); + $mesg='Failed to get bar code type information '; + setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; @@ -290,8 +297,8 @@ if (empty($reshook)) } else { - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($langs->trans($object->error), 'errors'); + if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); + else setEventMessages($langs->trans($object->error), null, 'errors'); $action = "create"; } } @@ -353,7 +360,8 @@ if (empty($reshook)) if ($result < 0) { $error++; - setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors'); + $mesg='Failed to get bar code type information '; + setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors'); } $object->barcode_type_code = $stdobject->barcode_type_code; $object->barcode_type_coder = $stdobject->barcode_type_coder; @@ -378,15 +386,15 @@ if (empty($reshook)) } else { - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($langs->trans($object->error), 'errors'); + if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); + else setEventMessages($langs->trans($object->error), null, 'errors'); $action = 'edit'; } } else { - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - else setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors'); + if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); + else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors'); $action = 'edit'; } } @@ -400,7 +408,7 @@ if (empty($reshook)) { if (! GETPOST('clone_content') && ! GETPOST('clone_prices') ) { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -427,7 +435,7 @@ if (empty($reshook)) if ($result < 1) { $db->rollback(); - setEventMessage($langs->trans('ErrorProductClone'), 'errors'); + setEventMessages($langs->trans('ErrorProductClone'), null, 'errors'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId); exit; } @@ -454,7 +462,7 @@ if (empty($reshook)) $mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref); $mesg.=' '.$langs->trans("ShowCardHere").'.'; - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, null, 'errors'); $object->fetch($id); } else @@ -462,12 +470,12 @@ if (empty($reshook)) $db->rollback(); if (count($object->errors)) { - setEventMessage($object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); dol_print_error($db,$object->errors); } else { - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($langs->trans($object->error), null, 'errors'); dol_print_error($db,$object->error); } } @@ -498,7 +506,7 @@ if (empty($reshook)) } else { - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($langs->trans($object->error), null, 'errors'); $reload = 0; $action=''; } @@ -624,7 +632,7 @@ if (empty($reshook)) return; } - setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors'); + setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors'); } elseif (GETPOST('commandeid') > 0) { $result = $commande->addline( $desc, @@ -696,7 +704,7 @@ if (empty($reshook)) } else { $action=""; - setEventMessage($langs->trans("WarningSelectOneDocument"), 'warnings'); + setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings'); } } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index ecb3d12bb52..8a4c68990c6 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -105,7 +105,7 @@ if (empty($reshook)) $filetomerge->file_name=$filename; $result=$filetomerge->delete_by_file($user); if ($result<0) { - setEventMessage($filetomerge->error,'errors'); + setEventMessages($filetomerge->error, $filetomerge->errors, 'errors'); } } } @@ -137,7 +137,7 @@ if ($action=='filemerge') $result=$filetomerge->delete_by_product($user, $object->id); } if ($result<0) { - setEventMessage($filetomerge->error,'errors'); + setEventMessages($filetomerge->error, $filetomerge->errors, 'errors'); } // for each file checked add it to the product @@ -152,7 +152,7 @@ if ($action=='filemerge') $result=$filetomerge->create($user); if ($result<0) { - setEventMessage($filetomerge->error,'errors'); + setEventMessages($filetomerge->error, $filetomerge->errors, 'errors'); } } } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 04007d2ede1..1f5e35a043a 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -101,7 +101,7 @@ if (empty($reshook)) if ($result > 0) { $object->cost_price = price2num($cost_price); - setEventMessage($langs->trans("RecordSaved")); + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } else { @@ -119,7 +119,7 @@ if (empty($reshook)) $action = ''; $result=$object->remove_product_fournisseur_price($rowid); if($result > 0){ - setEventMessage($langs->trans("PriceRemoved")); + setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs'); }else{ $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -151,7 +151,7 @@ if (empty($reshook)) { $error++; $langs->load("errors"); - setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors'); } if (empty($quantity)) { @@ -199,12 +199,12 @@ if (empty($reshook)) $object->fetch($object->product_id_already_linked); $productLink = $object->getNomUrl(1,'supplier'); - setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors'); + setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), null, 'errors'); } else if ($ret < 0) { $error++; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -220,7 +220,7 @@ if (empty($reshook)) { $error++; - setEventMessage($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -231,7 +231,7 @@ if (empty($reshook)) $price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx); if ($price_result < 0) { //Expression is not valid $error++; - setEventMessage($priceparser->translatedError(), 'errors'); + setEventMessages($priceparser->translatedError(), null, 'errors'); } } if (! $error && ! empty($conf->dynamicprices->enabled)) { @@ -239,7 +239,7 @@ if (empty($reshook)) if ($ret < 0) { $error++; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index b656b88efc6..5924a89956b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -61,7 +61,7 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield="p.ref"; @@ -293,7 +293,7 @@ else // Displays product removal confirmation if (GETPOST('delprod')) { - setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod'))); + setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); } if ($sref) $param="&sref=".$sref; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2a770841c60..e5b93d981af 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -6,7 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Philippe Grand + * Copyright (C) 2014-2015 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García @@ -131,7 +131,7 @@ if (empty($reshook)) if ($priceparser->parseProduct($object) < 0) { $error ++; - setEventMessage($priceparser->translatedError(), 'errors'); + setEventMessages($priceparser->translatedError(), null, 'errors'); } } } @@ -194,7 +194,7 @@ if (empty($reshook)) $newprice_min = price2num($val['price_min'], 'MU'); if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { - setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors'); + setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors'); $error ++; break; } @@ -203,7 +203,7 @@ if (empty($reshook)) if ($res < 0) { $error ++; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); break; } } @@ -211,12 +211,12 @@ if (empty($reshook)) if (!$error && $object->update($object->id, $user) < 0) { $error++; - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } if (empty($error)) { $action = ''; - setEventMessage($langs->trans("RecordSaved")); + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); } else { $action = 'edit_price'; @@ -229,7 +229,7 @@ if (empty($reshook)) { $result = $object->log_price_delete($user, $_GET ["lineid"]); if ($result < 0) { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -341,7 +341,7 @@ if (empty($reshook)) if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier) { - setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); + setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors'); $error++; $action='add_customer_price'; } @@ -351,9 +351,9 @@ if (empty($reshook)) $result = $prodcustprice->create($user, 0, $update_child_soc); if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } else { - setEventMessage($langs->trans('RecordSaved'), 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; @@ -367,9 +367,9 @@ if (empty($reshook)) $result = $prodcustprice->delete($user); if ($result < 0) { - setEventMessage($prodcustprice->error, 'mesgs'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs'); } else { - setEventMessage($langs->trans('RecordDeleted'), 'errors'); + setEventMessages($langs->trans('RecordDeleted'), null, 'errors'); } $action = ''; } @@ -391,7 +391,7 @@ if (empty($reshook)) if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { - setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors'); + setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors'); $error++; $action='update_customer_price'; } @@ -401,9 +401,9 @@ if (empty($reshook)) $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } else { - setEventMessage($langs->trans('Save'), 'mesgs'); + setEventMessages($langs->trans('Save'), null, 'mesgs'); } $action = ''; @@ -1257,7 +1257,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $result = $prodcustprice->fetch(GETPOST('lineid', 'int')); if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } print '
'; @@ -1346,7 +1346,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } $option = '&socid=' . GETPOST('socid', 'int') . '&id=' . $object->id; @@ -1422,7 +1422,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { - setEventMessage($prodcustprice->error, 'errors'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } $option = '&search_soc=' . $search_soc . '&id=' . $object->id; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 561b38977ac..dde89bfb6e5 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -139,15 +139,15 @@ class MouvementStock extends CommonObject $obj = $this->db->fetch_object($resql); if ($this->db->jdate($obj->eatby) != $eatby) { - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby); - dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby)); + $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); + dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); $this->db->rollback(); return -3; } if ($this->db->jdate($obj->sellby) != $sellby) { - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby); - dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby)); + $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)); + dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR); $this->db->rollback(); return -3; } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index a6085699a63..fbb80551fad 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -54,11 +54,12 @@ $search_warehouse = trim(GETPOST("search_warehouse")); $search_inventorycode = trim(GETPOST("search_inventorycode")); $search_user = trim(GETPOST("search_user")); $search_batch = trim(GETPOST("search_batch")); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); if ($page < 0) $page = 0; -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; if (! $sortfield) $sortfield="m.datem"; if (! $sortorder) $sortorder="DESC"; @@ -100,7 +101,7 @@ if ($action == "correct_stock") if (! is_numeric($_POST["nbpiece"])) { $error++; - setEventMessage($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); $action='correction'; } @@ -203,6 +204,14 @@ if (! empty($search_product)) $sql.= " AND p.label LIKE '%".$db->escape($s if (! empty($search_warehouse)) $sql.= " AND e.label LIKE '%".$db->escape($search_warehouse)."%'"; if (! empty($search_user)) $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'"; if (! empty($search_batch)) $sql.= " AND m.batch LIKE '%".$db->escape($search_batch)."%'"; + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); @@ -248,7 +257,7 @@ if ($resql) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; // Ref print '
'.$langs->trans("Ref").''; @@ -470,8 +479,8 @@ if ($resql) if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param.='&search_user='.urlencode($search_user); if ($idproduct > 0) $param.='&idproduct='.$idproduct; - if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,''); - else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); + if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,''); + else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords); print ''; if ($id) print ''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 0476a459f60..ad4acbe362a 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -77,7 +77,7 @@ if ($action == 'setstocklimit') $object->seuil_stock_alerte=$stocklimit; $result=$object->update($object->id,$user,0,'update'); if ($result < 0) - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } @@ -89,7 +89,7 @@ if ($action == 'setdesiredstock') $object->desiredstock=$desiredstock; $result=$object->update($object->id,$user,0,'update'); if ($result < 0) - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 620f1acbb40..5df580877c5 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -176,7 +176,7 @@ if ($action == 'order' && isset($_POST['valid'])) $fail++; $msg = $langs->trans('OrderFail') . " : "; $msg .= $order->error; - setEventMessage($msg, 'errors'); + setEventMessages($msg, null, 'errors'); } else { $id = $result; } @@ -195,7 +195,7 @@ if ($action == 'order' && isset($_POST['valid'])) $fail++; $msg = $langs->trans('OrderFail') . " : "; $msg .= $order->error; - setEventMessage($msg, 'errors'); + setEventMessages($msg, null, 'errors'); } $i++; } @@ -205,7 +205,7 @@ if ($action == 'order' && isset($_POST['valid'])) { $db->commit(); - setEventMessage($langs->trans('OrderCreated'), 'mesgs'); + setEventMessages($langs->trans('OrderCreated'), null, 'mesgs'); header('Location: replenishorders.php'); exit; } @@ -216,7 +216,7 @@ if ($action == 'order' && isset($_POST['valid'])) } if ($box == 0) { - setEventMessage($langs->trans('SelectProductWithNotNullQty'), 'warnings'); + setEventMessages($langs->trans('SelectProductWithNotNullQty'), null, 'warnings'); } } diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index a40b7b15cd9..96c94e9efff 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -94,7 +94,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'add'; - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -130,7 +130,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'edit'; - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -151,7 +151,7 @@ $cancel != $langs->trans("Cancel") && else { $action = 'edit'; - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index ea2b70c2447..d96d238c41b 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -81,9 +81,10 @@ function llxFooterVierge() $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/resource/class/actions_resource.class.php b/htdocs/resource/class/actions_resource.class.php deleted file mode 100644 index f8f0b5412f9..00000000000 --- a/htdocs/resource/class/actions_resource.class.php +++ /dev/null @@ -1,86 +0,0 @@ - - * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ - -/** - * \file resource/class/actions_resource.class.php - * \brief Place module actions - */ - -/** - * Actions class file for resources - * - * TODO Remove this class and replace a method into commonobject - */ -class ActionsResource -{ - - var $db; - var $error; - var $errors=array(); - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - /** - * doActions for resource module - * - * @param array $parameters parameters - * @param Object $object object - * @param string $action action - * @return void - */ - /* Why a hook action ? TODO Remove this class and replace a method into commonobject - function doActions($parameters, &$object, &$action) - { - global $langs,$user; - $langs->load('resource'); - - if (in_array('resource_card',explode(':',$parameters['context']))) - { - if($action == 'confirm_delete_resource' && !GETPOST('cancel')) - { - $res = $object->fetch(GETPOST('id')); - if($res) - { - - $result = $object->delete(GETPOST('id')); - - if ($result >= 0) - { - setEventMessage($langs->trans('RessourceSuccessfullyDeleted')); - Header("Location: list.php"); - exit; - } - else { - setEventMessage($object->error,'errors'); - } - } - else - { - setEventMessage($object->error,'errors'); - } - } - } - }*/ -} diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0dd71b42baa..782a7f070c4 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -89,7 +89,8 @@ abstract class ActionsCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param int $action Action code * @return void diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index c7ed03080f6..19f9a2fbdb8 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -68,7 +68,8 @@ class ActionsCardCompany extends ActionsCardCommon /** - * Execute actions + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index f38d0d034ef..78064004e37 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -69,6 +69,7 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Execute actions + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Action * @param int $id Id of object (may be empty for creation) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 64ac2fbb256..6341f1dd37e 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -181,11 +181,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); + $limit = $conf->liste_limit; $page = GETPOST("page", 'int'); if ($page == - 1) { $page = 0; } - $offset = $conf->liste_limit * $page; + $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) @@ -200,7 +201,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $search_soc = GETPOST('search_soc'); if (! empty($search_soc)) { - $filter ['soc.nom'] = $search_soc; + $filter['soc.nom'] = $search_soc; } if ($action == 'add_customer_price') { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 799a94a4104..54a578a1e61 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -371,7 +371,7 @@ class SupplierProposal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -531,7 +531,7 @@ class SupplierProposal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 6aad541c1f9..1df4b49b56a 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -139,15 +139,15 @@ $now=dol_now(); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); +$limit = $conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield='p.date_livraison'; if (! $sortorder) $sortorder='DESC'; -$limit = $conf->liste_limit; $sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';