From 335b0aebb519e7f6cacefb61998ead4f54aea4ba Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 2 Feb 2021 10:17:22 +0100 Subject: [PATCH 01/25] NEW: Stock movement list - Add more complete date field --- htdocs/product/stock/movement_list.php | 46 ++++++++++++++------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 6ab8a99ac76..9da798f3209 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -66,8 +66,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $result = restrictedArea($user, 'stock'); $idproduct = GETPOST('idproduct', 'int'); -$year = GETPOST("year"); -$month = GETPOST("month"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_ref = GETPOST('search_ref', 'alpha'); $search_movement = GETPOST("search_movement"); $search_product_ref = trim(GETPOST("search_product_ref")); @@ -162,8 +162,8 @@ if (empty($reshook)) // Do we click on purge search criteria ? if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { - $year = ''; - $month = ''; + $search_date_start = ''; + $search_date_end = ''; $search_ref = ''; $search_movement = ""; $search_type_mouvement = ""; @@ -482,17 +482,18 @@ $sql .= " AND m.fk_entrepot = e.rowid"; $sql .= " AND e.entity IN (".getEntity('stock').")"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0"; if ($id > 0) $sql .= " AND e.rowid ='".$id."'"; -$sql .= dolSqlDateFilter('m.datem', 0, $month, $year); +if (!empty($search_date_start)) $sql .= " AND m.datem >= '" . $db->idate($search_date_start) . "'"; +if (!empty($search_date_end)) $sql .= " AND m.datem <= '" . $db->idate($search_date_end) . "'"; if ($idproduct > 0) $sql .= " AND p.rowid = ".((int) $idproduct); if (!empty($search_ref)) $sql .= natural_search('m.rowid', $search_ref, 1); -if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement); -if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode); -if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref); -if (!empty($search_product)) $sql .= natural_search('p.label', $search_product); +if (!empty($search_movement)) $sql .= natural_search('m.label', $search_movement); +if (!empty($search_inventorycode)) $sql .= natural_search('m.inventorycode', $search_inventorycode); +if (!empty($search_product_ref)) $sql .= natural_search('p.ref', $search_product_ref); +if (!empty($search_product)) $sql .= natural_search('p.label', $search_product); if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('e.rowid', $search_warehouse, 2); -if (!empty($search_user)) $sql .= natural_search('u.login', $search_user); -if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch); -if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id); +if (!empty($search_user)) $sql .= natural_search('u.login', $search_user); +if (!empty($search_batch)) $sql .= natural_search('m.batch', $search_batch); +if (!empty($product_id)) $sql .= natural_search('p.rowid', $product_id); if ($search_qty != '') $sql .= natural_search('m.value', $search_qty, 1); if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql .= natural_search('m.type_mouvement', $search_type_mouvement, 2); // Add where from extra fields @@ -711,6 +712,8 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($id > 0) $param .= '&id='.urlencode($id); + if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); if ($search_movement) $param .= '&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode); if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement); @@ -789,16 +792,17 @@ if ($resql) print ''; print ''; } - if (!empty($arrayfields['m.datem']['checked'])) + if (! empty($arrayfields['m.datem']['checked'])) { - // Date - print ''; - print ''; - if (empty($conf->productbatch->enabled)) print ' '; - //else print '
'; - $syear = $year ? $year : -1; - print ''; - //print $formother->selectyear($syear,'year',1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } if (!empty($arrayfields['p.ref']['checked'])) From c0354c5e93902e07893a10415d3bd84cfc01ab37 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Feb 2021 12:07:09 +0100 Subject: [PATCH 02/25] NEW Bank Entries : display user linked to salary and social taxes --- htdocs/compta/bank/bankentries_list.php | 44 ++++++++++++++++--------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 7d059734126..bf307fd0bb8 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -373,6 +373,7 @@ $formaccounting = new FormAccounting($db); $companystatic = new Societe($db); $bankaccountstatic = new Account($db); +$userstatic= new User($db); $banktransferstatic = new BonPrelevement($db); $societestatic = new Societe($db); @@ -477,8 +478,9 @@ else $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; $sql .= " b.fk_account, b.fk_type,"; $sql .= " ba.rowid as bankid, ba.ref as bankref,"; -$sql .= " bu.url_id,"; -$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; +$sql .= " bu.url_id, bu.type as type_url,"; +$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; +$sql .= " u.lastname as user_lastname, u.firstname as user_firstname, u.email as user_email, u.statut as user_statut"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); @@ -492,8 +494,9 @@ if ($search_bid > 0) $sql .= MAIN_DB_PREFIX."bank_class as l,"; $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql .= " ".MAIN_DB_PREFIX."bank as b"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND (type = 'company' OR type = 'user')"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid AND bu.type = 'company'"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON bu.url_id = u.rowid AND bu.type = 'user'"; $sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")"; if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account; @@ -1381,20 +1384,29 @@ if ($resql) // Third party if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; if ($objp->url_id) { - $companystatic->id = $objp->url_id; - $companystatic->name = $objp->nom; - $companystatic->name_alias = $objp->name_alias; - $companystatic->client = $objp->client; - $companystatic->email = $objp->email; - $companystatic->fournisseur = $objp->fournisseur; - $companystatic->code_client = $objp->code_client; - $companystatic->code_fournisseur = $objp->code_fournisseur; - $companystatic->code_compta = $objp->code_compta; - $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; - print $companystatic->getNomUrl(1); + if($objp->type_url == 'company') { + $companystatic->id = $objp->url_id; + $companystatic->name = $objp->nom; + $companystatic->name_alias = $objp->name_alias; + $companystatic->client = $objp->client; + $companystatic->email = $objp->email; + $companystatic->fournisseur = $objp->fournisseur; + $companystatic->code_client = $objp->code_client; + $companystatic->code_fournisseur = $objp->code_fournisseur; + $companystatic->code_compta = $objp->code_compta; + $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + print $companystatic->getNomUrl(1); + } elseif ($objp->type_url == 'user') { + $userstatic->id = $objp->url_id; + $userstatic->firstname = $objp->user_firstname; + $userstatic->name = $objp->user_lastname; + $userstatic->email = $objp->user_email; + $userstatic->statut = $objp->user_statut; + print $userstatic->getNomUrl(1); + } } else { From 64ab2fa3b1878df9e9656b38f31326d4c3b48015 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Feb 2021 12:19:50 +0100 Subject: [PATCH 03/25] Bank Entries : add user search --- htdocs/compta/bank/bankentries_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index bf307fd0bb8..c10d0d05238 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -88,7 +88,7 @@ $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), G $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int')); $search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int')); $search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int')); -$search_thirdparty = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha'); +$search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha'); $search_req_nb = GETPOST("req_nb", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_conciliated = GETPOST("search_conciliated", 'int'); @@ -145,7 +145,7 @@ $arrayfields = array( 'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1), 'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1), 'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1), - 'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500), + 'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500), 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000), 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), @@ -194,7 +194,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_ref = ""; $search_req_nb = ''; $search_description = ''; - $search_thirdparty = ''; + $search_thirdparty_user = ''; $search_num_releve = ''; $search_conciliated = ''; $thirdparty = ''; @@ -262,7 +262,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' $param .= '&search_conciliated='.urlencode($search_conciliated); if ($page) $param .= '&page='.urlencode($page); if ($offset) $param .= '&offset='.urlencode($offset); - if ($search_thirdparty) $param .= '&search_thirdparty='.urlencode($search_thirdparty); + if ($search_thirdparty_user) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user); if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve); if ($search_description) $param .= '&search_description='.urlencode($search_description); if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt); @@ -403,7 +403,7 @@ if (!empty($ref)) $param .= '&ref='.urlencode($ref); if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref); if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description); if (!empty($search_type)) $param .= '&type='.urlencode($search_type); -if (!empty($search_thirdparty)) $param .= '&search_thirdparty='.urlencode($search_thirdparty); +if (!empty($search_thirdparty_user)) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user); if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit); if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit); if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account); @@ -510,7 +510,7 @@ if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1); if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve); if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".$search_conciliated; -if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty); +if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user); if ($search_description) { $search_description_to_use = $search_description; @@ -585,7 +585,7 @@ if (!empty($search_description)) $mode_balance_ok = false; if (!empty($search_type)) $mode_balance_ok = false; if (!empty($search_debit)) $mode_balance_ok = false; if (!empty($search_credit)) $mode_balance_ok = false; -if (!empty($search_thirdparty)) $mode_balance_ok = false; +if (!empty($search_thirdparty_user)) $mode_balance_ok = false; if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false; if (!empty($search_num_releve)) $mode_balance_ok = false; @@ -917,7 +917,7 @@ if ($resql) } if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['ba.ref']['checked'])) { From 6077880b0fd84cd35f6a1dcbb330db1a328b639a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 10 Feb 2021 15:25:27 +0100 Subject: [PATCH 04/25] Close #16248 : new column in Stock to date --- htdocs/product/stock/stockatdate.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 91159984a35..86f569d91c9 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -243,7 +243,8 @@ $title = $langs->trans('StockAtDate'); $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; -$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock'; +$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; +$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; if ($fk_warehouse > 0) { $sql .= ', SUM(ps.reel) as stock_reel'; } @@ -401,6 +402,8 @@ print ''; print ''; print ''; +print ''; +print ''; if ($mode == 'future') { print ''; } @@ -424,6 +427,9 @@ if ($fk_warehouse > 0) { print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if ($mode == 'future') { print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"]); @@ -516,6 +522,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST print ''; + // PMP value + print ''; + if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); + else print ''; + print ''; + + // Selling value + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); + else { + $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print''; + if ($mode == 'future') { // Current stock print ''.$currentstock.''; @@ -560,7 +581,7 @@ $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // N print $hookmanager->resPrint; if (empty($date) || ! $dateIsValid) { - $colspan = 6; + $colspan = 8; if ($mode == 'future') $colspan++; print ''.$langs->trans("EnterADateCriteria").''; } From 8f8f5058ded05ee8c7c87b82ce3a8f3fc91c8ff0 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Feb 2021 16:04:29 +0100 Subject: [PATCH 05/25] Add link 'user' in bank_url for payment_sc --- .../class/paymentsocialcontribution.class.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index c771a664d5f..3814a016b0c 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -514,7 +514,7 @@ class PaymentSocialContribution extends CommonObject */ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { - global $conf; + global $conf, $langs; // Clean data $this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement); @@ -578,6 +578,24 @@ class PaymentSocialContribution extends CommonObject $socialcontrib->fetch($key); $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc'); if ($result <= 0) dol_print_error($this->db); + + $fuser = new User($this->db); + $fuser->fetch($socialcontrib->fk_user); + + // Add link 'user' in bank_url between operation and bank transaction + $result = $acc->add_url_line( + $bank_line_id, + $socialcontrib->fk_user, + DOL_URL_ROOT.'/user/card.php?id=', + $fuser->getFullName($langs), + 'user' + ); + + if ($result <= 0) + { + $this->error = $acc->error; + $error++; + } } } } From 3aef987f3fd26b935738ed14e92e9397719c8663 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Feb 2021 16:24:45 +0100 Subject: [PATCH 06/25] Display or not users in terms of user rights --- htdocs/compta/bank/bankentries_list.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index c10d0d05238..aadc0d01d80 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1384,6 +1384,12 @@ if ($resql) // Third party if (!empty($arrayfields['bu.label']['checked'])) { + //payment line type to define user display + foreach($links as $key=>$value){ + if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; + if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; + } + print ''; if ($objp->url_id) { @@ -1399,7 +1405,10 @@ if ($resql) $companystatic->code_compta = $objp->code_compta; $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; print $companystatic->getNomUrl(1); - } elseif ($objp->type_url == 'user') { + } elseif ($objp->type_url == 'user' && + (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) + || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire))) + ) { $userstatic->id = $objp->url_id; $userstatic->firstname = $objp->user_firstname; $userstatic->name = $objp->user_lastname; From 2e14b9832d34fa98bbc43a85ca77af07eda341c3 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Feb 2021 17:00:50 +0100 Subject: [PATCH 07/25] Clean code --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index aadc0d01d80..7fa2032cd3d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1010,6 +1010,7 @@ if ($resql) while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $links = $bankaccountstatic->get_url($objp->rowid); // If we are in a situation where we need/can show balance, we calculate the start of balance if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && $mode_balance_ok) @@ -1200,7 +1201,6 @@ if ($resql) //print " "; // Add links after description - $links = $bankaccountstatic->get_url($objp->rowid); $cachebankaccount = array(); foreach ($links as $key=>$val) { From 7fbf0b56d5dbba944a6f449f855170136e7d16d5 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 11 Feb 2021 11:13:12 +0100 Subject: [PATCH 08/25] NEW Bank Entries : add verif fk_user addPaymentToBank Social Contribution --- .../class/paymentsocialcontribution.class.php | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 3814a016b0c..7083740ae41 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -579,22 +579,23 @@ class PaymentSocialContribution extends CommonObject $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc'); if ($result <= 0) dol_print_error($this->db); - $fuser = new User($this->db); - $fuser->fetch($socialcontrib->fk_user); + if($socialcontrib->fk_user) { + $fuser = new User($this->db); + $fuser->fetch($socialcontrib->fk_user); - // Add link 'user' in bank_url between operation and bank transaction - $result = $acc->add_url_line( - $bank_line_id, - $socialcontrib->fk_user, - DOL_URL_ROOT.'/user/card.php?id=', - $fuser->getFullName($langs), - 'user' - ); + // Add link 'user' in bank_url between operation and bank transaction + $result = $acc->add_url_line( + $bank_line_id, + $socialcontrib->fk_user, + DOL_URL_ROOT . '/user/card.php?id=', + $fuser->getFullName($langs), + 'user' + ); - if ($result <= 0) - { - $this->error = $acc->error; - $error++; + if ($result <= 0) { + $this->error = $acc->error; + $error++; + } } } } From 84e17753ebb03a79e33c629c455f0cdacc3a4f94 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 11 Feb 2021 10:35:15 +0000 Subject: [PATCH 09/25] Fixing style errors. --- htdocs/compta/bank/bankentries_list.php | 11 +++++------ .../class/paymentsocialcontribution.class.php | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 5eef36d1692..da09b807b6f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1376,15 +1376,15 @@ if ($resql) if (!empty($arrayfields['bu.label']['checked'])) { //payment line type to define user display - foreach($links as $key=>$value){ - if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; - if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; + foreach ($links as $key=>$value){ + if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; + if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; } print ''; if ($objp->url_id) { - if($objp->type_url == 'company') { + if ($objp->type_url == 'company') { $companystatic->id = $objp->url_id; $companystatic->name = $objp->nom; $companystatic->name_alias = $objp->name_alias; @@ -1408,8 +1408,7 @@ if ($resql) print $userstatic->getNomUrl(1); } } - else - { + else { print ' '; } print ''; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index f70d23aaaec..c4999c0765f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -568,7 +568,7 @@ class PaymentSocialContribution extends CommonObject $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc'); if ($result <= 0) dol_print_error($this->db); - if($socialcontrib->fk_user) { + if ($socialcontrib->fk_user) { $fuser = new User($this->db); $fuser->fetch($socialcontrib->fk_user); From 3b5e6b11404931ced193c00e858ea869e618f8a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2021 18:45:06 +0100 Subject: [PATCH 10/25] Update bankentries_list.php --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index da09b807b6f..550fa9c0ea0 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -514,7 +514,7 @@ if (dol_strlen($search_dv_end) > 0) $sql .= " AND b.datev <= '".$db->idate($sear if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1); if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve); -if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".$search_conciliated; +if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated); if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user); if ($search_description) { From fa72021ca89510deddd3faa65a16ba3ccc5ca0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 12 Feb 2021 08:49:29 +0100 Subject: [PATCH 11/25] doxygen --- htdocs/cron/class/cronjob.class.php | 90 ++++++++++++++++++++++++++--- htdocs/modulebuilder/index.php | 6 +- 2 files changed, 84 insertions(+), 12 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 9d084ec4f24..d41d055b996 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -50,8 +50,19 @@ class Cronjob extends CommonObject */ public $entity; + /** + * @var string Job type + */ public $jobtype; + + /** + * @var string|int Date for last cron object update + */ public $tms = ''; + + /** + * @var string|int Date for cron job create + */ public $datec = ''; /** @@ -59,6 +70,9 @@ class Cronjob extends CommonObject */ public $label; + /** + * @var string Job command + */ public $command; public $classesname; public $objectname; @@ -67,20 +81,50 @@ class Cronjob extends CommonObject public $md5params; public $module_name; public $priority; + /** * @var string|int Date for last job execution */ public $datelastrun = ''; + /** * @var string|int Date for next job execution */ public $datenextrun = ''; + + /** + * @var string|int Date for end job execution + */ public $dateend = ''; + + /** + * @var string|int Date for first start job execution + */ public $datestart = ''; + + /** + * @var string|int Date for last result job execution + */ public $datelastresult = ''; + + /** + * @var string Last result from end job execution + */ public $lastresult; + + /** + * @var string Last output from end job execution + */ public $lastoutput; + + /** + * @var string Unit frequency of job execution + */ public $unitfrequency; + + /** + * @var int Frequency of job execution + */ public $frequency; /** @@ -88,6 +132,9 @@ class Cronjob extends CommonObject */ public $status; + /** + * @var int Is job processing + */ public $processing; /** @@ -100,9 +147,25 @@ class Cronjob extends CommonObject */ public $fk_user_mod; + /** + * @var int Number of run job execution + */ public $nbrun; + + /** + * @var int Maximum run job execution + */ + public $maxrun; + + /** + * @var string Libname + */ public $libname; - public $test; // A test condition to know if job is visible/qualified + + /** + * @var string A test condition to know if job is visible/qualified + */ + public $test; const STATUS_DISABLED = 0; const STATUS_ENABLED = 1; @@ -152,7 +215,12 @@ class Cronjob extends CommonObject if (isset($this->frequency)) $this->frequency = trim($this->frequency); if (isset($this->status)) $this->status = trim($this->status); if (isset($this->note_private)) $this->note_private = trim($this->note_private); - if (isset($this->nbrun)) $this->nbrun = trim($this->nbrun); + if (isset($this->nbrun)) { + $this->nbrun = (int) $this->nbrun; + } + if (isset($this->maxrun)) { + $this->maxrun = (int) $this->maxrun; + } if (isset($this->libname)) $this->libname = trim($this->libname); if (isset($this->test)) $this->test = trim($this->test); @@ -262,7 +330,10 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); + } if (!$error) { @@ -1253,8 +1324,7 @@ class Cronjob extends CommonObject } $result = $this->update($user); - if ($result < 0) - { + if ($result < 0) { dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR); return -1; } @@ -1289,14 +1359,16 @@ class Cronjob extends CommonObject $this->labelStatus = array(); // Force reset o array because label depends on other fields $this->labelStatusShort = array(); - if (empty($this->labelStatus) || empty($this->labelStatusShort)) - { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; $langs->load('users'); $moretext = ''; - if ($processing) $moretext = ' ('.$langs->trans("Running").')'; - elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')'; + if ($processing) { + $moretext = ' ('.$langs->trans("Running").')'; + } elseif ($lastresult) { + $moretext .= ' ('.$langs->trans("Error").')'; + } $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Disabled').$moretext; $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Scheduled').$moretext; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 9cbb6ae4167..06d7e5690f1 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1701,8 +1701,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { foreach ($objMod->config_page_url as $page) { $urlpage = $page; - if ($i++) - { + if ($i++) { $linktoenabledisable .= ' '.img_picto(ucfirst($page), "setup").''; // print ''.ucfirst($page).' '; } else { @@ -1711,7 +1710,8 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $linktoenabledisable .= '   '.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; } else { - // Case standard admin page (not a page provided by the module but a page + // Case standard admin page (not a page provided by the + // module but a page provided by dolibarr) $urltouse = DOL_URL_ROOT.'/admin/'.$urlpage; $linktoenabledisable .= '   '.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; } From 1f561668017face427512dfe75b58fe828d1ee63 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 12 Feb 2021 11:05:15 +0100 Subject: [PATCH 12/25] FIX ret : fetch user instead of search with main sql request --- htdocs/compta/bank/bankentries_list.php | 60 ++++++++++++++----------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 7fa2032cd3d..99e6750101d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -373,7 +373,6 @@ $formaccounting = new FormAccounting($db); $companystatic = new Societe($db); $bankaccountstatic = new Account($db); -$userstatic= new User($db); $banktransferstatic = new BonPrelevement($db); $societestatic = new Societe($db); @@ -479,8 +478,7 @@ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappr $sql .= " b.fk_account, b.fk_type,"; $sql .= " ba.rowid as bankid, ba.ref as bankref,"; $sql .= " bu.url_id, bu.type as type_url,"; -$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; -$sql .= " u.lastname as user_lastname, u.firstname as user_firstname, u.email as user_email, u.statut as user_statut"; +$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); @@ -494,9 +492,8 @@ if ($search_bid > 0) $sql .= MAIN_DB_PREFIX."bank_class as l,"; $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql .= " ".MAIN_DB_PREFIX."bank as b"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND (type = 'company' OR type = 'user')"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid AND bu.type = 'company'"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON bu.url_id = u.rowid AND bu.type = 'user'"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; $sql .= " WHERE b.fk_account = ba.rowid"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")"; if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account; @@ -1384,14 +1381,8 @@ if ($resql) // Third party if (!empty($arrayfields['bu.label']['checked'])) { - //payment line type to define user display - foreach($links as $key=>$value){ - if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; - if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; - } - print ''; - if ($objp->url_id) + if ($objp->url_id) //display company { if($objp->type_url == 'company') { $companystatic->id = $objp->url_id; @@ -1405,21 +1396,40 @@ if ($resql) $companystatic->code_compta = $objp->code_compta; $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; print $companystatic->getNomUrl(1); - } elseif ($objp->type_url == 'user' && - (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) - || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire))) - ) { - $userstatic->id = $objp->url_id; - $userstatic->firstname = $objp->user_firstname; - $userstatic->name = $objp->user_lastname; - $userstatic->email = $objp->user_email; - $userstatic->statut = $objp->user_statut; - print $userstatic->getNomUrl(1); } } - else + else //display user or nothing { - print ' '; + //payment line type to define user display + foreach($links as $key=>$value){ + if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; + if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; + } + + $sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND type='user'"; + $resqlu = $db->query($sqlu); + + if($resqlu) { + + if($db->num_rows($resqlu) > 0 && + (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) + || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) { + + $obj = $db->fetch_object($resqlu); + $userstatic->fetch($obj->url_id); + print $userstatic->getNomUrl(1); + + } + + else { + print ' '; + } + + } else + { + dol_print_error($db); + } + } print ''; if (!$i) $totalarray['nbfield']++; From 6f7a223a8de06a6e50695ab82d68b7aff4bf5b4a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 12 Feb 2021 10:17:03 +0000 Subject: [PATCH 13/25] Fixing style errors. --- htdocs/compta/bank/bankentries_list.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 7716f418032..85b9bbbbf26 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1390,38 +1390,32 @@ if ($resql) print $companystatic->getNomUrl(1); } } - else //display user or nothing + else //display user or nothing { //payment line type to define user display - foreach($links as $key=>$value){ - if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; - if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; + foreach ($links as $key=>$value){ + if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; + if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; } $sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND type='user'"; $resqlu = $db->query($sqlu); - if($resqlu) { - - if($db->num_rows($resqlu) > 0 && + if ($resqlu) { + if ($db->num_rows($resqlu) > 0 && (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) { - $obj = $db->fetch_object($resqlu); $userstatic->fetch($obj->url_id); print $userstatic->getNomUrl(1); - } else { print ' '; } - - } else - { + } else { dol_print_error($db); } - } print ''; if (!$i) $totalarray['nbfield']++; From b8fde12def39ddd53e73e09adb8096fb43bb604d Mon Sep 17 00:00:00 2001 From: abb Date: Fri, 12 Feb 2021 17:18:07 +0100 Subject: [PATCH 14/25] Fix : To use restrictedArea Hook, we need to call initHooks before restrictedArea --- htdocs/adherents/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index d2755c9acd8..b33eb3564bf 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -81,6 +81,9 @@ if (!empty($canvas)) { $objcanvas->getCanvas('adherent', 'membercard', $canvas); } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('membercard', 'globalcard')); + // Security check $result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0); @@ -107,9 +110,6 @@ if ($id) { $caneditfieldmember = $user->rights->adherent->creer; } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('membercard', 'globalcard')); - /* From d92e17aabd04805c2d38d6aef05582427b6a6598 Mon Sep 17 00:00:00 2001 From: abb Date: Fri, 12 Feb 2021 19:21:26 +0100 Subject: [PATCH 15/25] new : hook context subscriptioncard and restrictedArea block for subscriptions --- htdocs/adherents/subscription/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 1be08bb5b34..d4396cefb00 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -55,6 +55,10 @@ $permissionnote = $user->rights->adherent->cotisation->creer; // Used by the inc $permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php $permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php +$hookmanager->initHooks(array('subscriptioncard', 'globalcard')); + +// Security check +$result = restrictedArea($user, 'subscription', $id, '', '', 'socid', 'rowid'); /* * Actions From abda9eeb93f0035f3c152a9b22a02e120a05c318 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 14 Feb 2021 00:02:03 +0100 Subject: [PATCH 16/25] Improve compatibility with logo printing with TakePOS connector --- htdocs/core/class/dolreceiptprinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 4dfca1186c0..8091d5debbe 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -825,7 +825,7 @@ class dolReceiptPrinter extends Printer if ($this->printer->connector instanceof DummyPrintConnector || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { $data = $this->printer->connector->getData(); - if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo base64_encode($data); + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo rtrim(strtr(base64_encode($data), '+/', '-_'), '='); dol_syslog($data); } // Close and print From dc91dbabd1e3a1bd650577e2cb1ee511d9288ae5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 14 Feb 2021 07:26:53 +0100 Subject: [PATCH 17/25] Fix tzuserrel --- htdocs/product/stock/movement_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 9da798f3209..37fe102fd73 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -66,8 +66,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $result = restrictedArea($user, 'stock'); $idproduct = GETPOST('idproduct', 'int'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'), 'tzuserrel'); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'), 'tzuserrel'); $search_ref = GETPOST('search_ref', 'alpha'); $search_movement = GETPOST("search_movement"); $search_product_ref = trim(GETPOST("search_product_ref")); @@ -797,11 +797,11 @@ if ($resql) print ''; print '
'; print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '' , 'tzuserrel'); print '
'; print '
'; print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '' , 'tzuserrel'); print '
'; print ''; } From fb7e103d6522c944901b40847c19af974561acc6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 14 Feb 2021 06:29:06 +0000 Subject: [PATCH 18/25] Fixing style errors. --- htdocs/product/stock/movement_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 37fe102fd73..3486eae6c9d 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -797,11 +797,11 @@ if ($resql) print ''; print '
'; print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '' , 'tzuserrel'); + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); print '
'; print '
'; print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '' , 'tzuserrel'); + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); print '
'; print ''; } From 85a450cdd270425f87398c04d66574962f3de462 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 14 Feb 2021 15:02:05 +0100 Subject: [PATCH 19/25] setup page feature --- htdocs/modulebuilder/template/admin/setup.php | 65 +++++++++++++++++-- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index e93b8686d79..72239ff3d1b 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -61,8 +61,11 @@ $scandir = GETPOST('scan_dir', 'alpha'); $type = 'myobject'; $arrayofparameters = array( - 'MYMODULE_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1), - 'MYMODULE_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1) + 'MYMODULE_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1), + 'MYMODULE_MYPARAM2'=>array('type'=>'textarea','enabled'=>1), + //'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), + //'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), + //'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1), ); $error = 0; @@ -208,11 +211,59 @@ if ($action == 'edit') { print ''; print ''; - foreach ($arrayofparameters as $key => $val) { - print ''; + foreach ($arrayofparameters as $constname => $val) { + if ($val['enabled']==1) { + $setupnotempty++; + print ''; + } } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); - print $form->textwithpicto($langs->trans($key), $tooltiphelp); - print '
'; + $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + print '' . $form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips' . $constname) . ''; + print ''; + + if ($val['type'] == 'textarea') { + print '\n"; + } elseif ($val['type'] == 'html') { + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; + $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor->Create(); + } elseif ($val['type'] == 'yesno') { + print $form->selectyesno($constname, $conf->global->{$constname}, 1); + } elseif (preg_match('/emailtemplate:/', $val['type'])) { + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $tmp = explode(':', $val['type']); + + $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang + //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); + $arrayofmessagename = array(); + if (is_array($formmail->lines_model)) { + foreach ($formmail->lines_model as $modelmail) { + //var_dump($modelmail); + $moreonlabel = ''; + if (!empty($arrayofmessagename[$modelmail->label])) { + $moreonlabel = ' (' . $langs->trans("SeveralLangugeVariatFound") . ')'; + } + // The 'label' is the key that is unique if we exclude the language + $arrayofmessagename[$modelmail->label . ':' . $tmp[1]] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; + } + } + print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); + } elseif (preg_match('/category:/', $val['type'])) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; + $formother = new FormOther($db); + + $tmp = explode(':', $val['type']); + print img_picto('', 'category', 'class="pictofixedwidth"'); + print $formother->select_categories('customer', $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + + } else { + print ''; + } + print '
'; From 5c8e7b224f3994223a7b576c3502920d47d8ecfa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 14 Feb 2021 16:44:42 +0100 Subject: [PATCH 20/25] add feature to setup pages --- htdocs/modulebuilder/template/admin/setup.php | 69 ++++++++++++++----- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 72239ff3d1b..a204436eabf 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -216,14 +216,14 @@ if ($action == 'edit') { $setupnotempty++; print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print '' . $form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips' . $constname) . ''; + print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp,1,'info','',0,3,'tootips'.$constname).''; print ''; if ($val['type'] == 'textarea') { - print '\n"; - } elseif ($val['type'] == 'html') { + } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); @@ -234,8 +234,7 @@ if ($action == 'edit') { $formmail = new FormMail($db); $tmp = explode(':', $val['type']); - - $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang + $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); $arrayofmessagename = array(); if (is_array($formmail->lines_model)) { @@ -246,21 +245,22 @@ if ($action == 'edit') { $moreonlabel = ' (' . $langs->trans("SeveralLangugeVariatFound") . ')'; } // The 'label' is the key that is unique if we exclude the language - $arrayofmessagename[$modelmail->label . ':' . $tmp[1]] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; + $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; } } print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); } elseif (preg_match('/category:/', $val['type'])) { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories('customer', $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); - } else { - print ''; + } else + { + print ''; } print ''; } @@ -278,13 +278,48 @@ if ($action == 'edit') { print ''; print ''; - foreach ($arrayofparameters as $key => $val) { - $setupnotempty++; + foreach ($arrayofparameters as $constname => $val) { + if ($val['enabled']==1) { + $setupnotempty++; + print ''; + if ($val['type'] == 'textarea') { + print dol_nl2br($conf->global->{$constname}); + } elseif ($val['type']== 'html') { + print $conf->global->{$constname}; + } elseif ($val['type'] == 'yesno') { + print ajax_constantonoff($constname); + } elseif (preg_match('/emailtemplate:/', $val['type'])) { + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + $tmp = explode(':', $val['type']); + + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + if ($template<0) { + setEventMessages(null, $formmail->errors, 'errors'); + } + print $langs->trans($template->label); + } elseif (preg_match('/category:/', $val['type'])) { + $c = new Categorie($db); + $result = $c->fetch($conf->global->{$constname}); + if ($result < 0) { + setEventMessages(null, $c->errors, 'errors'); + } + $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text + $toprint = array(); + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; + } + print '
      ' . implode(' ', $toprint) . '
    '; + } else { + print $conf->global->{$constname}; + } + print ''; + } } print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; + $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + print $form->textwithpicto($langs->trans($constname), $tooltiphelp); + print ''; - print '
    '; - $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); - print $form->textwithpicto($langs->trans($key), $tooltiphelp); - print ''.$conf->global->$key.'
    '; From d636aa6cfa9b4ba51a61914d4e5b126e66cd800d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 14 Feb 2021 15:48:44 +0000 Subject: [PATCH 21/25] Fixing style errors. --- htdocs/modulebuilder/template/admin/setup.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index a204436eabf..93bbc8a6612 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -216,7 +216,7 @@ if ($action == 'edit') { $setupnotempty++; print ''; $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp,1,'info','',0,3,'tootips'.$constname).''; + print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; print ''; if ($val['type'] == 'textarea') { @@ -257,9 +257,7 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); - - } else - { + } else { print ''; } print ''; From 3e41f69d3da7ce9116775dc68a3e14361969f26f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Feb 2021 21:56:15 +0100 Subject: [PATCH 22/25] Fix bad permission check --- htdocs/adherents/subscription/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index d4396cefb00..c2e2bfd1d44 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -58,7 +58,8 @@ $permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the i $hookmanager->initHooks(array('subscriptioncard', 'globalcard')); // Security check -$result = restrictedArea($user, 'subscription', $id, '', '', 'socid', 'rowid'); +$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id + /* * Actions From fac38e50d65407e8a08b841a2a99bbd48852ca04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Feb 2021 22:16:15 +0100 Subject: [PATCH 23/25] Fix #16256 --- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/stock/stockatdate.php | 41 ++++++++++++++++------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index ad4946ee9f9..aabbe1791b3 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -99,6 +99,7 @@ VirtualStock=Virtual stock VirtualStockAtDate=Virtual stock at date VirtualStockAtDateDesc=Virtual stock once all pending orders that are planned to be done before the date will be finished VirtualStockDesc=Virtual stock is the calculated stock available once all open/pending actions (that affect stocks) are closed (purchase orders received, sales orders shipped, manufacturing orders produced, etc) +AtDate=At date IdWarehouse=Id warehouse DescWareHouse=Description warehouse LieuWareHouse=Localisation warehouse diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 86f569d91c9..8b99efb47c6 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -244,9 +244,11 @@ $title = $langs->trans('StockAtDate'); $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; -$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; if ($fk_warehouse > 0) { + $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql .= ', SUM(ps.reel) as stock_reel'; +} else { + $sql .= " SUM(p.pmp * p.stock) as estimatedvalue, SUM(p.price * p.stock) as sellvalue"; } // Add fields from hooks $parameters = array(); @@ -272,6 +274,9 @@ if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"'; if ($fk_warehouse > 0) { $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; +} else { + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } // Add where from hooks $parameters = array(); @@ -427,8 +432,6 @@ if ($fk_warehouse > 0) { print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); -print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); if ($mode == 'future') { print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); @@ -437,6 +440,8 @@ if ($mode == 'future') { print_liste_field_titre('VirtualStock', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right ', 'VirtualStockDesc'); } else { print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate")); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate")); print_liste_field_titre('', $_SERVER["PHP_SELF"]); print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); } @@ -522,21 +527,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST print ''; - // PMP value - print ''; - if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); - else print ''; - print ''; - - // Selling value - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); - else { - $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); - } - print''; - if ($mode == 'future') { // Current stock print ''.$currentstock.''; @@ -552,6 +542,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Stock at date print ''.($stock ? $stock : ''.$stock.'').''; + // PMP value + print ''; + if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); + else print ''; + print ''; + + // Selling value + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); + else { + $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print''; + print ''; if ($nbofmovement > 0) { print ''.$langs->trans("Movements").''; From a9e7d045360b5e7d916d7ff3a7ab648e8a682067 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Feb 2021 22:18:59 +0100 Subject: [PATCH 24/25] Fix #16256 --- htdocs/product/stock/stockatdate.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 8b99efb47c6..f115bafbdf4 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -407,10 +407,11 @@ print ''; print ''; print ''; -print ''; -print ''; if ($mode == 'future') { print ''; +} else { + print ''; + print ''; } // Fields from hook $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); @@ -440,8 +441,8 @@ if ($mode == 'future') { print_liste_field_titre('VirtualStock', $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right ', 'VirtualStockDesc'); } else { print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate")); - print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate")); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate"), 1); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', $langs->trans("AtDate"), 1); print_liste_field_titre('', $_SERVER["PHP_SELF"]); print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); } From e56635b329502da53bfcbfbe8841232f29e0f779 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Feb 2021 23:05:11 +0100 Subject: [PATCH 25/25] Fix filter on date on movement list --- htdocs/product/stock/movement_list.php | 42 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 3486eae6c9d..d67a72d2d63 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -66,6 +66,12 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $result = restrictedArea($user, 'stock'); $idproduct = GETPOST('idproduct', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'), 'tzuserrel'); $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'), 'tzuserrel'); $search_ref = GETPOST('search_ref', 'alpha'); @@ -105,7 +111,7 @@ $arrayfields = array( 'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1), 'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'), - 'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1), + 'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>0), 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled))), 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))), @@ -113,7 +119,7 @@ $arrayfields = array( 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("MovementLabel"), 'checked'=>1), - 'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1), + 'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>0), 'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1), 'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1), 'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0), @@ -162,6 +168,12 @@ if (empty($reshook)) // Do we click on purge search criteria ? if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; $search_ref = ''; @@ -461,7 +473,7 @@ $sql .= " m.batch, m.price,"; $sql .= " m.type_mouvement,"; $sql .= " m.fk_projet as fk_project,"; $sql .= " pl.rowid as lotid, pl.eatby, pl.sellby,"; -$sql .= " u.login, u.photo, u.lastname, u.firstname"; +$sql .= " u.login, u.photo, u.lastname, u.firstname, u.email as user_email, u.statut as user_status"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); @@ -712,8 +724,12 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($id > 0) $param .= '&id='.urlencode($id); - if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); - if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); + if ($search_date_startday) $param .= '&search_date_startday='.urlencode($search_date_startday); + if ($search_date_startmonth) $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + if ($search_date_startyear) $param .= '&search_date_startyear='.urlencode($search_date_startyear); + if ($search_date_endday) $param .= '&search_date_endday='.urlencode($search_date_endday); + if ($search_date_endmonth) $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + if ($search_date_endyear) $param .= '&search_date_endyear='.urlencode($search_date_endyear); if ($search_movement) $param .= '&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode); if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement); @@ -796,12 +812,10 @@ if ($resql) { print ''; print '
    '; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel'); print '
    '; print '
    '; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'), 'tzuserrel'); print '
    '; print ''; } @@ -1017,6 +1031,8 @@ if ($resql) $userstatic->lastname = $objp->lastname; $userstatic->firstname = $objp->firstname; $userstatic->photo = $objp->photo; + $userstatic->email = $objp->user_email; + $userstatic->statut = $objp->user_status; $productstatic->id = $objp->rowid; $productstatic->ref = $objp->product_ref; @@ -1067,11 +1083,7 @@ if ($resql) if (!empty($arrayfields['p.label']['checked'])) { // Product label - print ''; - /*$productstatic->id=$objp->rowid; - $productstatic->ref=$objp->produit; - $productstatic->type=$objp->type; - print $productstatic->getNomUrl(1,'',16);*/ + print ''; print $productstatic->label; print "\n"; } @@ -1093,7 +1105,7 @@ if ($resql) // Warehouse if (!empty($arrayfields['e.ref']['checked'])) { - print ''; + print ''; print $warehousestatic->getNomUrl(1); print "\n"; }