diff --git a/ChangeLog b/ChangeLog index c90df6510fe..4de2b1fc745 100644 --- a/ChangeLog +++ b/ChangeLog @@ -283,7 +283,7 @@ The following changes may create regressions for some external modules, but were * Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT * The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter. * A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english. - +* The load of hook context productdao has been removed before calling loadvirtualstock. Modules must use the context of main parent page or 'all' for all cases. ***** ChangeLog for 18.0.4 compared to 18.0.3 ***** FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index ea7da54148b..5cb0ee3c09c 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -423,7 +423,7 @@ class Members extends DolibarrApi * Validate fields before creating an object * * @param array|null $data Data to validate - * @return array + * @return array Return array with validated mandatory fields and their value * * @throws RestException */ @@ -443,8 +443,8 @@ class Members extends DolibarrApi /** * Clean sensible object datas * - * @param Object $object Object to clean - * @return Object Object with cleaned properties + * @param Object $object Object to clean + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index dd946c6a8ee..1305f812c76 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Frederic France * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2020 Andreu Bisquerra Gaya + * Copyright (C) 2024 MDW * * 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 @@ -322,7 +323,7 @@ if ($mode == 'config' && $user->admin) { print load_fiche_titre($langs->trans("ReceiptPrinterDesc"), '', '')."\n"; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''."\n"; print ''; print ''; @@ -416,7 +417,7 @@ if ($mode == 'config' && $user->admin) { print ''.$langs->trans("ReceiptPrinterTypeDesc").'...

'."\n"; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("Name").'
'."\n"; print ''; print ''; @@ -445,7 +446,7 @@ if ($mode == 'template' && $user->admin) { print ''; } - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("CONNECTOR_DUMMY").''.$langs->trans("CONNECTOR_DUMMY_HELP").'
'.$form->textwithpicto($langs->trans("CONNECTOR_NETWORK_PRINT"), $langs->trans("FromServerPointOfView")).''.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'
'."\n"; print ''; print ''; @@ -512,7 +513,7 @@ if ($mode == 'template' && $user->admin) { print '
'; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print '
'.$langs->trans("Name").'
'."\n"; print ''; print ''; diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php index 9a55c609252..eddb8a40dc5 100644 --- a/htdocs/bom/ajax/ajax.php +++ b/htdocs/bom/ajax/ajax.php @@ -53,7 +53,7 @@ $idproduct = GETPOST('idproduct', 'int'); * View */ -top_httphead(); +top_httphead('application/json'); if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) { $product = new Product($db); @@ -65,3 +65,24 @@ if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) echo json_encode($fk_unit); exit(); } + +if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) { + $product = new Product($db); + $res = $product->fetch($idproduct); + + $result = array(); + + if ($res < 0) { + $error = 'SQL ERROR'; + } elseif ($res == 0) { + $error = 'NOT FOUND'; + } else { + $error = null; + $result['defaultWk']=$product->fk_default_workstation; + } + + $result['error']=$error; + + echo json_encode($result); + exit(); +} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 3faa8146ab4..808acba17f6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -792,7 +792,7 @@ class BOM extends CommonObject $line->array_options[$key] = $array_options[$key]; } } - if ($fk_default_workstation > 0 && $line->fk_default_workstation != $fk_default_workstation) { + if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) { $line->fk_default_workstation = $fk_default_workstation; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index db3991eac7d..9c59338fa69 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -185,7 +185,7 @@ if ($filtertype != 1) { $coldisplay++; print ''; $coldisplay++; @@ -235,6 +235,7 @@ jQuery(document).ready(function() { ,type: 'POST' ,data: { 'action': 'getDurationUnitByProduct' + ,'token' : "" ,'idproduct' : idproduct } }).done(function(data) { @@ -243,6 +244,20 @@ jQuery(document).ready(function() { var data = JSON.parse(data); $("#fk_unit").val(data).change(); }); + + $.ajax({ + url : "" + ,type: 'POST' + ,data: { + 'action': 'getWorkstationByProduct' + ,'token' : "" + ,'idproduct' : idproduct + } + }).done(function(data) { + var data = JSON.parse(data); + $('#idworkstations').val(data.defaultWk).select2(); + + }); }); }); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 159d7925e3a..12d8cd01284 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -70,7 +70,8 @@ class Categories extends DolibarrApi */ public function __construct() { - global $db, $conf; + global $db; + $this->db = $db; $this->category = new Categorie($this->db); } @@ -133,8 +134,6 @@ class Categories extends DolibarrApi */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '', $properties = '') { - global $db, $conf; - $obj_ret = array(); if (!DolibarrApiAccess::$user->rights->categorie->lire) { @@ -198,8 +197,8 @@ class Categories extends DolibarrApi throw new RestException(401); } - // Check mandatory fields - $result = $this->_validate($request_data); + // Check mandatory fields (throw an exception if wrong) + $this->_validate($request_data); foreach ($request_data as $field => $value) { if ($field === 'caller') { @@ -666,8 +665,8 @@ class Categories extends DolibarrApi /** * Clean sensible object datas * - * @param Categorie $object Object to clean - * @return Object Object with cleaned properties + * @param Categorie $object Object to clean + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { @@ -722,8 +721,8 @@ class Categories extends DolibarrApi /** * Validate fields before create or update object * - * @param array|null $data Data to validate - * @return array + * @param array|null $data Data to validate + * @return array Return array with validated mandatory fields and their value * * @throws RestException */ diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 02dd3b8ea30..a0a2a5a4c5f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1190,6 +1190,10 @@ if (empty($reshook)) { if (!empty($price_ht) || (string) $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU'); + } elseif (!empty($price_ht_devise) || (string) $price_ht_devise === '0') { + $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht = ''; + $pu_ttc = ''; } elseif (!empty($price_ttc) || (string) $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); $pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU'); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 6c575936eb4..1030b4b10b5 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -127,8 +127,8 @@ if (empty($reshook)) { $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha'))); $object->label = trim(GETPOST("label", 'alphanohtml')); - $object->courant = GETPOST("type"); - $object->clos = GETPOST("clos"); + $object->courant = GETPOSTINT("type"); + $object->clos = GETPOSTINT("clos"); $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1); $object->url = trim(GETPOST("url", 'alpha')); @@ -157,24 +157,24 @@ if (empty($reshook)) { } else { $object->account_number = $account_number; } - $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); + $fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal'); if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; } - $object->solde = price2num(GETPOST("solde", 'alpha')); - $object->balance = price2num(GETPOST("solde", 'alpha')); + $object->solde = GETPOSTFLOAT("solde"); + $object->balance = GETPOSTFLOAT("solde"); $object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int')); $object->currency_code = trim(GETPOST("account_currency_code")); - $object->state_id = GETPOST("account_state_id", 'int'); - $object->country_id = GETPOST("account_country_id", 'int'); + $object->state_id = GETPOSTINT("account_state_id"); + $object->country_id = GETPOSTINT("account_country_id"); - $object->min_allowed = GETPOST("account_min_allowed", 'int'); - $object->min_desired = GETPOST("account_min_desired", 'int'); + $object->min_allowed = GETPOSTFLOAT("account_min_allowed"); + $object->min_desired = GETPOSTFLOAT("account_min_desired"); $object->comment = trim(GETPOST("account_comment", 'restricthtml')); $object->fk_user_author = $user->id; @@ -240,8 +240,8 @@ if (empty($reshook)) { $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha'))); $object->label = trim(GETPOST("label", 'alphanohtml')); - $object->courant = GETPOST("type"); - $object->clos = GETPOST("clos"); + $object->courant = GETPOSTINT("type"); + $object->clos = GETPOSTINT("clos"); $object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1); $object->url = trim(GETPOST("url", 'alpha')); @@ -270,7 +270,7 @@ if (empty($reshook)) { } else { $object->account_number = $account_number; } - $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); + $fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal'); if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { @@ -279,11 +279,11 @@ if (empty($reshook)) { $object->currency_code = trim(GETPOST("account_currency_code")); - $object->state_id = GETPOST("account_state_id", 'int'); - $object->country_id = GETPOST("account_country_id", 'int'); + $object->state_id = GETPOSTINT("account_state_id"); + $object->country_id = GETPOSTINT("account_country_id"); - $object->min_allowed = GETPOST("account_min_allowed", 'int'); - $object->min_desired = GETPOST("account_min_desired", 'int'); + $object->min_allowed = GETPOSTFLOAT("account_min_allowed"); + $object->min_desired = GETPOSTFLOAT("account_min_desired"); $object->comment = trim(GETPOST("account_comment", 'restricthtml')); if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 51e955007eb..5215cb53170 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -379,19 +379,18 @@ class PaymentVarious extends CommonObject public function initAsSpecimen() { $this->id = 0; - - $this->tms = ''; - $this->datep = ''; - $this->datev = ''; - $this->sens = ''; - $this->amount = ''; - $this->label = ''; + $this->tms = dol_now(); + $this->datep = dol_now(); + $this->datev = dol_now(); + $this->sens = 0; + $this->amount = 100; + $this->label = 'Specimen payment'; $this->accountancy_code = ''; $this->subledger_account = ''; $this->note = ''; - $this->fk_bank = ''; - $this->fk_user_author = ''; - $this->fk_user_modif = ''; + $this->fk_bank = 0; + $this->fk_user_author = 0; + $this->fk_user_modif = 0; } /** diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 76bc245fd4d..64d2f2637ae 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2218,6 +2218,10 @@ if (empty($reshook)) { if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } elseif (!empty($price_ht_devise) || $price_ht_devise === '0') { + $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht = ''; + $pu_ttc = ''; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); @@ -2309,8 +2313,10 @@ if (empty($reshook)) { $type = $prod->type; $fk_unit = $prod->fk_unit; } else { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($price_ttc, 'MU'); + if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU'); + else $pu_ht = ''; + if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU'); + else $pu_ttc = ''; $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); if (empty($tva_tx)) { @@ -2336,8 +2342,8 @@ if (empty($reshook)) { $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); - $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); + $pu_ht_devise = price2num($price_ht_devise, '', 2); + $pu_ttc_devise = price2num($price_ttc_devise, '', 2); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e9eb5ec753e..b1047c84903 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4424,7 +4424,7 @@ class Facture extends CommonInvoice * Set percent discount * * @param User $user User that set discount - * @param double $remise Discount + * @param float $remise Discount * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Return integer <0 if KO, >0 if OK * @deprecated remise_percent is a deprecated field for object parent @@ -4437,16 +4437,16 @@ class Facture extends CommonInvoice } if ($user->hasRight('facture', 'creer')) { - $remise = price2num($remise, 2); + $remise = (float) price2num($remise, 2); $error = 0; $this->db->begin(); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; - $sql .= ' SET remise_percent = '.((float) $remise); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture"; + $sql .= " SET remise_percent = ".((float) $remise); $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= ' AND fk_statut = '.self::STATUS_DRAFT; + $sql .= " AND fk_statut = ".((int) self::STATUS_DRAFT); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -6295,7 +6295,8 @@ class FactureLigne extends CommonInvoiceLine // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) { - if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { + $result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product); + if ($result < 0) { return $result; } else { $this->pa_ht = $result; @@ -6734,7 +6735,7 @@ class FactureLigne extends CommonInvoiceLine * * @param int $invoiceid Invoice id * @param bool $include_credit_note Include credit note or not - * @return int >= 0 + * @return float|int Reurrn previous situation percent, 0 or -1 if error */ public function get_prev_progress($invoiceid, $include_credit_note = true) { diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 50ead13e11d..e4cc36e0736 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'compta')); -$id = GETPOST('id', 'int'); +$id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 0758dfc3c43..cec162957be 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks", "bills", "compta")); -$chid = GETPOST("id", 'int'); +$chid = GETPOSTINT("id"); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel'); diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index e92ee936c40..3cac781c50e 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array("banks", "bills")); -$chid = GETPOST("id", 'int'); +$chid = GETPOSTINT("id"); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel'); diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 8c29fe94dc8..a470531a398 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -157,7 +157,7 @@ class LignePrelevement * * @param int $status Id status * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto - * @return null|string Label + * @return null|string Return status label (or null if $mode != 0, 1, 2, 3 or 4) */ public function LibStatut($status, $mode = 0) { @@ -192,7 +192,7 @@ class LignePrelevement } } // return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - return; + return null; } /** diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 1c106b8d399..2575c69b31e 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -519,13 +519,12 @@ class Cchargesociales public function initAsSpecimen() { $this->id = 0; - $this->libelle = ''; $this->label = ''; $this->deductible = ''; $this->active = ''; $this->code = ''; - $this->fk_pays = ''; + $this->fk_pays = 0; $this->module = ''; $this->accountancy_code = ''; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 40ac77d918b..c777b7ee9c8 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -531,19 +531,18 @@ class PaymentSocialContribution extends CommonObject public function initAsSpecimen() { $this->id = 0; - - $this->fk_charge = ''; - $this->datec = ''; - $this->tms = ''; - $this->datep = ''; - $this->amount = ''; + $this->fk_charge = 0; + $this->datec = dol_now(); + $this->tms = dol_now(); + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepaiement = ''; - $this->num_payment = ''; + $this->num_payment = 'ABC123'; $this->note_private = ''; $this->note_public = ''; - $this->fk_bank = ''; - $this->fk_user_creat = ''; - $this->fk_user_modif = ''; + $this->fk_bank = 0; + $this->fk_user_creat = 0; + $this->fk_user_modif = 0; } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 5ca22da196c..695f3ee45bb 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -172,7 +172,7 @@ if (empty($reshook)) { if ($action == 'add' && !$cancel) { $error = 0; - $object->fk_account = GETPOST("accountid", 'int'); + $object->fk_account = GETPOSTINT("accountid"); $object->type_payment = GETPOST("type_payment", 'alphanohtml'); $object->num_payment = GETPOST("num_payment", 'alphanohtml'); @@ -329,7 +329,8 @@ if (empty($reshook)) { $object->fetch($id); if ($object->id > 0) { - $object->id = $object->ref = null; + $object->id = 0; + $object->ref = null; $object->paye = 0; if (GETPOST('amount', 'alphanohtml')) { diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index 9fe6ba57eab..0190b4d2e22 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -533,13 +533,12 @@ class PaymentVAT extends CommonObject public function initAsSpecimen() { $this->id = 0; - $this->fk_tva = 0; $this->datec = ''; $this->tms = ''; $this->datep = ''; $this->amount = ''; - $this->fk_typepaiement = ''; + $this->fk_typepaiement = 0; $this->num_payment = ''; $this->note_private = ''; $this->note_public = ''; diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php index 4d901fbc801..e5007d90752 100644 --- a/htdocs/core/actions_comments.inc.php +++ b/htdocs/core/actions_comments.inc.php @@ -38,7 +38,7 @@ if ($action == 'addcomment') { if (!empty($description)) { $comment->description = $description; $comment->datec = dol_now(); - $comment->fk_element = GETPOST('id', 'int'); + $comment->fk_element = GETPOSTINT('id'); $comment->element_type = GETPOST('comment_element_type', 'alpha'); $comment->fk_user_author = $user->id; $comment->entity = $conf->entity; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 8994b24e017..63781b79df3 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1751,7 +1751,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf } if (!$error) { - $clone_task->fk_project = GETPOST('projectid', 'int'); + $clone_task->fk_project = GETPOSTINT('projectid'); $clone_task->ref = $defaultref; $clone_task->label = $origin_task->label; $clone_task->description = $origin_task->description; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fb41245579d..f204c535089 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7277,7 +7277,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); - $out = $doleditor->Create(1); + $out = $doleditor->Create(1, '', true, '', '', '', $morecss); } else { $out = ''; } @@ -8964,7 +8964,7 @@ abstract class CommonObject * @param float $unitPrice Product unit price * @param float $discountPercent Line discount percent * @param int $fk_product Product id - * @return float Return integer <0 if KO, buyprice if OK + * @return float|int Return buy price if OK, integer <0 if KO */ public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_product = 0) { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 6a88c5f780a..a2448501e7d 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -77,7 +77,7 @@ class FormAccounting extends Form * @param string $morecss More css non HTML object * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param int $disabledajaxcombo Disable ajax combo box. - * @return string String with HTML select + * @return string|int String with HTML select, or -1 if error */ public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0) { @@ -157,7 +157,7 @@ class FormAccounting extends Form * @param string $morecss More css non HTML object * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param int $disabledajaxcombo Disable ajax combo box. - * @return string String with HTML select + * @return string|int String with HTML select, or -1 if error */ public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0) { @@ -319,7 +319,7 @@ class FormAccounting extends Form * * @param string $htmlname Name of select field * @param string $selectedkey Value - * @return string HTML edit field + * @return string|int HTML edit field, or -1 if error */ public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { @@ -359,7 +359,7 @@ class FormAccounting extends Form * @param string $morecss More css non HTML object * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param string $active Filter on status active or not: '0', '1' or '' for no filter - * @return string String with HTML select + * @return string|int String with HTML select, or -1 if error */ public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $active = '1') { @@ -467,7 +467,7 @@ class FormAccounting extends Form * @param string $morecss More css * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param string $labelhtmlname HTML name of label for autofill of account from name. - * @return string String with HTML select + * @return string|int String with HTML select, or -1 if error */ public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '') { @@ -560,7 +560,7 @@ class FormAccounting extends Form * @param string $htmlname Name of HTML select object * @param int $useempty Affiche valeur vide dans liste * @param string $output_format (html/option (for option html only)/array (to return options arrays - * @return string|array HTML select component or array of select options + * @return string|array|int HTML select component || array of select options || - 1 if error */ public function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 7555ae67ca0..285e37edbf4 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -755,7 +755,7 @@ class FormMail extends Form if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) { $out .= ''; + $out .= ''; // multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time $tmparray = $this->withtoccuser; @@ -889,7 +889,7 @@ class FormMail extends Form //input prompt AI require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - if (isModEnabled('ai')) { + if (isModEnabled('ai') && getDolGlobalConst('AI_CHATGPT_API_KEY')) { $out .= $this->getHtmlForInstruction(); } // Message diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 65693dae709..482a757cc38 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12826,7 +12826,11 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; - $force_filter_contact = false; + if (get_class($filterobj) !== 'User') { + $force_filter_contact = false; + } else { + $force_filter_contact = true; + } if (is_object($objcon) && $objcon->id > 0) { $force_filter_contact = true; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; @@ -12891,6 +12895,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n $sql .= " AND a.fk_element = ".((int) $filterobj->id); } } + } else { + $sql .= " AND u.rowid = ". ((int) $filterobj->id); } // Condition on actioncode @@ -13080,8 +13086,10 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } else { $out .= ''; } - if ($filterobj && get_class($filterobj) == 'Societe') { + if (($filterobj && get_class($filterobj) == 'Societe')) { $out .= ''; + } else { + $out .= ''; } $out .= "\n"; @@ -13139,6 +13147,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n if (get_class($filterobj) == 'Societe') { $tmp .= ''; } + if (get_class($filterobj) == 'User') { + $tmp .= ''; + } $tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : ''); $tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : ''); $tmp .= ($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : ''); @@ -13146,6 +13157,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n if (get_class($filterobj) == 'Societe') { $tmp .= ''; } + if (get_class($filterobj) == 'User') { + $tmp .= ''; + } $out .= getTitleFieldOfList($tmp); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 4d2c36a0fb5..40e8c0178ec 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1116,7 +1116,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Check if Extrafields is totalizable if (!empty($extrafields->attributes['projet_task']['totalizable'])) { foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) { - if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) { + if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['efpt.'.$key]['checked'] == 1) { print '
'.$langs->trans("Tag").''; - print ' '; + print $formproduct->selectWorkstations('', 'idworkstations', 1); print '
'; $out .= $langs->trans("MailToCCUsers"); - $out .= ''; if ($value == 1) { print empty($totalarray['totalizable'][$key]['total']) ? '' : $totalarray['totalizable'][$key]['total']; diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php index 5919c1d9162..b56f62538b0 100644 --- a/htdocs/core/modules/modExternalSite.class.php +++ b/htdocs/core/modules/modExternalSite.class.php @@ -94,6 +94,10 @@ class modExternalSite extends DolibarrModules $this->rights_class = 'externalsite'; // Permission key $this->rights = array(); // Permission array used by this module + $this->module_parts = array( + 'moduleforexternal' => 1 // allow access to external users + ); + // Menus //------ $r = 0; @@ -110,7 +114,7 @@ class modExternalSite extends DolibarrModules 'perms'=>'', 'enabled'=>'$conf->externalsite->enabled', 'target'=>'', - 'user'=>0 + 'user'=>2 ); $r++; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c3647f5f316..0441eee03f4 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -692,6 +692,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { jQuery("#price_ttc").val(''); jQuery("#multicurrency_subprice").val(''); + jQuery("#multicurrency_price_ht").val(''); } }); jQuery("#price_ttc").keyup(function(event) { @@ -699,11 +700,19 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { jQuery("#price_ht").val(''); jQuery("#multicurrency_subprice").val(''); + jQuery("#multicurrency_price_ht").val(''); } }); jQuery("#multicurrency_subprice").keyup(function(event) { // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_subprice").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#price_ttc").val(''); + } + }); + jQuery("#multicurrency_price_ht").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_price_ht").val() != '') { jQuery("#price_ht").val(''); jQuery("#price_ttc").val(''); } diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index e82ea5da72d..ff496ac9673 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -301,8 +301,9 @@ if (!$found) { // There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT). $tmp = $dolibarr_main_url_root; } else { - $tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : ''); + $tmp = 'http'.((!isHTTPS() && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : ''); } + //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n"; if (!empty($dolibarr_main_force_https)) { $tmp = preg_replace('/^http:/i', 'https:', $tmp); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b0fd9dfe7d6..01ddb66dc6e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1791,7 +1791,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_devise = price2num($price_devise, 'CU'); + $pu_devise = price2num($price_ht_devise, 'CU'); $result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier); } diff --git a/htdocs/langs/am_ET/main.lang b/htdocs/langs/am_ET/main.lang index 9873e25a288..fa36fedbc52 100644 --- a/htdocs/langs/am_ET/main.lang +++ b/htdocs/langs/am_ET/main.lang @@ -9,26 +9,26 @@ DIRECTION=ltr # cid0kr is for Korean # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ -# freeserif is for Tamil -FONTFORPDF=ሄልቬቲካ +# freeserif is for Tamil and Ethiopian +FONTFORPDF=freeserif FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, FormatDateShort=%m/%d/%Y FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=ወወ/ቀን/ዓዓ -FormatDateShortJavaInput=ወወ/ቀን/ዓዓ -FormatDateShortJQuery=ሚሜ/ቀን/ዓ -FormatDateShortJQueryInput=ሚሜ/ቀን/ዓ +FormatDateShortJava=MM/dd/yyyy +FormatDateShortJavaInput=MM/dd/yyyy +FormatDateShortJQuery=mm/dd/yy +FormatDateShortJQueryInput=mm/dd/yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p -FormatHourShortDuration=%H፡%M -FormatDateTextShort=%b %d፣ %Y -FormatDateText=%B %d፣ %Y +FormatHourShortDuration=%H:%M +FormatDateTextShort=%b %d, %Y +FormatDateText=%B %d, %Y FormatDateHourShort=%m/%d/%Y %I:%M %p FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p -FormatDateHourTextShort=%b %d፣ %Y፣ %I:%M %p -FormatDateHourText=%B %d፣ %Y፣ %I:%M %p +FormatDateHourTextShort=%b %d, %Y, %I:%M %p +FormatDateHourText=%B %d, %Y, %I:%M %p DatabaseConnection=የውሂብ ጎታ ግንኙነት NoTemplateDefined=ለዚህ ኢሜይል አይነት ምንም አብነት የለም። AvailableVariables=የሚገኙ ተለዋዋጮች diff --git a/htdocs/langs/az_AZ/main.lang b/htdocs/langs/az_AZ/main.lang index 0f6a25d0396..fcfa356511c 100644 --- a/htdocs/langs/az_AZ/main.lang +++ b/htdocs/langs/az_AZ/main.lang @@ -10,16 +10,16 @@ DIRECTION=ltr # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ # freeserif is for Tamil -FONTFORPDF=helvetica +FONTFORPDF=DejaVuSans FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, FormatDateShort=%m/%d/%Y FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=AA/gg/yyyy -FormatDateShortJavaInput=AA/gg/yyyy -FormatDateShortJQuery=mm/gg/yy -FormatDateShortJQueryInput=mm/gg/yy +FormatDateShortJava=MM/dd/yyyy +FormatDateShortJavaInput=MM/dd/yyyy +FormatDateShortJQuery=MM/dd/yy +FormatDateShortJQueryInput=MM/dd/yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M diff --git a/htdocs/langs/bn_BD/main.lang b/htdocs/langs/bn_BD/main.lang index 61fe55edd1a..f3db4028e10 100644 --- a/htdocs/langs/bn_BD/main.lang +++ b/htdocs/langs/bn_BD/main.lang @@ -1,5 +1,5 @@ # Dolibarr language file - Source file is en_US - main -DIRECTION=লিটার +DIRECTION=ltr # Default for FONTFORPDF=helvetica # Note for Chinese: # msungstdlight or cid0ct are for traditional Chinese zh_TW (traditional does not render with Ubuntu pdf reader) @@ -10,7 +10,7 @@ DIRECTION=লিটার # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ # freeserif is for Tamil -FONTFORPDF=হেলভেটিকা +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b091624d215..cb2f8bedde5 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -9,7 +9,7 @@ DIRECTION=ltr # cid0kr is for Korean # DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages # freemono is for ru_RU or uk_UA, uz_UZ -# freeserif is for Tamil +# freeserif is for Tamil or Ethiopian FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 33a549c7e18..5b995486664 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -456,7 +456,7 @@ if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->bro // Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url') // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off' -if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && !defined('NOHTTPSREDIRECT')) { +if (!empty($conf->file->main_force_https) && isHTTPS() && !defined('NOHTTPSREDIRECT')) { $newurl = ''; if (is_numeric($conf->file->main_force_https)) { if ($conf->file->main_force_https == '1' && !empty($_SERVER["SCRIPT_URI"])) { // If SCRIPT_URI supported by server @@ -2213,17 +2213,18 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { + $key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key); if (in_array($key, array('action', 'massaction', 'password'))) { continue; } if (!is_array($value)) { if ($value !== '') { - $qs .= '&'.$key.'='.urlencode($value); + $qs .= '&'.urlencode($key).'='.urlencode($value); } } else { foreach ($value as $value2) { if (($value2 !== '') && (!is_array($value2))) { - $qs .= '&'.$key.'[]='.urlencode($value2); + $qs .= '&'.urlencode($key).'[]='.urlencode($value2); } } } diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 7ced7fd6c6f..9bb5d54cfa5 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -107,6 +107,12 @@ if (!($result > 0)) { } $user->getrights(); +$hookmanager->initHooks(array('cli')); + + +/* + * Main + */ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; if (!isset($argv[1])) { // Check parameters diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index cbf0c406139..a67f3b2edbe 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -68,7 +68,7 @@ class FormProduct * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @param boolean $sumStock sum total stock of a warehouse, default true * @param array $exclude warehouses ids to exclude - * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock + * @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by * @return int Nb of loaded lines, 0 if already loaded, <0 if KO * @throws Exception @@ -276,7 +276,7 @@ class FormProduct * @param string $morecss Add more css classes to HTML select * @param array $exclude Warehouses ids to exclude * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse - * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock + * @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by * @param int $multiselect 1=Allow multiselect * @return string HTML select diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 15763089bcf..3e0d45f75f4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5924,7 +5924,6 @@ class Product extends CommonObject $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); } - $hookmanager->initHooks(array('productdao')); $parameters = array('id'=>$this->id, 'includedraftpoforvirtual' => $includedraftpoforvirtual); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('loadvirtualstock', $parameters, $this, $action); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index df69727b960..a7a44ed2861 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -504,8 +504,11 @@ if (empty($reshook)) { $newobject->fetch_optionals(); $newobject->fetch_thirdparty(); // Load new object $object = $newobject; - $action = 'edit'; + $action = 'view'; $comefromclone = true; + + setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs'); + //var_dump($newobject); exit; } } diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index fc687add5ea..f7b468653ed 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -93,9 +93,9 @@ class SalariesStats extends Stats /** * Return the number of salary by month, for a given year * - * @param string $year Year to scan + * @param int $year Year to scan * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array of values + * @return array Array of values by month */ public function getNbByMonth($year, $format = 0) { diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 62219b6d990..04ca7bad2c8 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -45,7 +45,7 @@ class SocieteAccount extends CommonObject public $table_element = 'societe_account'; /** - * @var array Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + * @var int Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 924a5779ec4..5d7eb3e52fd 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -175,15 +175,15 @@ if (empty($reshook)) { $error = 0; if (getDolGlobalString('TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT')) { - $bankaccount = GETPOST('accountid', 'int'); + $bankaccount = GETPOSTINT('accountid'); } else { if ($pay == 'LIQ') { - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility + $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility } elseif ($pay == "CHQ") { - $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility + $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; - $bankaccount = getDolGlobalString($accountname); + $bankaccount = getDolGlobalInt($accountname); } } @@ -488,7 +488,7 @@ if (empty($reshook)) { // If we add a line and no invoice yet, we create the invoice if (($action == "addline" || $action == "freezone") && $placeid == 0 && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { - $invoice->socid = getDolGlobalString($constforcompanyid); + $invoice->socid = getDolGlobalInt($constforcompanyid); $invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved. $invoice->module_source = 'takepos'; $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 8cfdcdf20d0..436b2d363f9 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -172,7 +172,7 @@ if ((!empty($objUser->id) || !empty($objcon->id)) && $permok) { $morehtmlright = ''; -$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?userid='.$object->id; +$messagingUrl = DOL_URL_ROOT.'/user/messaging.php?userid='.$object->id; $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); $messagingUrl = DOL_URL_ROOT.'/user/info.php?id='.$object->id; $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php new file mode 100644 index 00000000000..372616a4cb4 --- /dev/null +++ b/htdocs/user/messaging.php @@ -0,0 +1,230 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006-2019 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/societe/messaging.php + * \ingroup societe + * \brief Page of third party events + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); + +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useragenda'; + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); +} + +$search_rowid = GETPOST('search_rowid'); +$search_agenda_label = GETPOST('search_agenda_label'); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'a.datep,a.id'; +} +if (!$sortorder) { + $sortorder = 'DESC,DESC'; +} + +// Initialize technical objects +$object = new User($db); +if ($id > 0 || !empty($ref)) { + $result = $object->fetch($id, $ref, '', 1); + $object->getrights(); +} + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('agendathirdparty', 'globalcard')); + +// Security check +$userid = GETPOST('userid', 'int'); +if ($user->id) { + $userId = $user->id; +} + +$result = $object->fetch($userid); +if ($result <= 0) { + accessforbidden('User not found'); +} + +$result = restrictedArea($user, 'user', $userId, '&user'); + + + +/* + * Actions + */ + +$parameters = array('id'=>$socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; + } +} + + +/* + * View + */ + +$form = new Form($db); + +$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; +$title = $person_name." - ".$langs->trans('Info'); +$help_url = ''; +llxHeader('', $title, $help_url); + +$head = user_prepare_head($object); + +$title = $langs->trans("User"); +print dol_get_fiche_head($head, 'info', $title, -1, 'user'); + + +$linkback = ''; + +if ($user->hasRight('user', 'user', 'lire') || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} + +$morehtmlref = ''; +$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); +$morehtmlref .= ''; + +$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id); +$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover'); + +dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref); + + +$object->info($userid); + + +print '
'; +print '
'; + +print '
'; + +dol_print_object_info($object); + +print '
'; + + +print dol_get_fiche_end(); + +$objUser = $object; +$objcon = new stdClass(); + +$out = ''; +$permok = $user->hasRight('agenda', 'myactions', 'create'); +if ((!empty($objUser->id) || !empty($objcon->id)) && $permok) { + if (is_object($objUser) && get_class($objUser) == 'User') { + $out .= '&originid='.$objUser->id.($objUser->id > 0 ? '&userid='.$objUser->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objUser->id > 0 ? '?userid='.$objUser->id : '')); + } + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); +} + +$morehtmlright = ''; + +$messagingUrl = DOL_URL_ROOT.'/user/messaging.php?userid='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); +$messagingUrl = DOL_URL_ROOT.'/user/info.php?id='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + +if (isModEnabled('agenda')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } +} + +if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) { + print '
'; + $param = '&userid='.urlencode($userid); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); + } + + + // Try to know count of actioncomm from cache + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_user_'.$object->id; + $nbEvent = dol_getcache($cachekey); + + $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); + if (!empty($conf->dol_optimize_smallscreen)) { + $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); + } + + print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; + + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); +} + + //End of page + llxFooter(); + $db->close(); diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index b16afb3b037..3e09e5362a5 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -1304,8 +1304,8 @@ class ProductAttribute extends CommonObject * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * * @param string $action Action code - * @param string $seller Object of seller third party - * @param string $buyer Object of buyer third party + * @param Societe $seller Object of seller third party + * @param Societe $buyer Object of buyer third party * @param int $selected Object line selected * @param int $dateSelector 1=Show also date range input fields * @param string $defaulttpldir Directory where to find the template diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 522bc5680a9..87cd5a4cffa 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -56,6 +56,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index 7d31bb0f79d..0ea0bb77119 100755 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -48,6 +48,9 @@ $version = DOL_VERSION; $error = 0; $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 24f1529d341..9f6364b4f46 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -61,6 +61,9 @@ $langs->loadLangs(array('main', 'contracts')); $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 43c46c8a1b4..282d348e184 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -59,6 +59,9 @@ $langs->loadLangs(array('main', 'contracts')); $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/doc/regenerate_docs.php b/scripts/doc/regenerate_docs.php index 34e732d9827..192b473f0f3 100755 --- a/scripts/doc/regenerate_docs.php +++ b/scripts/doc/regenerate_docs.php @@ -56,6 +56,13 @@ $version = DOL_VERSION; $error = 0; $forcecommit = 0; +$hookmanager->initHooks(array('cli')); + + +/* + * Main + */ + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - dir=".DOL_DATA_ROOT." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 77871ecbf0b..2b55389be41 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -25,6 +25,7 @@ * \ingroup mailing * \brief Script to send a prepared and validated emaling from command line */ + if (!defined('NOSESSION')) { define('NOSESSION', '1'); } @@ -78,6 +79,8 @@ if (!isModEnabled('mailing')) { exit(-1); } +$hookmanager->initHooks(array('cli')); + /* * Main diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index ca383143c3a..45abb45715d 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -62,6 +62,8 @@ if (!isModEnabled('mailing')) { exit(-1); } +$hookmanager->initHooks(array('cli')); + /* * Main diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 2a5a199db4d..ea544538b07 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -61,6 +61,9 @@ $langs->load('main'); $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index e5da2436d67..48f399fed57 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -59,6 +59,9 @@ $langs->load('main'); $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 1d513151d96..0c1545cf309 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -52,6 +52,8 @@ $langs->load("main"); $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + /* * Main diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index 705ffb17852..d21bf34710d 100755 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -49,6 +49,9 @@ $version = constant('DOL_VERSION'); $error = 0; $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index ea183191086..53c0d945e63 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -52,6 +52,9 @@ $error = 0; $forcecommit = 0; $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/members/sync_members_types_dolibarr2ldap.php b/scripts/members/sync_members_types_dolibarr2ldap.php index 8c118fbcc5b..356ac35f0ee 100755 --- a/scripts/members/sync_members_types_dolibarr2ldap.php +++ b/scripts/members/sync_members_types_dolibarr2ldap.php @@ -54,6 +54,9 @@ require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"; $version = constant('DOL_VERSION'); $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/members/sync_members_types_ldap2dolibarr.php b/scripts/members/sync_members_types_ldap2dolibarr.php index 0ef44facabb..fe62ce536fd 100755 --- a/scripts/members/sync_members_types_ldap2dolibarr.php +++ b/scripts/members/sync_members_types_ldap2dolibarr.php @@ -53,6 +53,9 @@ $error = 0; $forcecommit = 0; $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/product/migrate_picture_path.php b/scripts/product/migrate_picture_path.php index 2f5a772fe8e..1bc036710d9 100755 --- a/scripts/product/migrate_picture_path.php +++ b/scripts/product/migrate_picture_path.php @@ -56,6 +56,13 @@ $version = DOL_VERSION; $error = 0; $forcecommit = 0; +$hookmanager->initHooks(array('cli')); + + +/* + * Main + */ + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); diff --git a/scripts/product/regenerate_thumbs.php b/scripts/product/regenerate_thumbs.php index b81e93c053e..56ac6266e0b 100755 --- a/scripts/product/regenerate_thumbs.php +++ b/scripts/product/regenerate_thumbs.php @@ -56,6 +56,12 @@ $version = DOL_VERSION; $error = 0; $forcecommit = 0; +$hookmanager->initHooks(array('cli')); + +/* + * Main + */ + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); diff --git a/scripts/user/migrate_picture_path.php b/scripts/user/migrate_picture_path.php index d64c843767f..e4df16b9801 100755 --- a/scripts/user/migrate_picture_path.php +++ b/scripts/user/migrate_picture_path.php @@ -56,6 +56,13 @@ $version = DOL_VERSION; $error = 0; $forcecommit = 0; +$hookmanager->initHooks(array('cli')); + + +/* + * Main + */ + print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 4dbdf3ae5eb..e64b2ff5130 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -52,6 +52,9 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 7712e688e7c..ed994cdd4f3 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -53,6 +53,9 @@ $error = 0; $forcecommit = 0; $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 4241d56ba5a..df49b035a69 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -52,6 +52,9 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; $version = DOL_VERSION; $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 145a8a7e41c..98800b07a97 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -52,6 +52,9 @@ $forcecommit = 0; $excludeuser = array(); $confirmed = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */ diff --git a/scripts/website/migrate-news-joomla2dolibarr.php b/scripts/website/migrate-news-joomla2dolibarr.php index f07e52c71d9..fbfd77a5230 100755 --- a/scripts/website/migrate-news-joomla2dolibarr.php +++ b/scripts/website/migrate-news-joomla2dolibarr.php @@ -63,6 +63,8 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; +$hookmanager->initHooks(array('cli')); + /* * Main diff --git a/scripts/website/regenerate-pages.php b/scripts/website/regenerate-pages.php index 8e4b1279532..7329d4d1ba3 100755 --- a/scripts/website/regenerate-pages.php +++ b/scripts/website/regenerate-pages.php @@ -58,6 +58,8 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; +$hookmanager->initHooks(array('cli')); + /* * Main diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index e6b99c51369..66d2cc52689 100755 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -47,6 +47,9 @@ require_once DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"; $version = constant('DOL_VERSION'); $error = 0; +$hookmanager->initHooks(array('cli')); + + /* * Main */