From 9be8c579d0aea997b03701beaedd8975971a5265 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 4 Oct 2018 13:30:37 +0200 Subject: [PATCH 01/88] New massaction to generate PDF --- htdocs/compta/facture/list.php | 1 + htdocs/core/actions_massactions.inc.php | 61 +++++++++++++++++++++++++ htdocs/langs/en_US/main.lang | 2 + 3 files changed, 64 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 78576e4c00d..7a708e412c7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -587,6 +587,7 @@ if ($resql) $arrayofmassactions=array( 'validate'=>$langs->trans("Validate"), + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2bb55264cf9..91ff96a6b00 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1130,6 +1130,67 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == //var_dump($listofobjectthirdparties);exit; } +// Generate document foreach object according to model linked to object +// @TODO : propose model selection +if (! $error && $massaction == 'generate_doc' && $permtoread) +{ + $db->begin(); + + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $outputlangs = $langs; + $newlang=''; + + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // To be sure vars is defined + if (empty($hidedetails)) $hidedetails=0; + if (empty($hidedesc)) $hidedesc=0; + if (empty($hideref)) $hideref=0; + if (empty($moreparams)) $moreparams=null; + + $result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } +} + $parameters['toselect']=$toselect; $parameters['uploaddir']=$uploaddir; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb2f2a8e9fb..2846434f460 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -86,6 +86,7 @@ GoToWikiHelpPage=Read online help (Internet access needed) GoToHelpPage=Read help RecordSaved=Record saved RecordDeleted=Record deleted +RecordGenerated=Record generated LevelOfFeature=Level of features NotDefined=Not defined DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr authentication mode is set to %s in configuration file conf.php.
This means that the password database is external to Dolibarr, so changing this field may have no effect. @@ -649,6 +650,7 @@ RecordCreatedSuccessfully=Record created successfully RecordModifiedSuccessfully=Record modified successfully RecordsModified=%s record modified RecordsDeleted=%s record deleted +RecordsGenerated=%s record generated AutomaticCode=Automatic code FeatureDisabled=Feature disabled MoveBox=Move widget From d4d921b1ccc522c1447c240b411e1480d3f513c6 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 7 Oct 2018 20:42:45 +0200 Subject: [PATCH 02/88] Add massaction generate on main lists --- htdocs/comm/propal/list.php | 1 + htdocs/commande/list.php | 1 + htdocs/contrat/list.php | 1 + htdocs/expensereport/list.php | 1 + htdocs/fichinter/list.php | 1 + htdocs/fourn/commande/list.php | 1 + htdocs/fourn/facture/list.php | 1 + htdocs/fourn/product/list.php | 1 + htdocs/product/list.php | 1 + htdocs/projet/list.php | 1 + htdocs/supplier_proposal/list.php | 1 + 11 files changed, 11 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dc6e4aff17b..e5995244302 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -453,6 +453,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 558d8186a86..faba02b511d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -438,6 +438,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), 'cancelorders'=>$langs->trans("Cancel"), diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 96f20fdaf67..815c0f10567 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -364,6 +364,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d328cd21de2..f820ca8eea1 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -359,6 +359,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 96a1199255c..8acf580ac78 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -269,6 +269,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 06857526731..b947840c91c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -636,6 +636,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3fa525415bb..e8a35e62804 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -466,6 +466,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( 'validate'=>$langs->trans("Validate"), + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 9927b6b2b5d..56cb4cc2b01 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -117,6 +117,7 @@ if ($fourn_id) $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), 'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 28f08035198..3452efddd72 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -403,6 +403,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index a93fac0edbd..c0bdf351c4d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -438,6 +438,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), // 'presend'=>$langs->trans("SendByMail"), // 'builddoc'=>$langs->trans("PDFMerge"), ); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 2fcb296b433..4a65a3b6b65 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -381,6 +381,7 @@ if ($resql) // List of mass actions available $arrayofmassactions = array( + 'generate_doc'=>$langs->trans("Generate"), //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); From 759b2b6ccff6100edbfb11259bc9d17a8c1878d6 Mon Sep 17 00:00:00 2001 From: atm-john Date: Thu, 25 Oct 2018 21:39:22 +0200 Subject: [PATCH 03/88] Extend import option to Order's card and Propal's card --- htdocs/comm/propal/card.php | 90 +++++++++++++++++- htdocs/commande/card.php | 91 ++++++++++++++++++- .../tpl/ajax/objectlinked_lineimport.tpl.php | 8 +- 3 files changed, 186 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1e6df0b014f..a0aa864ebc6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -695,6 +695,88 @@ if (empty($reshook)) } } } + + // add lines from objectlinked + elseif($action == 'import_lines_from_object' + && $user->rights->propal->creer + && $object->statut == Propal::STATUS_DRAFT + ) + { + $fromElement = GETPOST('fromelement'); + $fromElementid = GETPOST('fromelementid'); + $importLines = GETPOST('line_checkbox'); + + if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) + { + if($fromElement == 'commande') + { + dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'OrderLine'; + } + elseif($fromElement == 'propal') + { + dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'PropaleLigne'; + } + $nextRang = count($object->lines) + 1; + $importCount = 0; + $error = 0; + foreach($importLines as $lineId) + { + $lineId = intval($lineId); + $originLine = new $lineClassName($db); + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) + { + $originLine->fetch_optionals($lineId); + $desc = $originLine->desc; + $pu_ht = $originLine->subprice; + $qty = $originLine->qty; + $txtva = $originLine->tva_tx; + $txlocaltax1 = $originLine->localtax1_tx; + $txlocaltax2 = $originLine->localtax2_tx; + $fk_product = $originLine->fk_product; + $remise_percent = $originLine->remise_percent; + $date_start = $originLine->date_start; + $date_end = $originLine->date_end; + $ventil = 0; + $info_bits = $originLine->info_bits; + $fk_remise_except = $originLine->fk_remise_except; + $price_base_type='HT'; + $pu_ttc=0; + $type = $originLine->product_type; + $rang=$nextRang++; + $special_code = $originLine->special_code; + $origin = $originLine->element; + $origin_id = $originLine->id; + $fk_parent_line=0; + $fk_fournprice=$originLine->fk_fournprice; + $pa_ht = $originLine->pa_ht; + $label = $originLine->label; + $array_options = $originLine->array_options; + $situation_percent = 100; + $fk_prev_id = ''; + $fk_unit = $originLine->fk_unit; + $pu_ht_devise = $originLine->multicurrency_subprice; + + $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$date_start, $date_end,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise, $fk_remise_except); + + if($res > 0){ + $importCount++; + }else{ + $error++; + } + } + else{ + $error++; + } + } + + if($error) + { + setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors'); + } + } + } include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -2490,7 +2572,13 @@ if ($action == 'create') // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + $compatibleImportElementsList = false; + if($user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT) + { + $compatibleImportElementsList = array('commande','propal'); // import from linked elements + } + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); // Show online signature link $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 75b949ff203..4e12c32e65b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1319,6 +1319,88 @@ if (empty($reshook)) exit(); } + // add lines from objectlinked + if($action == 'import_lines_from_object' + && $user->rights->commande->creer + && $object->statut == Commande::STATUS_DRAFT + ) + { + $fromElement = GETPOST('fromelement'); + $fromElementid = GETPOST('fromelementid'); + $importLines = GETPOST('line_checkbox'); + + if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) + { + if($fromElement == 'commande') + { + dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'OrderLine'; + } + elseif($fromElement == 'propal') + { + dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); + $lineClassName = 'PropaleLigne'; + } + $nextRang = count($object->lines) + 1; + $importCount = 0; + $error = 0; + foreach($importLines as $lineId) + { + $lineId = intval($lineId); + $originLine = new $lineClassName($db); + if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0) + { + $originLine->fetch_optionals($lineId); + $desc = $originLine->desc; + $pu_ht = $originLine->subprice; + $qty = $originLine->qty; + $txtva = $originLine->tva_tx; + $txlocaltax1 = $originLine->localtax1_tx; + $txlocaltax2 = $originLine->localtax2_tx; + $fk_product = $originLine->fk_product; + $remise_percent = $originLine->remise_percent; + $date_start = $originLine->date_start; + $date_end = $originLine->date_end; + $ventil = 0; + $info_bits = $originLine->info_bits; + $fk_remise_except = $originLine->fk_remise_except; + $price_base_type='HT'; + $pu_ttc=0; + $type = $originLine->product_type; + $rang=$nextRang++; + $special_code = $originLine->special_code; + $origin = $originLine->element; + $origin_id = $originLine->id; + $fk_parent_line=0; + $fk_fournprice=$originLine->fk_fournprice; + $pa_ht = $originLine->pa_ht; + $label = $originLine->label; + $array_options = $originLine->array_options; + $situation_percent = 100; + $fk_prev_id = ''; + $fk_unit = $originLine->fk_unit; + $pu_ht_devise = $originLine->multicurrency_subprice; + + $res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise); + + if($res > 0){ + $importCount++; + }else{ + $error++; + } + } + else{ + $error++; + } + } + + if($error) + { + setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors'); + } + } + } + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -2639,7 +2721,14 @@ if ($action == 'create' && $user->rights->commande->creer) // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + $compatibleImportElementsList = false; + if($user->rights->commande->creer + && $object->statut == Commande::STATUS_DRAFT) + { + $compatibleImportElementsList = array('commande','propal'); // import from linked elements + } + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList); // Show online payment link $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php index ad32f1b9aa8..73981ed017c 100644 --- a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php +++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php @@ -22,6 +22,12 @@ if (empty($conf) || ! is_object($conf)) exit; } +$objectUrl = $object->getNomUrl(0,'',0,1); +if($object->element == 'propal') +{ + $objectUrl = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id; +} + ?> @@ -47,7 +53,7 @@ $(document).ready(function(){ }); - var $dialog = $('
') + var $dialog = $('
') .load( page + " #tablelines", function() { $("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute From f29ee25ea751400a84c80a6f519052a3aa587a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 11:06:45 +0200 Subject: [PATCH 04/88] remove fieldlabel and add fieldeditkey --- htdocs/commande/card.php | 142 ++++++++++------------------------ htdocs/core/tpl/notes.tpl.php | 3 +- 2 files changed, 44 insertions(+), 101 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f468bd4b146..3036722c3aa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1687,7 +1687,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (! empty($conf->multicurrency->enabled)) { print ''; - print ''.fieldLabel('Currency','multicurrency_code').''; + print ''.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; print ''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print ''; @@ -2074,13 +2074,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Date print ''; - print ''; - - if ($action != 'editdate' && $object->brouillon) - print ''; - print '
'; - print $langs->trans('Date'); - print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Date", 'date', '', $object, $editenable); print ''; if ($action == 'editdate') { print '
'; @@ -2100,12 +2095,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery date planed print ''; - print ''; - if ($action != 'editdate_livraison') - print ''; - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); print ''; if ($action == 'editdate_livraison') { print ''; @@ -2125,13 +2116,9 @@ if ($action == 'create' && $user->rights->commande->creer) // Shipping Method if (! empty($conf->expedition->enabled)) { - print ''; - print ''; - if ($action != 'editshippingmethod' && $user->rights->commande->creer) - print ''; - print '
'; - print $langs->trans('SendingMethod'); - print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; + print ''; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); print ''; if ($action == 'editshippingmethod') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); @@ -2144,15 +2131,12 @@ if ($action == 'create' && $user->rights->commande->creer) // Warehouse if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); print ''; - print ''; - if ($action != 'editwarehouse' && $user->rights->commande->creer) - print ''; - print '
'; - print $langs->trans('Warehouse'); - print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).'
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); print ''; if ($action == 'editwarehouse') { $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); @@ -2165,12 +2149,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Terms of payment print ''; - print ''; - if ($action != 'editconditions') - print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); print ''; if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); @@ -2183,12 +2163,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Mode of payment print ''; - print ''; - if ($action != 'editmode') - print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); print ''; if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); @@ -2203,12 +2179,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency code print ''; print ''; - print ''; - if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print ''; - print '
'; - print fieldLabel('Currency','multicurrency_code'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); print ''; if ($action == 'editmulticurrencycode') { $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); @@ -2220,12 +2192,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency rate print ''; print ''; - print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print ''; - print '
'; - print fieldLabel('CurrencyRate','multicurrency_tx'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + $editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { if($action == 'actualizemulticurrencyrate') { @@ -2244,13 +2212,9 @@ if ($action == 'create' && $user->rights->commande->creer) } // Delivery delay - print ''; - print ''; - if ($action != 'editavailability') - print ''; - print '
'; - print $langs->trans('AvailabilityPeriod'); - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '
'; + print ''; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); print ''; if ($action == 'editavailability') { $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); @@ -2260,13 +2224,9 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // Source reason (why we have an ordrer) - print ''; - print ''; - if ($action != 'editdemandreason') - print ''; - print '
'; - print $langs->trans('Channel'); - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '
'; + print ''; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable); print ''; if ($action == 'editdemandreason') { $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); @@ -2277,13 +2237,9 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO Order mode (how we receive order). Not yet implemented /* - print ''; - print ''; - if ($action != 'editinputmode') - print ''; - print '
'; - print $langs->trans('SourceMode'); - print 'id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '
'; + print ''; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); print ''; if ($action == 'editinputmode') { $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); @@ -2296,15 +2252,13 @@ if ($action == 'create' && $user->rights->commande->creer) $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - if ($totalWeight) - { + if ($totalWeight) { print ''.$langs->trans("CalculatedWeight").''; print ''; print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); print ''; } - if ($totalVolume) - { + if ($totalVolume) { print ''.$langs->trans("CalculatedVolume").''; print ''; print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); @@ -2314,15 +2268,10 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO How record was recorded OrderMode (llx_c_input_method) // Incoterms - if (!empty($conf->incoterm->enabled)) - { + if (!empty($conf->incoterm->enabled)) { print ''; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($user->rights->commande->creer) print ''.img_edit().''; - else print ' '; - print '
'; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); print ''; print ''; if ($action != 'editincoterm') @@ -2337,15 +2286,10 @@ if ($action == 'create' && $user->rights->commande->creer) } // Bank Account - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) - { - print ''; - print ''; - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { + print ''; + $editenable = $user->rights->commande->creer; + print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); print ''; if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); @@ -2446,12 +2390,11 @@ if ($action == 'create' && $user->rights->commande->creer) */ $result = $object->getLinesArray(); - print ' + print ' - - '; + '; if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; @@ -2518,10 +2461,11 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } // Create event - /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a - // "workflow" action so should appears somewhere else on - // page. + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) { + // Add hidden condition because this is not a + // "workflow" action so should appears somewhere else on + // page. print '' . $langs->trans("AddAction") . ''; }*/ diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 39132dd1af7..0d2151ab62d 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -18,8 +18,7 @@ */ // Protection to avoid direct call of template -if (empty($object) || ! is_object($object)) -{ +if (empty($object) || ! is_object($object)) { print "Error, template page can't be called as URL"; exit; } From d67c40dffe3cb637d1d51335d430fad9fa652585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 13:01:01 +0200 Subject: [PATCH 05/88] remove fieldlabel and add fieldeditkey --- htdocs/adherents/card.php | 28 +++++++--------------------- htdocs/commande/card.php | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e7b36b77ad9..84667d9032e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1017,7 +1017,7 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '' . fieldLabel('Categories', 'memcars') . ''; + print '' .$form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%'); print ""; @@ -1140,7 +1140,7 @@ else print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } - // Password + // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''.$langs->trans("Password").'pass).'">'; @@ -1267,7 +1267,7 @@ else // Categories if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { - print '' . fieldLabel('Categories', 'memcats') . ''; + print '' . $form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $c = new Categorie($db); @@ -1620,11 +1620,8 @@ else if (! empty($conf->societe->enabled)) { print ''; - print ''; - if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + $editenable = $user->rights->adherent->creer; + print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable); print ''; if ($action == 'editthirdparty') { @@ -1658,19 +1655,8 @@ else // Login Dolibarr print ''; - print ''; - if ($action != 'editlogin' && $user->rights->adherent->creer) - { - print ''; - } - print '
'; - print $langs->trans("LinkedToDolibarrUser"); - print ''; - if ($user->rights->user->user->creer) - { - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; - } - print '
'; + $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer; + print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print ''; if ($action == 'editlogin') { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3036722c3aa..d02e5c28858 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -106,7 +106,8 @@ $permissionedit = $user->rights->commande->creer; // Used by the include of ac */ $parameters = array('socid' => $socid); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +// Note that $action and $object may be modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -419,10 +420,11 @@ if (empty($reshook)) // Hooks $parameters = array('objFrom' => $srcobject); - $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook - if ($reshook < 0) + // Note that $action and $object may have be modified by hook + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); + if ($reshook < 0) { $error++; + } } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -1669,7 +1671,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Other attributes $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields, 'edit'); @@ -1969,7 +1972,8 @@ if ($action == 'create' && $user->rights->commande->creer) // Call Hook formConfirm $parameters = array('lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; @@ -2095,7 +2099,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery date planed print ''; - $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + $editenable = $user->rights->commande->creer; print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); print ''; if ($action == 'editdate_livraison') { @@ -2420,7 +2424,8 @@ if ($action == 'create' && $user->rights->commande->creer) $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); } } print ''; @@ -2437,8 +2442,8 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'; $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been - // modified by hook + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); if (empty($reshook)) { // Send if ($object->statut > Commande::STATUS_DRAFT) { From 9c7ec434b74398862336246527e20817f99b1ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 13:48:30 +0200 Subject: [PATCH 06/88] remove fieldlabel and add fieldeditkey --- htdocs/admin/holiday.php | 1 - htdocs/commande/card.php | 6 +-- htdocs/societe/card.php | 84 +++++++++++++++++++++------------------- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index c02c9bd480d..81becbaa37c 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -513,7 +513,6 @@ print ''; print '
'; print ''; - } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d02e5c28858..026e7ac2c3f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2319,17 +2319,17 @@ if ($action == 'create' && $user->rights->commande->creer) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount VAT - print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount TTC - print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; + print '' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5935a1d01a1..941bd263b73 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1148,7 +1148,7 @@ else } else { - print ''.fieldLabel('ThirdPartyName','name').''; + print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; print ''; @@ -1161,11 +1161,11 @@ else // If javascript on, we show option individual if ($conf->use_javascript_ajax) { - print ''.fieldLabel('FirstName','firstname').''; + print ''.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).''; print ''; print ''; // Title - print ''.fieldLabel('UserTitle','civility_id').''; + print ''.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').''; print ''; } @@ -1175,7 +1175,7 @@ else print ''; // Prospect/Customer - print ''.fieldLabel('ProspectCustomer','customerprospect',1).''; + print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; print ''; $selected=GETPOST('client','int')!=''?GETPOST('client','int'):$object->client; print ''; - print ''.fieldLabel('CustomerCode','customer_code').''; + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; // Barcode if (! empty($conf->barcode->enabled)) { - print ''; + print ''; print ''; } // Address - print ''; + print ''; print ''; // Zip / Town - print ''; // Country - print ''; @@ -1264,11 +1264,11 @@ else { if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1287,27 +1287,33 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; - print ''; + print ''; + print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; - print ''; + print ''; + print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; - print ''; + print ''; + print ''; } } // Phone / Fax - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Prof ids @@ -1322,7 +1328,7 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; @@ -1334,11 +1340,11 @@ else if ($j % 2 == 1) print ''; // Vat is used - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; // Legal Form - print ''; + print ''; print ''; // Capital - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_MULTILANGS)) { - print ''; print ''; @@ -1429,7 +1435,7 @@ else // Assign a sale representative print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -1453,7 +1459,7 @@ else // Customer //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print '"; @@ -1461,7 +1467,7 @@ else // Supplier //if ($object->fournisseur) { - print '"; @@ -1472,7 +1478,7 @@ else if (! empty($conf->multicurrency->enabled)) { print ''; - print ''; + print ''; print ''; @@ -1489,7 +1495,7 @@ else // Ajout du logo print ''; - print ''; + print ''; print ''; From c92a2084f1e5a14ec80e9567e6c7bbddbb7edcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 14:50:27 +0200 Subject: [PATCH 07/88] remove fieldlabel and add fieldeditkey --- htdocs/commande/card.php | 2 +- htdocs/societe/card.php | 91 +++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 026e7ac2c3f..6ea34c1c619 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -420,7 +420,7 @@ if (empty($reshook)) // Hooks $parameters = array('objFrom' => $srcobject); - // Note that $action and $object may have be modified by hook + // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); if ($reshook < 0) { $error++; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 941bd263b73..4530b5a61c1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * 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 @@ -1742,7 +1743,7 @@ else } // Name - print ''; + print ''; print ''; // Alias names (commercial, trademark or alias names) @@ -1752,7 +1753,7 @@ else // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; print ''; - print '
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); @@ -1202,7 +1202,7 @@ else { // Supplier print '
'.fieldLabel('Supplier','fournisseur',1).''; + print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; $default = -1; if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; print $form->selectyesno("fournisseur", (GETPOST('fournisseur','int')!=''?GETPOST('fournisseur','int'):(GETPOST("type",'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type",'alpha') == '' ? 1 : 0)); @@ -1210,7 +1210,7 @@ else print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) { - print fieldLabel('SupplierCode','supplier_code'); + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) @@ -1228,33 +1228,33 @@ else } // Status - print '
'.fieldLabel('Status','status').''; + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); print '
'.fieldLabel('Gencod','barcode').'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print '
'.fieldLabel('Address','address').'
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.fieldLabel('Zip','zipcode').''; + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); - print ''.fieldLabel('Town','town').''; + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); print '
'.fieldLabel('Country','selectcountry_id').''; + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Region-State','state_id').''; + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } else { - print '
'.fieldLabel('State','state_id').''; + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code); @@ -1277,9 +1277,9 @@ else } // Email / Web - print '
'.fieldLabel('EMail','email',$conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.fieldLabel('Web','url').'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.fieldLabel('Skype','skype').'skype).'">
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).''; + print 'skype).'">'; + print '
'.fieldLabel('Twitter','twitter').'twitter).'">
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).''; + print 'twitter).'">'; + print '
'.fieldLabel('Facebook','facebook').'facebook).'">
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; + print 'facebook).'">'; + print '
'.fieldLabel('Phone','phone').'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.fieldLabel('Fax','fax').''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.fieldLabel($idprof,$key, (empty($conf->global->$idprof_mandatory)?0:1)).''; + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory)?0:1)).''; print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.fieldLabel('VATIsUsed','assujtva_value').'
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; print $form->selectyesno('assujtva_value', GETPOSTISSET('assujtva_value')?GETPOST('assujtva_value','int'):1, 1); // Assujeti par defaut en creation print ''.fieldLabel('VATIntra','intra_vat').''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; $s = ''; @@ -1391,18 +1397,18 @@ else } // Type - Size - print '
'.fieldLabel('ThirdPartyType','typent_id').''."\n"; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').'
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; if ($object->country_id) { @@ -1415,13 +1421,13 @@ else print '
'.fieldLabel('Capital','capital').'
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; print ''.$langs->trans("Currency".$conf->currency).'
'.fieldLabel('DefaultLang','default_lang').''."\n"; + print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1,0,0,'maxwidth200onsmartphone'); print '
'.fieldLabel('AllocateCommercial','commercial_id').''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we for selection of sale representative to him, so after creation he can see the record. @@ -1440,7 +1446,7 @@ else if (!empty($conf->incoterm->enabled)) { print '
'.fieldLabel('IncotermLabel','incoterm_id').''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . ''; + print '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . ''; + print '
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); print "
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); print '
'.fieldLabel('Logo','photoinput').''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; print ''; print '
'.fieldLabel('ThirdPartyName','name',1).'
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).'
'.fieldLabel('Prefix','prefix').''; + print '
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; // It does not change the prefix mode using the auto numbering prefix if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { @@ -1767,14 +1768,14 @@ else } // Prospect/Customer - print '
'.fieldLabel('ProspectCustomer','customerprospect',1).'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''.fieldLabel('CustomerCode','customer_code').''; + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; print ''; + print ''; print ''; } // Status - print ''; // Address - print ''; + print ''; print ''; // Zip / Town - print ''; // Country - print ''; @@ -1878,11 +1879,11 @@ else { if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; if (! empty($conf->socialnetworks->enabled)) @@ -1900,27 +1901,27 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } // Phone / Fax - print ''; + print ''; print ''; - print ''; + print ''; print ''; // Prof ids @@ -1935,12 +1936,8 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - if (empty($conf->global->$idprof_mandatory) || ! $object->isACompany()) - print ''; if (($j % 2) == 1) print ''; $j++; @@ -1950,7 +1947,7 @@ else if ($j % 2 == 1) print ''; // VAT is used - print ''; @@ -1958,7 +1955,7 @@ else //TODO: Place into a function to control showing by country or study better option if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''; - print ''; + print ''; print ''; // Type - Size - print ''; - print ''; // Juridical type - print ''; // Capital - print ''; + print ''; print ''; // Assign a Name print ''; - print ''; + print ''; print ''; print ''; @@ -2077,7 +2074,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { // Customer - print ''; + print ''; print '"; // Supplier - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -2124,9 +2121,9 @@ else // Webservices url/key if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''; + print ''; print ''; - print ''; + print ''; print ''; } @@ -2134,7 +2131,7 @@ else if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; @@ -2142,7 +2139,7 @@ else // Logo print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; From 546a353e58145c04454e29b17198f64fcfbdf646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 15:16:01 +0200 Subject: [PATCH 08/88] remove fieldlabel and add fieldeditkey --- htdocs/expedition/shipment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 920b5508e59..bd520f5f9d2 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -551,17 +551,17 @@ if ($id > 0 || ! empty($ref)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } From 42a9abad56635612efc84e9cdbfef9f445a8ae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Oct 2018 17:45:29 +0200 Subject: [PATCH 09/88] remove fieldlabel and add fieldeditkey --- htdocs/compta/bank/ligne.php | 2 +- htdocs/compta/facture/card.php | 12 +++---- htdocs/compta/facture/prelevement.php | 7 ++-- htdocs/compta/salaries/card.php | 26 +++++++-------- htdocs/contact/card.php | 47 +++++++++++++-------------- htdocs/datapolicy/admin/setupmail.php | 5 +-- htdocs/hrm/establishment/card.php | 36 ++++++++++++-------- htdocs/supplier_proposal/card.php | 15 ++++----- htdocs/user/card.php | 26 +++++++-------- 9 files changed, 90 insertions(+), 86 deletions(-) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 1587c5c10e8..2d4ac69c288 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -596,7 +596,7 @@ if ($result) $langs->load('categories'); // Bank line - print '"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 050f8786c3a..ab654ad2e7c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3196,7 +3196,7 @@ if ($action == 'create') if (! empty($conf->multicurrency->enabled)) { print ''; - print ''; + print ''; print ''; @@ -3899,7 +3899,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) @@ -1805,13 +1806,13 @@ else || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) { print '
'.fieldLabel('Supplier','fournisseur',1).''; + print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; print $form->selectyesno("fournisseur",$object->fournisseur,1); print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) { - print fieldLabel('SupplierCode','supplier_code'); + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) @@ -1844,31 +1845,31 @@ else // Barcode if (! empty($conf->barcode->enabled)) { - print '
'.fieldLabel('Gencod','barcode').'
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print '
'.fieldLabel('Status','status').''; + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status); print '
'.fieldLabel('Address','address').'
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.fieldLabel('Zip','zipcode').''; + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); - print ''.fieldLabel('Town','town').''; + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'.fieldLabel('Country','selectcounty_id').''; + print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Region-State','state_id').''; + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } else { - print '
'.fieldLabel('State','state_id').''; + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } print $formcompany->select_state($object->state_id,$object->country_code); @@ -1890,9 +1891,9 @@ else } // EMail / Web - print '
'.fieldLabel('EMail','email',(! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.fieldLabel('Web','url').'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.fieldLabel('Skype','skype').'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'
'.fieldLabel('Twitter','twitter').'
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'
'.fieldLabel('Facebook','facebook').'
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.fieldLabel('Phone','phone').'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.fieldLabel('Fax','fax').''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.fieldLabel($idprof,$key).''; - else - print ''.fieldLabel($idprof,$key).''; - - print $formcompany->get_input_id_prof($i,$key,$object->$key,$object->country_code); + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', ! (empty($conf->global->$idprof_mandatory) || ! $object->isACompany())).''; + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.fieldLabel('VATIsUsed','assujtva_value').''; + print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; print $form->selectyesno('assujtva_value',$object->tva_assuj,1); print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); if(! isOnlyOneLocalTax(1)) { @@ -1968,7 +1965,7 @@ else } print ''.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if (! isOnlyOneLocalTax(2)) { @@ -1980,7 +1977,7 @@ else } elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") { - print '
'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); if(! isOnlyOneLocalTax(1)) { @@ -1992,7 +1989,7 @@ else } elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") { - print '
'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').''; + print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); if(! isOnlyOneLocalTax(2)) { @@ -2004,7 +2001,7 @@ else } // VAT Code - print '
'.fieldLabel('VATIntra','intra_vat').'
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; $s =''; @@ -2034,29 +2031,29 @@ else print '
'.fieldLabel('ThirdPartyType','typent_id').''; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('JuridicalStatus','forme_juridique_code').''; + print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); print '
'.fieldLabel('Capital','capital').'
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '.$langs->trans("Currency".$conf->currency).'
'.fieldLabel('AllocateCommercial','commercial_id').''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); $arrayselected = GETPOST('commercial', 'array'); @@ -2067,7 +2064,7 @@ else // Default language if (! empty($conf->global->MAIN_MULTILANGS)) { - print '
'.fieldLabel('DefaultLang','default_lang').''."\n"; + print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print $formadmin->select_language($object->default_lang,'default_lang',0,0,1); print '
' . fieldLabel('CustomersCategoriesShort', 'custcats') . '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); @@ -2090,7 +2087,7 @@ else print "
' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . '
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); $c = new Categorie($db); @@ -2107,7 +2104,7 @@ else if (! empty($conf->multicurrency->enabled)) { print '
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); print '
'.fieldLabel('WebServiceURL','webservices_url').'
'.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''.fieldLabel('WebServiceKey','webservices_key').''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).'
'.fieldLabel('IncotermLabel','incoterm_id').''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
'.fieldLabel('Logo','photoinput').''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; if ($object->logo) print $form->showphoto('societe',$object); $caneditfield=1; @@ -2530,7 +2527,7 @@ else if (! empty($conf->multicurrency->enabled)) { print '
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : ''; print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('RubriquesTransactions', 'custcats') . ''; + print '
' . $form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print "
'.fieldLabel('Currency','multicurrency_code').''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
'; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) print ''; @@ -3915,7 +3915,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print '
'; - print fieldLabel('Currency','multicurrency_code'); + print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) print ''; @@ -4001,17 +4001,17 @@ else if ($id > 0 || ! empty($ref)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index d7766268989..7c8ffb7d417 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * 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 @@ -402,17 +403,17 @@ if ($object->id > 0) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT - print ''; + print ''; print ''; print ''; // Multicurrency Amount VAT - print ''; + print ''; print ''; print ''; // Multicurrency Amount TTC - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index f50d940a51a..c67982ed9c5 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE +/* Copyright (C) 2011-2018 Alexandre Spangaro + * Copyright (C) 2014 Laurent Destailleur + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -255,44 +255,44 @@ if ($action == 'create') // Date payment print ''; // Date value for bank print ''; // Employee print ''; // Label print ''; // Date start period print ''; // Date end period print ''; // Amount print ''; @@ -312,14 +312,14 @@ if ($action == 'create') if (! empty($conf->banque->enabled)) { print ''; } // Type payment print ''; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a43127c9a32..e995352c38d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -227,7 +227,7 @@ if (empty($reshook)) $action = 'create'; } else { // Categories association - $contcats = GETPOST( 'contcats', 'array'); + $contcats = GETPOST('contcats', 'array'); $object->setCategories($contcats); } } @@ -383,10 +383,10 @@ if (empty($reshook)) // First we delete all categories association $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_contact'; $sql .= ' WHERE fk_socpeople = ' . $object->id; - $db->query( $sql ); + $db->query($sql); // Then we add the associated categories - $categories = GETPOST( 'contcats', 'array'); + $categories = GETPOST('contcats', 'array'); $object->setCategories($categories); $object->old_lastname=''; @@ -669,19 +669,19 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } @@ -694,10 +694,9 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '"; } @@ -938,19 +937,19 @@ else // Skype if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) { - print ''; + print ''; print ''; } // Twitter if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) { - print ''; + print ''; print ''; } // Facebook if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) { - print ''; + print ''; print ''; } } @@ -980,16 +979,16 @@ else print ''; // Categories - if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { - print ''; + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; print '"; } @@ -1101,10 +1100,10 @@ else $password=$generated_password; // Create a form array - $formquestion=array( - array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), - array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), - //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) + $formquestion = array( + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), + array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password), + //array('label' => $form->textwithpicto($langs->trans("Type"),$langs->trans("InternalExternalDesc")), 'type' => 'select', 'name' => 'intern', 'default' => 1, 'values' => array(0=>$langs->trans('Internal'),1=>$langs->trans('External'))) ); $text=$langs->trans("ConfirmCreateContact").'
'; if (! empty($conf->societe->enabled)) @@ -1176,7 +1175,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print ''; print ''; } diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index 214f673a15f..f50fa08d31c 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -91,9 +91,6 @@ $head = datapolicyAdminPrepareHead(); dol_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy"); - - - print "'."\n"; + } + print load_fiche_titre($langs->trans("DoPayment")); print ''; @@ -298,7 +312,12 @@ if ($action == 'create' || empty($action)) if ($sumpaid < $objp->total_ttc) { $namef = "amount_".$objp->id; - print ''; + $nameRemain = "remain_".$objp->id; // autofill remainder amount + if (!empty($conf->use_javascript_ajax)) // autofill remainder amount + print img_picto("Auto fill",'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->total_ttc - $sumpaid)."'"); // autofill remainder amount + $remaintopay=$objp->total_ttc - $sumpaid; // autofill remainder amount + print ''; // autofill remainder amount + print ''; } else { From 085101376c4491bee45fa933777514a844740695 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 00:41:46 +0100 Subject: [PATCH 42/88] Introduce standard sql date format filter refactoring standard sql filter for date --- htdocs/core/lib/date.lib.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 7ad40349589..b75de970b19 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -3,7 +3,8 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2017 Ferran Marcet - * + * Copyright (C) 2018 Charlene Benke +* * 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 @@ -274,6 +275,36 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt } +/** + * générate standard filter date + * + * @param string $datefield fields where apply sql date filter + * @param int $day_date day date + * @param int $month_date month date + * @param int $year_date year date + + * @return string $sqldate sql part of date + */ + +function dol_sql_datefilter($datefield, $day_date, $month_date, $year_date) { + global $db; + $sqldate="" + if ($month_date > 0) { + if ($year_date > 0 && empty($day_date)) { + $sqldate.= " AND ".$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, $month_date, false)); + $sqldate.= "' AND '".$db->idate(dol_get_last_day($year_date, $month_date, false))."'"; + } else if ($year_date > 0 && ! empty($day_date)) { + $sqldate.= " AND ".$datefield." BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); + $sqldate.= "' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date))."'"; + } else + $sqldate.= " AND date_format( ".$datefield.", '%m') = '".$db->escape($month_date)."'"; + } else if ($year_date > 0){ + $sqldate.= " AND ".$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, 1, false)); + $sqldate.= "' AND '".$db->idate(dol_get_last_day($year_date, 12, false))."'"; + } + return $sqldate; +} + /** * Convert a string date into a GM Timestamps date * Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string. From 19e4698488fba83253a7477c0045de259a8aa0c6 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 10:32:37 +0100 Subject: [PATCH 43/88] Update date.lib.php --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index b75de970b19..e9dcc91ced7 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -288,7 +288,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt function dol_sql_datefilter($datefield, $day_date, $month_date, $year_date) { global $db; - $sqldate="" + $sqldate=""; if ($month_date > 0) { if ($year_date > 0 && empty($day_date)) { $sqldate.= " AND ".$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, $month_date, false)); From d9283722394bd086353cfd82468a9f8051136959 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 1 Dec 2018 14:51:22 +0100 Subject: [PATCH 44/88] fix https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/commande/class/commande.class.php?selectedAuthors%5B0%5D=florian.henry%40atm-consulting.fr&orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3dc168f14c5..5f6ac9752cc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4021,9 +4021,9 @@ class OrderLine extends CommonOrderLine * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 si ko, >0 si ok */ - function delete($user=null, $notrigger=0) + function delete(User $user, $notrigger=0) { - global $conf, $user, $langs; + global $conf, $langs; $error=0; From f94f7e15ca92ca59c7d23605436a0ac05eef733e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Dec 2018 15:07:55 +0100 Subject: [PATCH 45/88] Update date.lib.php --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index e9dcc91ced7..253b2814977 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -286,7 +286,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt * @return string $sqldate sql part of date */ -function dol_sql_datefilter($datefield, $day_date, $month_date, $year_date) { +function dolSqlDatefilter($datefield, $day_date, $month_date, $year_date) { global $db; $sqldate=""; if ($month_date > 0) { From dacc959937f44f1c8adecf7bd58b0acd68e286a6 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 1 Dec 2018 15:18:51 +0100 Subject: [PATCH 46/88] fix https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/core/class/comment.class.php?selectedAuthors%5B0%5D=florian.henry%40atm-consulting.fr&orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/core/class/comment.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index b731eb77169..332f7e115ef 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -357,7 +357,7 @@ class Comment extends CommonObject } $db->free($resql); } else { - $error++; $this->errors[]="Error ".$this->db->lasterror(); + $this->errors[]="Error ".$this->db->lasterror(); return -1; } } From faf7ea345fbc3b37a9212b47725685b87a80813e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 1 Dec 2018 15:23:46 +0100 Subject: [PATCH 47/88] fix https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/core/class/commonobject.class.php?selectedAuthors%5B0%5D=florian.henry%40atm-consulting.fr&orderField=path&order=asc&honorSelectedPaths=0 --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 307923e9bef..a274047f54f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6114,13 +6114,13 @@ abstract class CommonObject { $value_arr=explode(',',$value); $value=''; - if (is_array($value_arr)) + if (is_array($value_arr) && count($value_arr)>0) { foreach ($value_arr as $keyval=>$valueval) { $toprint[]='
  • '.$param['options'][$valueval].'
  • '; } + $value='
      '.implode(' ', $toprint).'
    '; } - $value='
      '.implode(' ', $toprint).'
    '; } elseif ($type == 'chkbxlst') { From b9046b91745498a9e9575b92c2ad1f2a76f11ed4 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 1 Dec 2018 15:42:07 +0100 Subject: [PATCH 48/88] fix https://scrutinizer-ci.com/g/Dolibarr/dolibarr/issues/develop/files/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php?selectedAuthors%5B0%5D=florian.henry%40atm-consulting.fr&orderField=path&order=asc&honorSelectedPaths=0 --- .../doc/doc_generic_project_odt.modules.php | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 76aa73e960e..6292008c54d 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -164,27 +164,27 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - function get_substitutionarray_tasks($task,$outputlangs) + function get_substitutionarray_tasks(Task $task,$outputlangs) { // phpcs:enable global $conf; $resarray = array( - 'task_ref'=>$task->ref, - 'task_fk_project'=>$task->fk_project, - 'task_projectref'=>$task->projectref, - 'task_projectlabel'=>$task->projectlabel, - 'task_label'=>$task->label, - 'task_description'=>$task->description, - 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>$task->duration, - 'task_duration_hour'=>convertSecondToTime($task->duration,'all'), - 'task_progress'=>$task->progress, - 'task_public'=>$task->public, - 'task_date_start'=>dol_print_date($task->date_start,'day'), - 'task_date_end'=>dol_print_date($task->date_end,'day'), - 'task_note_private'=>$task->note_private, - 'task_note_public'=>$task->note_public + 'task_ref'=>$task->ref, + 'task_fk_project'=>$task->fk_project, + 'task_projectref'=>$task->projectref, + 'task_projectlabel'=>$task->projectlabel, + 'task_label'=>$task->label, + 'task_description'=>$task->description, + 'task_fk_parent'=>$task->fk_parent, + 'task_duration'=>$task->duration, + 'task_duration_hour'=>convertSecondToTime($task->duration,'all'), + 'task_progress'=>$task->progress, + 'task_public'=>$task->public, + 'task_date_start'=>dol_print_date($task->date_start,'day'), + 'task_date_end'=>dol_print_date($task->date_end,'day'), + 'task_note_private'=>$task->note_private, + 'task_note_public'=>$task->note_public ); require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -750,6 +750,7 @@ class doc_generic_project_odt extends ModelePDFProjects $num = $this->db->num_rows($resql); $i = 0; $tasks = array(); + $row=array(); $listlinestasktime = $listlines->__get('taskstimes'); if (empty($num)) { $row['rowid']=''; @@ -1064,7 +1065,7 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListSocialContributionAssociatedProject", 'class' => 'ChargeSociales', 'table' => 'chargesociales', - 'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $id, + 'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $object->id, 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire ), 'stock_mouvement' => array( From 21b55f3a8358bcc81f69a5c2a4a7ecaeb141a16e Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 23:30:58 +0100 Subject: [PATCH 49/88] refactoring dol_sql_datefilter --- htdocs/comm/propal/list.php | 53 ++++++++++--------------------------- 1 file changed, 14 insertions(+), 39 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 98ff1c45194..f9fbba16eae 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -329,45 +329,20 @@ if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -if ($search_month > 0) -{ - if ($search_year > 0 && empty($search_day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; - else - $sql.= " AND date_format(p.datep, '%m') = '".$db->escape($search_month)."'"; -} -else if ($search_year > 0) -{ - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; -} -if ($search_month_end > 0) -{ - if ($search_yearfin > 0 && empty($search_dayfin)) - $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_month_end,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_month_end,false))."'"; - else if ($search_yearfin > 0 && ! empty($search_dayfin)) - $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_end, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_end, $search_dayfin, $search_yearfin))."'"; - else - $sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_month_end)."'"; -} -else if ($search_yearfin > 0) -{ - $sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,1,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,12,false))."'"; -} -if ($search_monthdelivery > 0) -{ - if ($search_yeardelivery > 0 && empty($search_daydelivery)) - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,$search_monthdelivery,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,$search_monthdelivery,false))."'"; - else if ($search_yeardelivery > 0 && ! empty($search_daydelivery)) - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."'"; - else - $sql.= " AND date_format(p.date_livraison, '%m') = '".$db->escape($search_monthdelivery)."'"; -} -else if ($search_yeardelivery > 0) -{ - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,1,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,12,false))."'"; -} + +$sql.= dol_sql_datefilter( + "p.datep", + $search_day, $search_month, $search_year +); +$sql.= dol_sql_datefilter( + "p.fin_validite", + $search_dayfin, $search_month_end, $search_yearfin +); +$sql.= dol_sql_datefilter( + "p.date_livraison", + $search_daydelivery, $search_monthdelivery, $search_yeardelivery +); + if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) { From 0d35f04cb7289f79f8190db63bd347f99909b324 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 23:36:26 +0100 Subject: [PATCH 50/88] Update list.php --- htdocs/commande/list.php | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f26d7b86b44..51581c612a1 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -10,6 +10,8 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Charlene Benke + * * 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 @@ -301,32 +303,17 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } -if ($search_ordermonth > 0) -{ - if ($search_orderyear > 0 && empty($search_orderday)) - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'"; - else if ($search_orderyear > 0 && ! empty($search_orderday)) - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'"; - else - $sql.= " AND date_format(c.date_commande, '%m') = '".$search_ordermonth."'"; -} -else if ($search_orderyear > 0) -{ - $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'"; -} -if ($search_deliverymonth > 0) -{ - if ($search_deliveryyear > 0 && empty($search_deliveryday)) - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'"; - else if ($search_deliveryyear > 0 && ! empty($search_deliveryday)) - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'"; - else - $sql.= " AND date_format(c.date_livraison, '%m') = '".$search_deliverymonth."'"; -} -else if ($search_deliveryyear > 0) -{ - $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'"; -} + +$sql.= dol_sql_datefilter( + "c.date_commande", + $search_orderday, $search_ordermonth, $search_orderyear +); + +$sql.= dol_sql_datefilter( + "c.date_livraison", + $search_deliveryday, $search_deliverymonth, $search_deliveryyear +); + if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); From f07d1411aa984ec1767f5f2d37ad23a6aad83106 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 23:41:15 +0100 Subject: [PATCH 51/88] Update list.php --- htdocs/compta/deplacement/list.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 3dfbac0e726..b04fd1388b6 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 charlene Benke * * 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 @@ -55,6 +56,7 @@ if (! $sortfield) $sortfield="d.dated"; $year=GETPOST("year"); $month=GETPOST("month"); +$day=GETPOST("day"); if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers { @@ -64,6 +66,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','a // $search_amount=""; $year=""; $month=""; + $day=""; } /* @@ -103,19 +106,10 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); } // if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'"; -if ($month > 0) -{ - if ($year > 0 && empty($day)) - $sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) - $sql.= " AND d.dated BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; - else - $sql.= " AND date_format(d.dated, '%m') = '".$month."'"; -} -else if ($year > 0) -{ - $sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; -} + +$sql.= dol_sql_datefilter( + "d.dated", $day, $month, $year +); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); From b104c0889dfd8dfbc99acebf0d4a84ccfd71b2ab Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 23:44:24 +0100 Subject: [PATCH 52/88] Update list.php --- htdocs/compta/facture/list.php | 39 +++++++++++----------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6b0164058c2..161d23f8ac7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador + * Copyright (C) 2018 Charlene Benke * * 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 @@ -88,7 +89,7 @@ $search_country=GETPOST("search_country",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_user = GETPOST('search_user','int'); $search_sale = GETPOST('search_sale','int'); -$search_day = GETPOST('search_day','int'); +$search_day = GETPOST('search_day','int'); $search_month = GETPOST('search_month','int'); $search_year = GETPOST('search_year','int'); $search_day_lim = GETPOST('search_day_lim','int'); @@ -450,32 +451,16 @@ if ($search_status != '-1' && $search_status != '') } } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -if ($search_month > 0) -{ - if ($search_year > 0 && empty($search_day)) - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; - else - $sql.= " AND date_format(f.datef, '%m') = '".$search_month."'"; -} -else if ($search_year > 0) -{ - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; -} -if ($search_month_lim > 0) -{ - if ($search_year_lim > 0 && empty($search_day_lim)) - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,$search_month_lim,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,$search_month_lim,false))."'"; - else if ($search_year_lim > 0 && ! empty($search_day_lim)) - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_lim, $search_day_lim, $search_year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_lim, $search_day_lim, $search_year_lim))."'"; - else - $sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($search_month_lim)."'"; -} -else if ($search_year_lim > 0) -{ - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,12,false))."'"; -} + +$sql.= dol_sql_datefilter( + "f.datef", + $search_day, $search_month, $search_year +); +$sql.= dol_sql_datefilter( + "f.date_lim_reglement", + $search_day_lim, $search_month_lim, $search_year_lim +); + if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) From 6ac3cfdd9928d7c0bf68830251639175983fbb6e Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sat, 1 Dec 2018 23:48:36 +0100 Subject: [PATCH 53/88] Update list.php --- htdocs/compta/paiement/list.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 4536cb98520..63e7adcc4c2 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Charlene Benke * * 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 @@ -163,19 +164,8 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - if ($month > 0) - { - if ($year > 0 && empty($day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; - else - $sql.= " AND date_format(p.datep, '%m') = '".$month."'"; - } - else if ($year > 0) - { - $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; - } + $sql.= dol_sql_datefilter("p.datep", $day, $month, $year); + if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; From 7378a2f1c635143e6831cd2cb8776600f4a13fde Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 2 Dec 2018 00:02:10 +0100 Subject: [PATCH 54/88] Update list.php --- htdocs/expensereport/list.php | 55 +++++++++++++++-------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b2b8e46d668..7b417f07c80 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -3,8 +3,9 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Charlene Benke * * 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 @@ -76,6 +77,8 @@ $search_amount_ttc = GETPOST('search_amount_ttc','alpha'); $search_status = (GETPOST('search_status','intcomma')!=''?GETPOST('search_status','intcomma'):GETPOST('statut','intcomma')); $month_start = GETPOST("month_start","int"); $year_start = GETPOST("year_start","int"); +$day_start = GETPOST("day_start","int"); +$day_end = GETPOST("day_end","int"); $month_end = GETPOST("month_end","int"); $year_end = GETPOST("year_end","int"); $optioncss = GETPOST('optioncss','alpha'); @@ -158,8 +161,10 @@ if (empty($reshook)) $search_status=""; $month_start=""; $year_start=""; + $day =""; $month_end=""; $year_end=""; + $day_end = ""; $toselect=''; $search_array_options=array(); } @@ -271,34 +276,17 @@ if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref if (!empty($search_ref)) $sql.= natural_search('d.ref', $search_ref); // Date Start -if ($month_start > 0) -{ - if ($year_start > 0 && empty($day)) - $sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,false))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,false))."'"; - else if ($year_start > 0 && ! empty($day)) - $sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_start, $day, $year_start))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_start, $day, $year_start))."'"; - else - $sql.= " AND date_format(d.date_debut, '%m') = '".$month_start."'"; -} -else if ($year_start > 0) -{ - $sql.= " AND d.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,1,false))."' AND '".$db->idate(dol_get_last_day($year_start,12,false))."'"; -} -// Date Start -if ($month_end > 0) -{ - if ($year_end > 0 && empty($day)) - $sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,false))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,false))."'"; - else if ($year_end > 0 && ! empty($day)) - $sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_end, $day, $year_end))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_end, $day, $year_end))."'"; - else - $sql.= " AND date_format(d.date_fin, '%m') = '".$month_end."'"; -} -else if ($year_end > 0) -{ - $sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,false))."' AND '".$db->idate(dol_get_last_day($year_end,12,false))."'"; -} -// Amount +$sql.= dol_sql_datefilter( + "d.date_debut", + $day_start, $month_start, $year_start +); + +// Date End +$sql.= dol_sql_datefilter( + "d.date_fin", + $day_end, $month_end, $year_end +); + if ($search_amount_ht != '') $sql.= natural_search('d.total_ht', $search_amount_ht, 1); if ($search_amount_ttc != '') $sql.= natural_search('d.total_ttc', $search_amount_ttc, 1); // User @@ -538,6 +526,9 @@ if ($resql) if (! empty($arrayfields['d.date_debut']['checked'])) { print '
    '; @@ -546,7 +537,9 @@ if ($resql) if (! empty($arrayfields['d.date_fin']['checked'])) { print ''; } From 6ea0919ebb2868c68bc31a0bd6077389fffda39f Mon Sep 17 00:00:00 2001 From: Chl Date: Fri, 17 Aug 2018 20:47:01 +0200 Subject: [PATCH 55/88] facture-rec.class.php: reindent --- .../facture/class/facture-rec.class.php | 93 ++++++++++--------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 56f87d2eac3..bf4360a57f3 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1025,30 +1025,33 @@ class FactureRec extends CommonInvoice $sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; $sql.= ' AND suspended = 0'; $sql.= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here - if ($restictoninvoiceid > 0) $sql.=' AND rowid = '.$restictoninvoiceid; + if ($restictoninvoiceid > 0) + $sql.=' AND rowid = '.$restictoninvoiceid; $sql.= $db->order('entity', 'ASC'); //print $sql;exit; $resql = $db->query($sql); if ($resql) { - $i=0; - $num = $db->num_rows($resql); + $i=0; + $num = $db->num_rows($resql); - if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; - else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); + if ($num) + $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; + else + $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); - $saventity = $conf->entity; + $saventity = $conf->entity; - while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass. + while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass. { $line = $db->fetch_object($resql); - $db->begin(); + $db->begin(); - $invoiceidgenerated = 0; + $invoiceidgenerated = 0; - $facturerec = new FactureRec($db); + $facturerec = new FactureRec($db); $facturerec->fetch($line->rowid); if ($facturerec->id > 0) @@ -1058,44 +1061,44 @@ class FactureRec extends CommonInvoice dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity); - $facture = new Facture($db); + $facture = new Facture($db); $facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice $facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice - $facture->type = self::TYPE_STANDARD; - $facture->brouillon = 1; - $facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. - $facture->socid = $facturerec->socid; + $facture->type = self::TYPE_STANDARD; + $facture->brouillon = 1; + $facture->date = (empty($facturerec->date_when)?$now:$facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. + $facture->socid = $facturerec->socid; - $invoiceidgenerated = $facture->create($user); - if ($invoiceidgenerated <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - if (! $error && ($facturerec->auto_validate || $forcevalidation)) - { - $result = $facture->validate($user); - if ($result <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - } - if (! $error && $facturerec->generate_pdf) - { - // We refresh the object in order to have all necessary data (like date_lim_reglement) - $facture->fetch($facture->id); - $result = $facture->generateDocument($facturerec->modelpdf, $langs); - if ($result <= 0) - { - $this->errors = $facture->errors; - $this->error = $facture->error; - $error++; - } - } + $invoiceidgenerated = $facture->create($user); + if ($invoiceidgenerated <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + if (! $error && ($facturerec->auto_validate || $forcevalidation)) + { + $result = $facture->validate($user); + if ($result <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + } + if (! $error && $facturerec->generate_pdf) + { + // We refresh the object in order to have all necessary data (like date_lim_reglement) + $facture->fetch($facture->id); + $result = $facture->generateDocument($facturerec->modelpdf, $langs); + if ($result <= 0) + { + $this->errors = $facture->errors; + $this->error = $facture->error; + $error++; + } + } } else { @@ -1114,7 +1117,7 @@ class FactureRec extends CommonInvoice } else { - $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); + $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } $i++; From 95b5d8790d27e856934f630873267d29f8b18489 Mon Sep 17 00:00:00 2001 From: Chl Date: Fri, 17 Aug 2018 19:56:29 +0200 Subject: [PATCH 56/88] corr. typo --- htdocs/compta/facture/class/facture-rec.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index bf4360a57f3..f35d8f88835 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -998,11 +998,11 @@ class FactureRec extends CommonInvoice * * WARNING: This method change temporarly context $conf->entity to be in correct context for each recurring invoice found. * - * @param int $restictoninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID + * @param int $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID * @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag. * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) */ - function createRecurringInvoices($restictoninvoiceid=0, $forcevalidation=0) + function createRecurringInvoices($restrictioninvoiceid=0, $forcevalidation=0) { global $conf, $langs, $db, $user; @@ -1017,7 +1017,7 @@ class FactureRec extends CommonInvoice $tmparray=dol_getdate($now); $today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day - dol_syslog("createRecurringInvoices restictoninvoiceid=".$restictoninvoiceid." forcevalidation=".$forcevalidation); + dol_syslog("createRecurringInvoices restrictioninvoiceid=".$restrictioninvoiceid." forcevalidation=".$forcevalidation); $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec'; $sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency @@ -1025,8 +1025,8 @@ class FactureRec extends CommonInvoice $sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; $sql.= ' AND suspended = 0'; $sql.= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here - if ($restictoninvoiceid > 0) - $sql.=' AND rowid = '.$restictoninvoiceid; + if ($restrictioninvoiceid > 0) + $sql.=' AND rowid = '.$restrictioninvoiceid; $sql.= $db->order('entity', 'ASC'); //print $sql;exit; From 864ce8534120747acc62c5d5d1ada43460056a1b Mon Sep 17 00:00:00 2001 From: Chl Date: Fri, 17 Aug 2018 20:39:46 +0200 Subject: [PATCH 57/88] NEW adding hooks to createRecurringInvoices() For example : send the newly generated invoice by mail. We send the counter and the total so launching some action on the last loop (generated invoice or error) is possible. (bonus: correcting error reporting $this->errors to $this->errors[] ) --- .../facture/class/facture-rec.class.php | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f35d8f88835..6cff7e5ef57 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); /** @@ -1004,14 +1005,16 @@ class FactureRec extends CommonInvoice */ function createRecurringInvoices($restrictioninvoiceid=0, $forcevalidation=0) { - global $conf, $langs, $db, $user; + global $conf, $langs, $db, $user, $hookmanager; + $error=0; + $nb_create=0; // Load translation files required by the page - $langs->loadLangs(array("main","bills")); + $langs->loadLangs(array("main","bills")); - $nb_create=0; + $hookmanager->initHooks(array('createrecurringinvoices')); $now = dol_now(); $tmparray=dol_getdate($now); @@ -1029,6 +1032,12 @@ class FactureRec extends CommonInvoice $sql.=' AND rowid = '.$restrictioninvoiceid; $sql.= $db->order('entity', 'ASC'); //print $sql;exit; + $parameters = array( + 'entity' => $conf->entity, + 'restrictioninvoiceid' => $restrictioninvoiceid, + 'forcevalidation' => $forcevalidation, + ); + $reshook = $hookmanager->executeHooks('writeSQL', $parameters, $sql); // note that $sql might be modified by hooks $resql = $db->query($sql); if ($resql) @@ -1051,6 +1060,7 @@ class FactureRec extends CommonInvoice $invoiceidgenerated = 0; + $facture = null; $facturerec = new FactureRec($db); $facturerec->fetch($line->rowid); @@ -1073,7 +1083,7 @@ class FactureRec extends CommonInvoice $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { - $this->errors = $facture->errors; + $this->errors[] = $facture->errors; $this->error = $facture->error; $error++; } @@ -1082,7 +1092,7 @@ class FactureRec extends CommonInvoice $result = $facture->validate($user); if ($result <= 0) { - $this->errors = $facture->errors; + $this->errors[] = $facture->errors; $this->error = $facture->error; $error++; } @@ -1094,7 +1104,7 @@ class FactureRec extends CommonInvoice $result = $facture->generateDocument($facturerec->modelpdf, $langs); if ($result <= 0) { - $this->errors = $facture->errors; + $this->errors[] = $facture->errors; $this->error = $facture->error; $error++; } @@ -1120,6 +1130,16 @@ class FactureRec extends CommonInvoice $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } + $parameters = array( + 'cpt' => $i, + 'total' => $num, + 'errorCount' => $error, + 'invoiceidgenerated' => $invoiceidgenerated, + 'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks. + 'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks. + ); + $reshook = $hookmanager->executeHooks('generatedInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null) + $i++; } From 1bc0defb31b80852cdbd5a76da60e96cc9f708ff Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 2 Dec 2018 09:55:26 +0100 Subject: [PATCH 58/88] Update list.php --- htdocs/fourn/commande/list.php | 44 ++++++++++------------------------ 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 729899a8ff2..d2e84dd234d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -6,7 +6,8 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Charlene Benke * * 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 @@ -522,39 +523,20 @@ if ($search_product_category > 0) $sql.= " AND cp.fk_categorie = ".$search_produ //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'intcomma') !== '') -{ $sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")"; -} + if ($search_status != '' && $search_status >= 0) -{ $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; -} -if ($search_ordermonth > 0) -{ - if ($search_orderyear > 0 && empty($search_orderday)) - $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'"; - else if ($search_orderyear > 0 && ! empty($search_orderday)) - $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'"; - else - $sql.= " AND date_format(cf.date_commande, '%m') = '".$db->escape($search_ordermonth)."'"; -} -else if ($search_orderyear > 0) -{ - $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'"; -} -if ($search_deliverymonth > 0) -{ - if ($search_deliveryyear > 0 && empty($search_deliveryday)) - $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'"; - else if ($search_deliveryyear > 0 && ! empty($search_deliveryday)) - $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_eliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'"; - else - $sql.= " AND date_format(cf.date_livraison, '%m') = '".$db->escape($search_deliverymonth)."'"; -} -else if ($search_deliveryyear > 0) -{ - $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'"; -} + +$sql.= dol_sql_datefilter( + "cf.date_commande", + $search_orderday, $search_ordermonth, $search_orderyear +); +$sql.= dol_sql_datefilter( + "cf.date_livraison", + $search_deliveryday, $search_deliverymonth, $search_deliveryyear +); + if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); From ad1ca07085d635af0dda51188069060897e66c9d Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 2 Dec 2018 09:58:18 +0100 Subject: [PATCH 59/88] Update list.php --- htdocs/fourn/facture/list.php | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 9a53b31c8a1..ddea73ce419 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -10,7 +10,8 @@ * Copyright (C) 2015 Abbes Bahfir * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2018 Frédéric France * * 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 @@ -329,32 +330,10 @@ if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $searc if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; -if ($month > 0) -{ - if ($year > 0 && empty($day)) - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; - else - $sql.= " AND date_format(f.datef, '%m') = '".$month."'"; -} -else if ($year > 0) -{ - $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; -} -if ($month_lim > 0) -{ - if ($year_lim > 0 && empty($day_lim)) - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'"; - else if ($year_lim > 0 && ! empty($day_lim)) - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'"; - else - $sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($month_lim)."'"; -} -else if ($year_lim > 0) -{ - $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'"; -} + +$sql.= dol_sql_datefilter( "f.datef", $day, $month, $year); +$sql.= dol_sql_datefilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); + if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; if ($search_label) $sql .= natural_search('f.libelle', $search_label); if ($search_status != '' && $search_status >= 0) From 65dc066352c4182be08b9808687bbd3299e04138 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 2 Dec 2018 10:01:38 +0100 Subject: [PATCH 60/88] Update list.php --- htdocs/holiday/list.php | 54 +++++++++++------------------------------ 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index a2bdcb2a5b3..c88dd1f4776 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -1,7 +1,8 @@ * Copyright (C) 2013-2018 Laurent Destailleur - * Copyright (C) 2012-2016 Regis Houssin + * Copyright (C) 2012-2016 Regis Houssin + * Copyright (C) 2018 Charlene Benke * * 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 @@ -190,49 +191,22 @@ if(!empty($search_ref)) } // Start date -if($search_year_start > 0) { - if($search_month_start > 0) { - $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,$search_month_start,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,$search_month_start,1))."')"; - //$filter.= " AND date_format(cp.date_debut, '%Y-%m') = '$search_year_start-$search_month_start'"; - } else { - $filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($search_year_start,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_start,12,1))."')"; - //$filter.= " AND date_format(cp.date_debut, '%Y') = '$search_year_start'"; - } -} else { - if($search_month_start > 0) { - $filter.= " AND date_format(cp.date_debut, '%m') = '".$db->escape($search_month_start)."'"; - } -} +$sql.= dol_sql_datefilter( + "cp.date_debut", + $search_day_start, $search_month_start, $search_year_start +); // End date -if($search_year_end > 0) { - if($search_month_end > 0) { - $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,$search_month_end,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,$search_month_end,1))."')"; - //$filter.= " AND date_format(cp.date_fin, '%Y-%m') = '$search_year_end-$search_month_end'"; - } else { - $filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($search_year_end,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_end,12,1))."')"; - //$filter.= " AND date_format(cp.date_fin, '%Y') = '$search_year_end'"; - } -} else { - if($search_month_end > 0) { - $filter.= " AND date_format(cp.date_fin, '%m') = '".$db->escape($search_month_end)."'"; - } -} +$sql.= dol_sql_datefilter( + "cp.date_fin", + $search_day_end, $search_month_end, $search_year_end +); // Create date -if($search_year_create > 0) { - if($search_month_create > 0) { - $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,$search_month_create,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,$search_month_create,1))."')"; - //$filter.= " AND date_format(cp.date_create, '%Y-%m') = '$search_year_create-$search_month_create'"; - } else { - $filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($search_year_create,1,1))."' AND '".$db->idate(dol_get_last_day($search_year_create,12,1))."')"; - //$filter.= " AND date_format(cp.date_create, '%Y') = '$search_year_create'"; - } -} else { - if($search_month_create > 0) { - $filter.= " AND date_format(cp.date_create, '%m') = '".$db->escape($search_month_create)."'"; - } -} +$sql.= dol_sql_datefilter( + "cp.date_create", + $search_day_create, $search_month_create, $search_year_create +); // Employee if(!empty($search_employee) && $search_employee != -1) { From 172c1ac49fe369597113eab1e5329d25428f1fc7 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Sun, 2 Dec 2018 10:14:40 +0100 Subject: [PATCH 61/88] Update list.php --- htdocs/supplier_proposal/list.php | 35 ++++++++----------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 795564984d4..308fcf8adde 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Charlene Benke * * 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 @@ -77,8 +78,10 @@ $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alp $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $year=GETPOST("year"); $month=GETPOST("month"); +$day=GETPOST("day"); $yearvalid=GETPOST("yearvalid"); $monthvalid=GETPOST("monthvalid"); +$dayvalid=GETPOST("dayvalid"); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -196,8 +199,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_author=''; $yearvalid=''; $monthvalid=''; + $dayvalid=''; $year=''; $month=''; + $day=''; $search_status=''; $object_statut=''; } @@ -284,32 +289,10 @@ if ($search_montant_ttc != '') $sql.= natural_search("sp.total", $search_montant if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$db->escape($search_status).')'; -if ($month > 0) -{ - if ($year > 0 && empty($day)) - $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) - $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; - else - $sql.= " AND date_format(sp.date_livraison, '%m') = '".$month."'"; -} -else if ($year > 0) -{ - $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; -} -if ($monthvalid > 0) -{ - if ($yearvalid > 0 && empty($dayvalid)) - $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; - else if ($yearvalid > 0 && ! empty($dayvalid)) - $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; - else - $sql.= " AND date_format(sp.date_valid, '%m') = '".$monthvalid."'"; -} -else if ($yearvalid > 0) -{ - $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; -} + +$sql.= dol_sql_datefilter("sp.date_livraison", $day, $month, $year); +$sql.= dol_sql_datefilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); + if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { From be523a737e0a95ae00ccba86d480a77332ffe0d8 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 2 Dec 2018 10:19:37 +0000 Subject: [PATCH 62/88] Undo Access Key Strings from previous commit --- htdocs/langs/en_US/main.lang | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index cb0c607e156..a9bba0d4043 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -947,8 +947,6 @@ Annual=Annual Local=Local Remote=Remote LocalAndRemote=Local and Remote -AccessKey=Access Key -KeyboardShortcutsNavigation=Keyboard Shortcuts for Navigation: AssignedTo=Assigned to Deletedraft=Delete draft ConfirmMassDraftDeletion=Draft mass delete confirmation From 34326f9102ec5cba58e517ba8f6d1c8b4f0e7ac7 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 2 Dec 2018 10:22:47 +0000 Subject: [PATCH 63/88] Undo Add Access Keys in Help Link ... from previous commit Not relevant anymore as the new code will detect browser and show the relevant string --- htdocs/main.inc.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 99b82156e42..06f67a9b79f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1576,11 +1576,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage))); else $text.=sprintf($helpbaseurl,$helppage); $text.='">'; - $title.='

    '; - $title.=''.$langs->trans("KeyboardShortcutsNavigation").'
    '; - $title.='Firefox (Windows/Linux): ALT + SHIFT + Access Key
    '; - $title.='Chrome (Windows/Linux): ALT + Access Key
    '; - $title.='MAC (all browsers): CTRL + Access Key
    '; //$text.=img_picto('', 'helpdoc_top').' '; $text.=''; //$toprightmenu.=$langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help'); From 30e84f8f2c880025eb7c981fa8fe96050d1ed583 Mon Sep 17 00:00:00 2001 From: IJ Date: Sun, 2 Dec 2018 10:29:04 +0000 Subject: [PATCH 64/88] Amend Add Access Keys in Navigation Tooltips - based on suggested code by @eldy - Added `classfortooltip` for better display --- htdocs/core/class/html.form.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 082e0be1a34..cc91e2072c4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6683,8 +6683,18 @@ class Form // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox // accesskey is for Mac: CTRL + key for all browsers - $previous_ref = $object->ref_previous?'':''; - $next_ref = $object->ref_next?'':''; + $stringforfirstkey = 'CTL +'; + if ($conf->browser->name == 'chrome') + { + $stringforfirstkey = 'ALT +'; + } + if ($conf->browser->name == 'firefox') + { + $stringforfirstkey = 'ALT + SHIFT +'; + } + + $previous_ref = $object->ref_previous?'':''; + $next_ref = $object->ref_next?'':''; } //print "xx".$previous_ref."x".$next_ref; From b67101c77cf00f6164baff4b2cd15b8c97cd7b26 Mon Sep 17 00:00:00 2001 From: Chl Date: Mon, 3 Dec 2018 17:03:28 +0100 Subject: [PATCH 65/88] corr. #10154 --- htdocs/compta/facture/class/facture-rec.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 6cff7e5ef57..fed1ca8c79c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); /** @@ -1033,7 +1032,6 @@ class FactureRec extends CommonInvoice $sql.= $db->order('entity', 'ASC'); //print $sql;exit; $parameters = array( - 'entity' => $conf->entity, 'restrictioninvoiceid' => $restrictioninvoiceid, 'forcevalidation' => $forcevalidation, ); @@ -1083,7 +1081,7 @@ class FactureRec extends CommonInvoice $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { - $this->errors[] = $facture->errors; + $this->errors = $facture->errors; $this->error = $facture->error; $error++; } @@ -1092,7 +1090,7 @@ class FactureRec extends CommonInvoice $result = $facture->validate($user); if ($result <= 0) { - $this->errors[] = $facture->errors; + $this->errors = $facture->errors; $this->error = $facture->error; $error++; } @@ -1104,7 +1102,7 @@ class FactureRec extends CommonInvoice $result = $facture->generateDocument($facturerec->modelpdf, $langs); if ($result <= 0) { - $this->errors[] = $facture->errors; + $this->errors = $facture->errors; $this->error = $facture->error; $error++; } From d1d41f4dd47ba2df59aaa4f4a674418e1dee2395 Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 4 Dec 2018 23:16:41 +0100 Subject: [PATCH 66/88] New add payments table to pdf expense report --- .../doc/pdf_standard.modules.php | 148 ++++++++++++++++-- .../class/expensereport.class.php | 30 ++++ 2 files changed, 164 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 7f3cca693b5..7454e06de6e 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2018 Philippe Grand * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Francis Appels * * 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 @@ -213,7 +214,7 @@ class pdf_standard extends ModeleExpenseReport if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; // Load traductions files requiredby by page - $outputlangs->loadLangs(array("main", "trips", "projects", "dict")); + $outputlangs->loadLangs(array("main", "trips", "projects", "dict", "bills", "banks")); $nblignes = count($object->lines); @@ -462,30 +463,37 @@ class pdf_standard extends ModeleExpenseReport // Show total area box $posy=$bottomlasttab+5; - $pdf->SetXY(100, $posy); - $pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalHT"), 1, 'L'); - $pdf->SetXY(160, $posy); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R'); + $posy_start_of_totals = $posy; + $pdf->SetXY(130, $posy); + $pdf->MultiCell(70, 5, $outputlangs->transnoentities("TotalHT"), 1, 'L'); + $pdf->SetXY(180, $posy); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 180, 5, price($object->total_ht), 1, 'R'); $pdf->SetFillColor(248,248,248); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { // TODO Show vat amout per tax level $posy+=5; - $pdf->SetXY(100, $posy); + $pdf->SetXY(130, $posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L'); - $pdf->SetXY(160, $posy); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R'); + $pdf->MultiCell(70, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L'); + $pdf->SetXY(180, $posy); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 180, 5, price($object->total_tva),1, 'R'); } $posy+=5; - $pdf->SetXY(100, $posy); + $pdf->SetXY(130, $posy); $pdf->SetFont('','B', 10); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalTTC"), 1,'L'); - $pdf->SetXY(160, $posy); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ttc),1, 'R'); + $pdf->MultiCell(70, 5, $outputlangs->transnoentities("TotalTTC"), 1,'L'); + $pdf->SetXY(180, $posy); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - 180, 5, price($object->total_ttc),1, 'R'); + + // show payments zone + $sumPayments = $object->getSumPayments(); + if ($sumPayments > 0 && empty($conf->global->PDF_EXPENSEREPORT_NO_PAYMENT_DETAILS)) { + $posy=$this->tablePayments($pdf, $object, $posy_start_of_totals, $outputlangs); + } // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); @@ -531,7 +539,7 @@ class pdf_standard extends ModeleExpenseReport * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @return void */ - private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails=0) + private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails=0) { global $conf; $pdf->SetFont('','', $default_font_size - 1); @@ -926,6 +934,118 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetTextColor(0,0,0); } + /** + * Show payments table + * + * @param PDF $pdf Object PDF + * @param Object $object Object invoice + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @return int <0 if KO, >0 if OK + */ + private function tablePayments(&$pdf, $object, $posy, $outputlangs) + { + global $conf; + + $sign=1; + $tab3_posx = $this->marge_gauche; + $tab3_top = $posy; + $tab3_width = 88; + $tab3_height = 5; + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $title=$outputlangs->transnoentities("PaymentsAlreadyDone"); + $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetXY($tab3_posx, $tab3_top - 4); + $pdf->SetTextColor(0,0,0); + $pdf->MultiCell(60, 3, $title, 0, 'L', 0); + + $pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width+2, $tab3_top); // Top border line of table title + + $pdf->SetXY($tab3_posx, $tab3_top+1); + $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Date"), 0, 'L', 0); + $pdf->SetXY($tab3_posx+19, $tab3_top+1); // Old value 17 + $pdf->MultiCell(15, 3, $outputlangs->transnoentities("Amount"), 0, 'C', 0); + $pdf->SetXY($tab3_posx+35, $tab3_top+1); + $pdf->MultiCell(30, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); + if (! empty($conf->banque->enabled)) { + $pdf->SetXY($tab3_posx+65, $tab3_top+1); + $pdf->MultiCell(25, 3, $outputlangs->transnoentities("BankAccount"), 0, 'L', 0); + } + $pdf->line($tab3_posx, $tab3_top+$tab3_height, $tab3_posx+$tab3_width+2, $tab3_top+$tab3_height); // Bottom border line of table title + + $y=0; + + // Loop on each payment + // TODO create method on expensereport class to get payments + // Payments already done (from payment on this expensereport) + $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount, p.fk_bank,"; + $sql.= "c.code as p_code, c.libelle as payment_type,"; + $sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; + $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; + $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; + $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; + $sql.= " WHERE e.rowid = '".$object->id."'"; + $sql.= " AND p.fk_expensereport = e.rowid"; + $sql.= ' AND e.entity IN ('.getEntity('expensereport').')'; + $sql.= " ORDER BY dp"; + + $resql=$this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i=0; + while ($i < $num) { + $y+=$tab3_height; + $row = $this->db->fetch_object($resql); + + $pdf->SetXY($tab3_posx, $tab3_top+$y+1); + $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->dp),'day',false,$outputlangs,true), 0, 'L', 0); + $pdf->SetXY($tab3_posx+17, $tab3_top+$y+1); + $pdf->MultiCell(15, 3, price($sign * $row->amount, 0, $outputlangs), 0, 'R', 0); + $pdf->SetXY($tab3_posx+35, $tab3_top+$y+1); + $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->p_code); + + $pdf->MultiCell(40, 3, $oper, 0, 'L', 0); + if (! empty($conf->banque->enabled)) { + $pdf->SetXY($tab3_posx+65, $tab3_top+$y+1); + $pdf->MultiCell(30, 3, $row->baref, 0, 'L', 0); + } + + $pdf->line($tab3_posx, $tab3_top+$y+$tab3_height, $tab3_posx+$tab3_width+2, $tab3_top+$y+$tab3_height); // Bottom line border of table + $totalpaid += $row->amount; + $i++; + } + if ($num > 0 && $object->paid == 0) + { + $y+=$tab3_height; + + $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $pdf->MultiCell(15, 3, price($totalpaid), 0, 'R', 0); + $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->MultiCell(30, 4, $outputlangs->trans("AlreadyPaid"), 0, 'L', 0); + $y+=$tab3_height-2; + $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $pdf->MultiCell(15, 3, price($object->total_ttc), 0, 'R', 0); + $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->MultiCell(30, 4, $outputlangs->trans("AmountExpected"), 0, 'L', 0); + $y+=$tab3_height-2; + $remaintopay = $object->total_ttc - $totalpaid; + $pdf->SetXY($tab3_posx+17, $tab3_top+$y); + $pdf->MultiCell(15, 3, price($remaintopay), 0, 'R', 0); + $pdf->SetXY($tab3_posx+35, $tab3_top+$y); + $pdf->MultiCell(30, 4, $outputlangs->trans("RemainderToPay"), 0, 'L', 0); + } + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + /** * Show footer of page. Need this->emetteur object * diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index dc2516822e7..4c8a7ea33ec 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2402,6 +2402,36 @@ class ExpenseReport extends CommonObject } return 0; } + + /** + * Return amount of payments already done + * + * @return int Amount of payment already done, <0 if KO + */ + public function getSumPayments() + { + //TODO move to expensereport class + $table='payment_expensereport'; + $field='fk_expensereport'; + + $sql = 'SELECT sum(amount) as amount'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$table; + $sql.= ' WHERE '.$field.' = '.$this->id; + + dol_syslog(get_class($this)."::getSumPayments", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $obj = $this->db->fetch_object($resql); + $this->db->free($resql); + return $obj->amount; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } } From 6d27a6458edb17dfa80987dfec819aea025901a7 Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 5 Dec 2018 11:10:42 +0100 Subject: [PATCH 67/88] Fix travis --- .../core/modules/expensereport/doc/pdf_standard.modules.php | 4 ++-- htdocs/expensereport/class/expensereport.class.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 7454e06de6e..422f1139754 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -970,8 +970,8 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($tab3_posx+35, $tab3_top+1); $pdf->MultiCell(30, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); if (! empty($conf->banque->enabled)) { - $pdf->SetXY($tab3_posx+65, $tab3_top+1); - $pdf->MultiCell(25, 3, $outputlangs->transnoentities("BankAccount"), 0, 'L', 0); + $pdf->SetXY($tab3_posx+65, $tab3_top+1); + $pdf->MultiCell(25, 3, $outputlangs->transnoentities("BankAccount"), 0, 'L', 0); } $pdf->line($tab3_posx, $tab3_top+$tab3_height, $tab3_posx+$tab3_width+2, $tab3_top+$tab3_height); // Bottom border line of table title diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 4c8a7ea33ec..7f67420f97f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2405,12 +2405,11 @@ class ExpenseReport extends CommonObject /** * Return amount of payments already done - * + * * @return int Amount of payment already done, <0 if KO */ public function getSumPayments() { - //TODO move to expensereport class $table='payment_expensereport'; $field='fk_expensereport'; From 292dd5290a3ab9b0618c59ea70861bb3a8a66646 Mon Sep 17 00:00:00 2001 From: aljawaid Date: Fri, 7 Dec 2018 12:39:20 +0000 Subject: [PATCH 68/88] Amend Add Access Keys in Navigation Tooltips - Fix travis --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cc91e2072c4..b40120a2ca0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6684,11 +6684,11 @@ class Form // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox // accesskey is for Mac: CTRL + key for all browsers $stringforfirstkey = 'CTL +'; - if ($conf->browser->name == 'chrome') + if ($conf->browser->name == 'chrome') { $stringforfirstkey = 'ALT +'; } - if ($conf->browser->name == 'firefox') + if ($conf->browser->name == 'firefox') { $stringforfirstkey = 'ALT + SHIFT +'; } From d5bf9691eef1d77663ef8cc650070f5353152e73 Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 14 Dec 2018 15:10:32 +0100 Subject: [PATCH 69/88] allow product ajax search on description --- htdocs/core/class/html.form.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8ba38b81edb..38b9d060e7f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -19,6 +19,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Christophe Battarel * * 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 @@ -2131,6 +2132,11 @@ class Form if ($i > 0) $sql.=" AND "; $sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'"; + if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) + { + $sql.=" OR p.description LIKE '".$db->escape($prefix.$crit)."%'"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.description LIKE '".$db->escape($prefix.$crit)."%'"; + } if (! empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) $sql.=" OR pfp.ref_fourn LIKE '".$db->escape($prefix.$crit)."%'"; $sql.=")"; $i++; From 185524bd5089ac3f059bb5726c359c84c2e84cdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 15:49:58 +0100 Subject: [PATCH 70/88] Update fiscalyear.php --- htdocs/accountancy/admin/fiscalyear.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 16e45d0646b..6a60a031a59 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -117,7 +117,7 @@ if ($result) } else { - $addbutton = '' . $langs->trans("NewFiscalYear") . ''; + $addbutton = '' . $langs->trans("NewFiscalYear") . ''; } $title = $langs->trans('AccountingPeriods'); From c377350c357615b381ef29b677e4f2c58e623a32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 16:09:12 +0100 Subject: [PATCH 71/88] Update facture-rec.class.php --- htdocs/compta/facture/class/facture-rec.class.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index fed1ca8c79c..23d30f0ad32 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1006,15 +1006,12 @@ class FactureRec extends CommonInvoice { global $conf, $langs, $db, $user, $hookmanager; - $error=0; $nb_create=0; // Load translation files required by the page $langs->loadLangs(array("main","bills")); - $hookmanager->initHooks(array('createrecurringinvoices')); - $now = dol_now(); $tmparray=dol_getdate($now); $today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day @@ -1035,7 +1032,7 @@ class FactureRec extends CommonInvoice 'restrictioninvoiceid' => $restrictioninvoiceid, 'forcevalidation' => $forcevalidation, ); - $reshook = $hookmanager->executeHooks('writeSQL', $parameters, $sql); // note that $sql might be modified by hooks + $reshook = $hookmanager->executeHooks('beforeCreationOfRecurringInvoices', $parameters, $sql); // note that $sql might be modified by hooks $resql = $db->query($sql); if ($resql) @@ -1136,7 +1133,7 @@ class FactureRec extends CommonInvoice 'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks. 'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks. ); - $reshook = $hookmanager->executeHooks('generatedInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null) + $reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null) $i++; } From 5a9d034b1b7888f8fcc7f438707f2a9b6515095f Mon Sep 17 00:00:00 2001 From: PMickael Date: Fri, 14 Dec 2018 16:17:25 +0100 Subject: [PATCH 72/88] [Accounting][VAT] Fix balance should be based on period [Accounting][VAT] Fix balance should be based on period --- htdocs/compta/tva/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 4691b577368..517f15c81f3 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -562,12 +562,11 @@ if (! empty($conf->global->MAIN_FEATURES_LEVEL)) print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation - $sql1 = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y') as dm"; + $sql1 = "SELECT SUM(amount) as mm"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f"; $sql1 .= " WHERE f.entity = " . $conf->entity; $sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'"; $sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'"; - $sql1 .= " GROUP BY dm ORDER BY dm ASC"; $result = $db->query($sql1); if ($result) { From 98b8113a39c0bba12f231f568386dd05afdc802c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 16:20:23 +0100 Subject: [PATCH 73/88] Fix multicompany --- htdocs/webservices/server_invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 47c1b42e63b..4e8d3ec41d8 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -428,7 +428,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) $sql ='SELECT f.rowid as facid, ref as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva'; $sql.=' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.=" WHERE f.entity = ".$conf->entity; + $sql.=" WHERE f.entity IN (".getEntity('invoice').")"; if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty); $resql=$db->query($sql); From e0011222d1fef5fb51a9257e9643d272fab1e1fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 16:25:37 +0100 Subject: [PATCH 74/88] Fix syntax error --- htdocs/accountancy/admin/fiscalyear.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 6a60a031a59..443bbfa4961 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -117,7 +117,7 @@ if ($result) } else { - $addbutton = '' . $langs->trans("NewFiscalYear") . ''; + $addbutton = '' . $langs->trans("NewFiscalYear") . ''; } $title = $langs->trans('AccountingPeriods'); From 89909ebab0ae6f596b6126b23817809d37880486 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 17:32:41 +0100 Subject: [PATCH 75/88] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f7f2462b604..0de5934b0c5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1389,7 +1389,7 @@ class Form * Return HTML code of the SELECT of list of all contacts (for a third party or all). * This also set the number of contacts found into $this->num * - * @since 9.0 Add afterSelectOptions hook & selectcontacts context. + * @since 9.0 Add afterSelectContactOptions hook * * @param int $socid Id ot third party or 0 for all or -1 for empty list * @param array|int $selected Array of ID of pre-selected contact id @@ -1418,17 +1418,15 @@ class Form if ($selected === '') $selected = array(); else if (!is_array($selected)) $selected = array($selected); - $out=''; + $out=''; - // Add selectcontacts hook if (! is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager=new HookManager($this->db); } - $hookmanager->initHooks(array('selectcontacts')); - // On recherche les societes + // We search third parties $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; if ($showsoc > 0) $sql.= " , s.nom as company"; $sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp"; @@ -1523,7 +1521,7 @@ class Form 'showsoc'=>$showsoc, ); - $reshook = $hookmanager->executeHooks( 'afterSelectOptions', $parameters, $this, $action ); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks( 'afterSelectContactOptions', $parameters, $this, $action ); // Note that $action and $object may have been modified by some hooks if ($htmlname != 'none' || $options_only) { From bd7df9869f9f81da5285caf8d64a3550e7585f90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 17:37:08 +0100 Subject: [PATCH 76/88] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 664def9e2c4..c2804e19e1b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1058,8 +1058,8 @@ class FormMail extends Form //if (! $this->errorstomail) $this->errorstomail=$this->frommail; $errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail); if ($this->witherrorstoreadonly) { - $out = ''; $out.= '
    \n"; } else { From d93a6aa1204512956e3c241a4edefcdac8ab1857 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 17:54:23 +0100 Subject: [PATCH 77/88] Fix regression --- htdocs/core/tpl/login.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 94be275ff12..4a60a00ba2c 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -71,7 +71,7 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize - global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> + global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> dol_use_jmobile)) { ?> From 31c5ac470b28aa5be5cf541744e8aa399d6e80cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 17:57:19 +0100 Subject: [PATCH 78/88] More powerfull easter egg --- htdocs/core/tpl/login.tpl.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 4a60a00ba2c..96510b85617 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -67,10 +67,11 @@ $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize ?> -global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { ?> - - +global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { + // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random' + ?> + + global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> From 77c01a1fae076039faf809668e4767491c0442a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 17:58:33 +0100 Subject: [PATCH 79/88] Update date.lib.php --- htdocs/core/lib/date.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 253b2814977..48961a0c6d5 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -282,7 +282,6 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt * @param int $day_date day date * @param int $month_date month date * @param int $year_date year date - * @return string $sqldate sql part of date */ From 59bc15377db610a3fb2005179318f0055e6c4771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 18:58:55 +0100 Subject: [PATCH 80/88] CSS --- htdocs/admin/facture.php | 14 +++++++------- htdocs/compta/facture/list.php | 2 +- htdocs/core/class/html.form.class.php | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 46a11e363fd..683453023b9 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -241,17 +241,17 @@ if ($action == 'setforcedate') if ($action == 'setDefaultPDFModulesByType') { $invoicetypemodels = GETPOST('invoicetypemodels'); - + if(!empty($invoicetypemodels) && is_array($invoicetypemodels)) { $error = 0; - + foreach ($invoicetypemodels as $type => $value) { $res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type),$value,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; } - + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -621,7 +621,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''; print ''; print "\n"; - + $listtype=array( Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), @@ -632,7 +632,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf { $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); } - + foreach ($listtype as $type => $trans) { $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; @@ -642,7 +642,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''; print "\n"; } - + print '
    '; - print fieldLabel('CurrencyRate','multicurrency_tx'); + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
    ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
    ' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
    ' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
    ' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    ' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '
    ' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    ' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '
    ' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    ' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '
    ' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
    '; - print fieldLabel('DatePayment','datep',1).''; + print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).''; print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print '
    '; - print fieldLabel('DateValue','datev',0).''; + print $form->editfieldkey('DateValue', 'datev', '', $object, 0).''; print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1); print '
    '; - print fieldLabel('Employee','fk_user',1).''; + print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; $noactive=0; // We keep active and unactive users print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); print '
    '; - print fieldLabel('Label','label',1).''; + print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).''; print 'trans("SalaryPayment")).'">'; print '
    '; - print fieldLabel('DateStartPeriod','datesp',1).''; + print $form->editfieldkey('DateStartPeriod', 'datesp', '', $object, 0, 'string', '', 1).''; print $form->selectDate($datesp, "datesp", '', '', '', 'add'); print '
    '; - print fieldLabel('DateEndPeriod','dateep',1).''; + print $form->editfieldkey('DateEndPeriod', 'dateep', '', $object, 0, 'string', '', 1).''; print $form->selectDate($dateep, "dateep", '', '', '', 'add'); print '
    '; - print fieldLabel('Amount','amount',1).''; + print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; print ''; print '
    '; - print fieldLabel('BankAccount','selectaccountid',1).''; + print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).''; $form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant print '
    '; - print fieldLabel('PaymentMode','selectpaymenttype',1).''; + print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2); print '
    skype).'">
    twitter).'">
    facebook).'">
    ' . fieldLabel( 'Categories', 'contcats' ) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, 'parent', null, null, 1 ); - print $form->multiselectarray( 'contcats', $cate_arbo, GETPOST( 'contcats', 'array' ), null, null, null, - null, '90%' ); + print '
    ' . $form->editfieldkey('Categories', 'contcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); + print $form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); print "
    skype).'">
    twitter).'">
    facebook).'">
    ' . fieldLabel( 'Categories', 'contcats' ) . '
    ' . $form->editfieldkey('Categories', 'contcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 ); - $c = new Categorie( $db ); - $cats = $c->containing( $object->id, 'contact' ); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, 'contact'); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray( 'contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' ); + print $form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); print "
    ' . $langs->trans("Categories") . ''; - print $form->showCategories( $object->id, 'contact', 1 ); + print $form->showCategories($object->id, 'contact', 1); print '
    '; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) + print ''; + print ''; $formother->select_year($year_start,'year_start',1, $min_year, $max_year); print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) + print ''; + print ''; $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print '
    '.$langs->trans("MailErrorsTo").''; + $out = ''; $out.= $errorstomail; $out.= "
    '.$langs->trans("Name").'
    '.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current,0,0, 0).'
    '; print ""; } @@ -698,7 +698,7 @@ if (! empty($conf->banque->enabled)) } else { - print "".$langs->trans("NoActiveBankAccountDefined").""; + print ''.$langs->trans("NoActiveBankAccountDefined").''; } } } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 78d76eca5fc..d9ed88fa4f6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -358,7 +358,7 @@ $thirdpartystatic=new Societe($db); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' f.rowid as id, f.ref as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; +$sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0c43a14b9e7..6349bb56d99 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2058,20 +2058,20 @@ class Form $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; - + $sql = "SELECT "; $sql.= $selectFields . $selectFieldsGrouped; - + if (! empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) { //Product category $sql.= ", (SELECT ".MAIN_DB_PREFIX."categorie_product.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_product - WHERE ".MAIN_DB_PREFIX."categorie_product.fk_product=p.rowid + WHERE ".MAIN_DB_PREFIX."categorie_product.fk_product=p.rowid LIMIT 1 ) AS categorie_product_id "; } - + //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { @@ -2181,7 +2181,7 @@ class Form { $sql.= ' GROUP BY'.$selectFields; } - + //Sort by category if(! empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) { @@ -2195,7 +2195,7 @@ class Form } $sql.= $db->plimit($limit, 0); - + // Build output string dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG); $result=$this->db->query($sql); @@ -3636,8 +3636,8 @@ class Form } else { - if ($statut == 0) print $langs->trans("NoActiveBankAccountDefined"); - else print $langs->trans("NoBankAccountFound"); + if ($statut == 0) print ''.$langs->trans("NoActiveBankAccountDefined").''; + else print ''.$langs->trans("NoBankAccountFound").''; } } else { From f9c06cdb82ce1b2e1c31a15356f6a9b97cf3c825 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 19:04:17 +0100 Subject: [PATCH 81/88] FIX #9498 #10132 --- htdocs/core/class/html.form.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6349bb56d99..9e70fa20944 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3585,7 +3585,7 @@ class Form * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @param string $moreattrib To add more attribute on select * @param int $showcurrency Show currency in label - * @return void + * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0) { @@ -3593,6 +3593,7 @@ class Form global $langs, $conf; $langs->load("admin"); + $num = 0; $sql = "SELECT rowid, label, bank, clos as status, currency_code"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; @@ -3643,6 +3644,8 @@ class Form else { dol_print_error($this->db); } + + return $num; } /** @@ -3661,8 +3664,8 @@ class Form print '
    '; print ''; print ''; - $this->select_comptes($selected, $htmlname, 0, '', $addempty); - print ''; + $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); + if ($nbaccountfound > 0) print ''; print '
    '; } else { From baf9b6f309c5aaa59045722eebc6c970a6a5c803 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 19:21:19 +0100 Subject: [PATCH 82/88] Fix regression (bad name of function) --- htdocs/comm/propal/list.php | 6 +++--- htdocs/commande/list.php | 4 ++-- htdocs/compta/deplacement/list.php | 2 +- htdocs/compta/facture/list.php | 4 ++-- htdocs/compta/paiement/list.php | 2 +- htdocs/core/lib/date.lib.php | 18 +++++++++--------- htdocs/expensereport/list.php | 4 ++-- htdocs/fourn/commande/list.php | 4 ++-- htdocs/fourn/facture/list.php | 4 ++-- htdocs/holiday/list.php | 6 +++--- htdocs/supplier_proposal/list.php | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 30861f5c985..f42c77176dc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -330,15 +330,15 @@ if ($viewstatut != '' && $viewstatut != '-1') $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.datep", $search_day, $search_month, $search_year ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery ); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4b9b769855c..d59618e7541 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -304,12 +304,12 @@ if ($viewstatut <> '') } } -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear ); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index b04fd1388b6..74d30692c3f 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -107,7 +107,7 @@ if ($search_company) } // if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'"; -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.dated", $day, $month, $year ); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8b8b018e6ee..f141f065e4d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -452,11 +452,11 @@ if ($search_status != '-1' && $search_status != '') } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "f.datef", $search_day, $search_month, $search_year ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim ); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bcf99538498..460393e8bc4 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -164,7 +164,7 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - $sql.= dol_sql_datefilter("p.datep", $day, $month, $year); + $sql.= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 48961a0c6d5..d6d1e0c741c 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -151,7 +151,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) * @return int Time into seconds * @see convertSecondToTime */ -function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) +function convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0) { $iResult=($iHours*3600)+($iMinutes*60)+$iSeconds; return $iResult; @@ -276,16 +276,16 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt /** - * générate standard filter date + * Generate a SQL string to make a filter into a range (for second of date until last second of date) * - * @param string $datefield fields where apply sql date filter - * @param int $day_date day date - * @param int $month_date month date - * @param int $year_date year date - * @return string $sqldate sql part of date + * @param string $datefield Name of SQL field where apply sql date filter + * @param int $day_date Day date + * @param int $month_date Month date + * @param int $year_date Year date + * @return string $sqldate String with SQL filter */ - -function dolSqlDatefilter($datefield, $day_date, $month_date, $year_date) { +function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date) +{ global $db; $sqldate=""; if ($month_date > 0) { diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 13c5878b6b8..38e050b1673 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -276,13 +276,13 @@ if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref if (!empty($search_ref)) $sql.= natural_search('d.ref', $search_ref); // Date Start -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.date_debut", $day_start, $month_start, $year_start ); // Date End -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "d.date_fin", $day_end, $month_end, $year_end ); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4a263381c81..bd1430f2d40 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -528,11 +528,11 @@ if (GETPOST('statut', 'intcomma') !== '') if ($search_status != '' && $search_status >= 0) $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear ); -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear ); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7896cfa9eec..a05b93bb7da 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -331,8 +331,8 @@ if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_mont if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; -$sql.= dol_sql_datefilter( "f.datef", $day, $month, $year); -$sql.= dol_sql_datefilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); +$sql.= dolSqlDateFilter( "f.datef", $day, $month, $year); +$sql.= dolSqlDateFilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; if ($search_label) $sql .= natural_search('f.libelle', $search_label); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c88dd1f4776..f638a7e5015 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -191,19 +191,19 @@ if(!empty($search_ref)) } // Start date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_debut", $search_day_start, $search_month_start, $search_year_start ); // End date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_fin", $search_day_end, $search_month_end, $search_year_end ); // Create date -$sql.= dol_sql_datefilter( +$sql.= dolSqlDateFilter( "cp.date_create", $search_day_create, $search_month_create, $search_year_create ); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ed841c653b1..1eee5ebf60e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -290,8 +290,8 @@ if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$db->escape($search_status).')'; -$sql.= dol_sql_datefilter("sp.date_livraison", $day, $month, $year); -$sql.= dol_sql_datefilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); +$sql.= dolSqlDateFilter("sp.date_livraison", $day, $month, $year); +$sql.= dolSqlDateFilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) From c85348c234d2d0852a686cb64ea44adfffd82d3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 19:26:47 +0100 Subject: [PATCH 83/88] Update main.lang --- htdocs/langs/en_US/main.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a9bba0d4043..bd535ae150e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -947,6 +947,7 @@ Annual=Annual Local=Local Remote=Remote LocalAndRemote=Local and Remote +KeyboardShortcut=Keyboard shortcut AssignedTo=Assigned to Deletedraft=Delete draft ConfirmMassDraftDeletion=Draft mass delete confirmation From d5bbb3033c5e6656a35bca04dd46eb327fb2593d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 19:29:15 +0100 Subject: [PATCH 84/88] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b40120a2ca0..c0399db7c6d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6683,14 +6683,18 @@ class Form // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox // accesskey is for Mac: CTRL + key for all browsers - $stringforfirstkey = 'CTL +'; + $stringforfirstkey = $langs->trans("KeyboardShortcut"); if ($conf->browser->name == 'chrome') { - $stringforfirstkey = 'ALT +'; + $stringforfirstkey .= ' ALT +'; } if ($conf->browser->name == 'firefox') { - $stringforfirstkey = 'ALT + SHIFT +'; + $stringforfirstkey .= ' ALT + SHIFT +'; + } + else + { + $stringforfirstkey .= ' CTL +'; } $previous_ref = $object->ref_previous?'':''; From 0cbc0fa0fc7a6f6a5f3865fa16a447376211e67e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Dec 2018 19:33:43 +0100 Subject: [PATCH 85/88] Fix shortkey --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dc0a5c7857b..8c17f189502 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6746,7 +6746,7 @@ class Form { $stringforfirstkey .= ' ALT +'; } - if ($conf->browser->name == 'firefox') + elseif ($conf->browser->name == 'firefox') { $stringforfirstkey .= ' ALT + SHIFT +'; } @@ -6754,7 +6754,7 @@ class Form { $stringforfirstkey .= ' CTL +'; } - + $previous_ref = $object->ref_previous?'':''; $next_ref = $object->ref_next?'':''; } From b511a056f4684ff291d9a5e88c24962e59decd4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Dec 2018 11:48:21 +0100 Subject: [PATCH 86/88] Fix phpcs --- htdocs/comm/propal/list.php | 17 +++-------------- htdocs/commande/list.php | 13 ++----------- htdocs/compta/deplacement/list.php | 6 +----- htdocs/compta/facture/list.php | 14 +++----------- htdocs/compta/paiement/list.php | 1 - htdocs/expensereport/list.php | 15 ++++----------- htdocs/fourn/commande/list.php | 14 ++------------ htdocs/fourn/facture/list.php | 2 -- htdocs/holiday/list.php | 22 +++------------------- htdocs/supplier_proposal/list.php | 2 -- 10 files changed, 18 insertions(+), 88 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f42c77176dc..52a3a1562d3 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -329,20 +329,9 @@ if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } - -$sql.= dolSqlDateFilter( - "p.datep", - $search_day, $search_month, $search_year -); -$sql.= dolSqlDateFilter( - "p.fin_validite", - $search_dayfin, $search_month_end, $search_yearfin -); -$sql.= dolSqlDateFilter( - "p.date_livraison", - $search_daydelivery, $search_monthdelivery, $search_yeardelivery -); - +$sql.= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year); +$sql.= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin); +$sql.= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d59618e7541..a5ff8bf0dc8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -303,17 +303,8 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } - -$sql.= dolSqlDateFilter( - "c.date_commande", - $search_orderday, $search_ordermonth, $search_orderyear -); - -$sql.= dolSqlDateFilter( - "c.date_livraison", - $search_deliveryday, $search_deliverymonth, $search_deliveryyear -); - +$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); +$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 74d30692c3f..d6d599d7ece 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -105,11 +105,7 @@ if ($search_company) { $sql .= natural_search('s.nom', $search_company); } -// if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'"; - -$sql.= dolSqlDateFilter( - "d.dated", $day, $month, $year -); +$sql.= dolSqlDateFilter("d.dated", $day, $month, $year); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f141f065e4d..235f7a75dbd 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -451,18 +451,10 @@ if ($search_status != '-1' && $search_status != '') } } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); - -$sql.= dolSqlDateFilter( - "f.datef", - $search_day, $search_month, $search_year -); -$sql.= dolSqlDateFilter( - "f.date_lim_reglement", - $search_day_lim, $search_month_lim, $search_year_lim -); - +$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); +$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 460393e8bc4..12669947cff 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -165,7 +165,6 @@ else } // Search criteria $sql.= dolSqlDateFilter("p.datep", $day, $month, $year); - if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 38e050b1673..34a28442e45 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -276,16 +276,9 @@ if (!empty($sall)) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Ref if (!empty($search_ref)) $sql.= natural_search('d.ref', $search_ref); // Date Start -$sql.= dolSqlDateFilter( - "d.date_debut", - $day_start, $month_start, $year_start -); - +$sql.= dolSqlDateFilter("d.date_debut", $day_start, $month_start, $year_start); // Date End -$sql.= dolSqlDateFilter( - "d.date_fin", - $day_end, $month_end, $year_end -); +$sql.= dolSqlDateFilter("d.date_fin", $day_end, $month_end, $year_end); if ($search_amount_ht != '') $sql.= natural_search('d.total_ht', $search_amount_ht, 1); if ($search_amount_ttc != '') $sql.= natural_search('d.total_ttc', $search_amount_ttc, 1); @@ -527,7 +520,7 @@ if ($resql) if (! empty($arrayfields['d.date_debut']['checked'])) { print '
    '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; @@ -538,7 +531,7 @@ if ($resql) if (! empty($arrayfields['d.date_fin']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year_end,'year_end',1, $min_year, $max_year); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index bd1430f2d40..a8ea0b63f6d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -520,23 +520,13 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ; if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$db->escape($search_billed); if ($search_product_category > 0) $sql.= " AND cp.fk_categorie = ".$search_product_category; - //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'intcomma') !== '') $sql .= " AND cf.fk_statut IN (".$db->escape($db->escape(GETPOST('statut', 'intcomma'))).")"; - if ($search_status != '' && $search_status >= 0) $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; - -$sql.= dolSqlDateFilter( - "cf.date_commande", - $search_orderday, $search_ordermonth, $search_orderyear -); -$sql.= dolSqlDateFilter( - "cf.date_livraison", - $search_deliveryday, $search_deliverymonth, $search_deliveryyear -); - +$sql.= dolSqlDateFilter("cf.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); +$sql.= dolSqlDateFilter("cf.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_state) $sql.= natural_search("state.nom",$search_state); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a05b93bb7da..9286c038507 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -330,10 +330,8 @@ if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $searc if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; - $sql.= dolSqlDateFilter( "f.datef", $day, $month, $year); $sql.= dolSqlDateFilter( "f.date_lim_reglement", $day_lim, $month_lim, $year_lim); - if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; if ($search_label) $sql .= natural_search('f.libelle', $search_label); if ($search_status != '' && $search_status >= 0) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index f638a7e5015..1cb76abf4ec 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -189,40 +189,24 @@ if(!empty($search_ref)) { $filter.= " AND cp.rowid = ".(int) $db->escape($search_ref); } - // Start date -$sql.= dolSqlDateFilter( - "cp.date_debut", - $search_day_start, $search_month_start, $search_year_start -); - +$filter.= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start, $search_year_start); // End date -$sql.= dolSqlDateFilter( - "cp.date_fin", - $search_day_end, $search_month_end, $search_year_end -); - +$filter.= dolSqlDateFilter("cp.date_fin", $search_day_end, $search_month_end, $search_year_end); // Create date -$sql.= dolSqlDateFilter( - "cp.date_create", - $search_day_create, $search_month_create, $search_year_create -); - +$filter.= dolSqlDateFilter("cp.date_create", $search_day_create, $search_month_create, $search_year_create); // Employee if(!empty($search_employee) && $search_employee != -1) { $filter.= " AND cp.fk_user = '".$db->escape($search_employee)."'\n"; } - // Validator if(!empty($search_valideur) && $search_valideur != -1) { $filter.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n"; } - // Type if (!empty($search_type) && $search_type != -1) { $filter.= ' AND cp.fk_type IN ('.$db->escape($search_type).')'; } - // Status if(!empty($search_statut) && $search_statut != -1) { $filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n"; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 1eee5ebf60e..1fe96bc4def 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -289,10 +289,8 @@ if ($search_montant_ttc != '') $sql.= natural_search("sp.total", $search_montant if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($search_status >= 0 && $search_status != '') $sql.= ' AND sp.fk_statut IN ('.$db->escape($search_status).')'; - $sql.= dolSqlDateFilter("sp.date_livraison", $day, $month, $year); $sql.= dolSqlDateFilter("sp.date_valid", $dayvalid, $monthvalid, $yearvalid); - if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { From 72f8730ce8cf1648ab70adac9c7623ff3a5c23e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Dec 2018 12:08:32 +0100 Subject: [PATCH 87/88] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e172a83697c..36434c0c18c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1107,8 +1107,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Balance $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire); - // Files - $newmenu->add("/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files",$langs->trans("AccountantFiles"),1,$user->rights->accounting->mouvements->lire); + + // Files + if (! empty($conf->global->MAIN_FEATURES_LEVEL > 2)) + { + $newmenu->add("/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files",$langs->trans("AccountantFiles"),1,$user->rights->accounting->mouvements->lire); + } + // Reports $langs->load("compta"); From 48aa6e9ccffd472097f0eba0d9db31137068c014 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Dec 2018 12:09:13 +0100 Subject: [PATCH 88/88] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 36434c0c18c..7c3ba15af01 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1109,7 +1109,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire); // Files - if (! empty($conf->global->MAIN_FEATURES_LEVEL > 2)) + if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 2) { $newmenu->add("/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files",$langs->trans("AccountantFiles"),1,$user->rights->accounting->mouvements->lire); }