diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ecd5668beb5..23bb513a85b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -493,7 +493,7 @@ if (empty($reshook)) { if ($conf->global->ACCOUNTING_REEXPORT == 1) { setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); } else { - setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); + setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings'); } } else { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -1002,11 +1002,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; if (empty($reshook)) { // Button re-export if (!empty($conf->global->ACCOUNTING_REEXPORT)) { - $newcardbutton .= ''.img_picto($langs->trans("Activated"), 'switch_on').' '; + $newcardbutton .= ''.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"'); + $newcardbutton .= ''.$langs->trans("ClickToHideAlreadyExportedLines").''; + $newcardbutton .= ''; } else { - $newcardbutton .= ''.img_picto($langs->trans("Disabled"), 'switch_off').' '; + $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').''; + $newcardbutton .= ''.$langs->trans("DocsAlreadyExportedAreExcluded").''; + $newcardbutton .= ''; } - $newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").''; if ($user->hasRight('accounting', 'mouvements', 'export')) { $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export')); @@ -1040,7 +1043,7 @@ if ($massaction == 'preunletteringauto') { include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -1066,7 +1069,7 @@ print $moreforfilter; print ''; print '
'; -print ''; +print '
'; // Filters lines print ''; @@ -1222,8 +1225,7 @@ print "\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); -} + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');} if (!empty($arrayfields['t.piece_num']['checked'])) { print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); } diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 94ee1ac6029..8e5f7690dd1 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject } /** - * Return Suggest accounting accounts to bind + * Return a suggested account (from chart of accounts) to bind * * @param Societe $buyer Object buyer * @param Societe $seller Object seller @@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject * @param array $accountingAccount Array of Accounting account * @param string $type Customer / Supplier * @return array|int Accounting accounts suggested or < 0 if technical error. + * 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product + * 'suggestedaccountingaccountfor'=>Is the account suggested for this product */ public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 021c1ec7821..35be32d6b34 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); + $default_account = GETPOST('default_account', 'int'); // Select Box @@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); -$btn_ventil = GETPOST('ventil', 'alpha'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -520,8 +519,8 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); @@ -640,7 +639,7 @@ if ($result) { print ''; // Ref Product - print ''; - // Description + // Description of line print ''; if ($objp->df > 0) { - print ''; + print ''; + } else { + print ''; + } + if ($objp->dl > 0) { + print ''; } else { print ''; } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 6916a2dfe5d..501de4c11cf 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -27,20 +27,24 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; // Load translation files required by the page -$langs->load("mails"); +$langs->load('mails'); -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$optioncss = GETPOST('optioncss', 'alpha'); +// Get Parameters $massaction = GETPOST('massaction', 'alpha'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); + +// Pagination +$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 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + if (!$sortorder) { $sortorder = "DESC"; } @@ -48,10 +52,12 @@ if (!$sortfield) { $sortfield = "m.date_creat"; } +// Search Fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); $filteremail = GETPOST('filteremail', 'alpha'); +// Initialize objects $object = new Mailing($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -128,7 +134,9 @@ if (empty($reshook)) { * View */ -llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); +// Page Header +$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; +llxHeader('', $langs->trans("Mailing"), $help_url); $form = new Form($db); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cc5872abb25..cc507041ac6 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -62,21 +62,23 @@ if (isModEnabled("expedition")) { $langs->loadLangs(array('sendings')); } +// Get Parameters $socid = GETPOST('socid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; -$mode = GETPOST('mode', 'alpha'); +$mode = GETPOST('mode', 'alpha'); -$search_user = GETPOST('search_user', 'int'); -$search_sale = GETPOST('search_sale', 'int'); -$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); +// Search Fields +$search_user = GETPOST('search_user', 'int'); +$search_sale = GETPOST('search_sale', 'int'); +$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha'); - $search_refproject = GETPOST('search_refproject', 'alpha'); $search_project = GETPOST('search_project', 'alpha'); @@ -140,15 +142,15 @@ $search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int') $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear); $search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear); - $search_status = GETPOST('search_status', 'alpha'); + $optioncss = GETPOST('optioncss', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); - +// Pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -263,6 +265,7 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } }*/ + // Definition of array of fields for columns /*$arrayfields = array(); foreach ($object->fields as $key => $val) { @@ -278,9 +281,11 @@ foreach ($object->fields as $key => $val) { ); } }*/ + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +// Permissions $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->creer; $permissiontodelete = $user->rights->propal->supprimer; diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 8b6119db13a..ad80b6d1b6d 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -144,9 +144,12 @@ $form = new Form($db); $title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card"); $help_url = ''; -llxHeader('', $title, $helpurl); +llxHeader('', $title, $help_url); if ($action == 'create') { + $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); + $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); + print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); print ''."\n"; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c9f90b8b240..33a4409bac9 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -272,7 +272,7 @@ if ($id > 0 || $ref) { print $formconfirm; - if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action == 'settransmitted') { + if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') { print ''; print ''; print ''; @@ -291,7 +291,7 @@ if ($id > 0 || $ref) { print '
'; } - if (!empty($object->date_trans) && empty($object->date_credit) && $user->rights->prelevement->bons->credit && $action == 'setcredited') { + if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') { $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); print ''; print ''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index fb50283991b..d42dc70f49a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -822,6 +822,9 @@ while ($i < min($num, $limit)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; } + if (!$i) { + $totalarray['val']['cd.qty'] = $obj->qty; + } $totalarray['val']['cd.qty'] += $obj->qty; } if (!empty($arrayfields['cd.total_ht']['checked'])) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ab041e63385..55d7ec6fdcf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -753,7 +753,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; } foreach ($listofobjectref as $tmppdf) { - $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files } $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php new file mode 100644 index 00000000000..196cec30738 --- /dev/null +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -0,0 +1,278 @@ + + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-2020 Frederic France + * Copyright (C) 2021-2022 Waƫl Almoman + * + * 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/core/boxes/box_members_by_tags.php + * \ingroup adherent + * \brief Module to show box of members + */ + +include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last modofied members + */ +class box_members_by_tags extends ModeleBoxes +{ + public $boxcode = "box_members_by_tags"; + public $boximg = "object_user"; + public $boxlabel = "BoxTitleMembersByTags"; + public $depends = array("adherent", "categorie"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $enabled = 1; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $conf, $user; + + $this->db = $db; + + // disable module for such cases + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { + $this->enabled = 0; // disabled for external users + } + + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $user, $langs, $conf; + $langs->load("boxes"); + + $this->max = $max; + + include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + $staticmember = new Adherent($this->db); + + $year = date('Y'); + $numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.$year-$numberyears.' - '.$year.')'); + + if ($user->rights->adherent->lire) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $stats = new AdherentStats($this->db, $user->socid, $user->id); + + // Show array + $sumMembers= $stats->countMembersByTagAndStatus($numberyears); + if ($sumMembers) { + $line = 0; + $this->info_box_contents[$line][] = array( + 'td' => 'class=""', + 'text' => '', + ); + // Members Status To Valid + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Waiting for subscription + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus, + ); + // Up to date + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus, + ); + // Expired + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Excluded + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Resiliated + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Total row + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"', + 'text' => $langs->trans("Total") + ); + $line++; + foreach ($sumMembers as $key => $data) { + $adhtype = new AdherentType($this->db); + $adhtype->id = $key; + + if ($key=='total') { + break; + } + $adhtype->label = $data['label']; + $AdherentType[$key] = $adhtype; + + $this->info_box_contents[$line][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'text' => $adhtype->getNomUrl(1, dol_size(32)), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''), + 'asis' => 1, + ); + $line++; + } + + if (count($sumMembers) == 0) { + $this->info_box_contents[$line][0] = array( + 'td' => 'class="center" colspan="6"', + 'text' => $langs->trans("NoRecordedMembersByType") + ); + } else { + $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total") + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['all'], + 'asis' => 1 + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => '', + 'maxlength' => 500, + 'text' => ($this->db->error() . ' sql=' . $sql) + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover opacitymedium left"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 1a29c8e1389..96928adfdff 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -464,6 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box closedir($handle); } } + //echo "
";print_r($modules);echo "
"; asort($orders); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 7c136f446d9..b4eddcc252f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1104,7 +1104,7 @@ abstract class CommonDocGenerator public function getColumnContentXStart($colKey) { $colDef = $this->cols[$colKey]; - return $colDef['xStartPos'] + $colDef['content']['padding'][3]; + return (isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0) + $colDef['content']['padding'][3]; } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b67f518d2af..9b8f0dfc6dd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1291,11 +1291,11 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Delete all links between an object $this and all its contacts + * Delete all links between an object $this and all its contacts in llx_element_contact * * @param string $source '' or 'internal' or 'external' * @param string $code Type of contact (code or id) - * @return int >0 if OK, <0 if KO + * @return int <0 if KO, 0=Nothing done, >0 if OK */ public function delete_linked_contact($source = '', $code = '') { @@ -1311,11 +1311,15 @@ abstract class CommonObject $listId = implode(",", $temp); } + // If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for + // any type or record instead of only the ones of the current object. So we do nothing in such a case. + if (empty($listId)) { + return 0; + } + $sql = "DELETE FROM ".$this->db->prefix()."element_contact"; $sql .= " WHERE element_id = ".((int) $this->id); - if (!empty($listId)) { - $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; - } + $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 74d8b089223..bec9c85d5dc 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -785,6 +785,11 @@ class Conf $this->global->USE_STRICT_CSV_RULES = 2; } + // By default, option is on. Once set by user, this code is useless + if (!isset($this->global->ACCOUNTING_REEXPORT)) { + $this->global->ACCOUNTING_REEXPORT = 1; + } + // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bbc30468e7a..7ed3f76c4bf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6287,7 +6287,7 @@ class Form if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { - // We also add the buyer + // We also add the buyer country code if (is_numeric($type)) { if ($type == 1) { // We know product is a service $code_country .= ",'".$societe_acheteuse->country_code."'"; diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 60499845de0..40dec1870a4 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -21,7 +21,6 @@ */ class FormSetup { - /** * @var DoliDB Database handler. */ @@ -1082,16 +1081,18 @@ class FormSetupItem } } } elseif (preg_match('/emailtemplate:/', $this->type)) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($this->db); + if ($this->fieldValue > 0) { + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); - $tmp = explode(':', $this->type); + $tmp = explode(':', $this->type); - $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); - if (is_numeric($template) && $template < 0) { - $this->setErrors($formmail->errors); + $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); + if (is_numeric($template) && $template < 0) { + $this->setErrors($formmail->errors); + } + $out.= $this->langs->trans($template->label); } - $out.= $this->langs->trans($template->label); } elseif (preg_match('/category:/', $this->type)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); @@ -1117,6 +1118,7 @@ class FormSetupItem } } elseif ($this->type == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); $resprod = $product->fetch($this->fieldValue); if ($resprod > 0) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fe47ecc64d7..8a25f02dd90 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4085,7 +4085,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', - 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', + 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', 'id-card', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', @@ -5743,9 +5743,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ // If force rounding if ((string) $forcerounding != '-1') { - if ($forcerounding == 'MU') { + if ($forcerounding === 'MU') { $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; - } elseif ($forcerounding == 'MT') { + } elseif ($forcerounding === 'MT') { $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; } elseif ($forcerounding >= 0) { $nbdecimal = $forcerounding; @@ -6490,7 +6490,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { if ($seller_in_cee && $buyer_in_cee) { $isacompany = $thirdparty_buyer->isACompany(); - if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!isValidVATID($thirdparty_buyer)) { $isacompany = 0; @@ -6539,7 +6539,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // If (seller and buyer in European Community) and (buyer = company) then VAT by default=0. End of rule if (($seller_in_cee && $buyer_in_cee)) { $isacompany = $thirdparty_buyer->isACompany(); - if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!isValidVATID($thirdparty_buyer)) { $isacompany = 0; diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 2422cead7bb..0df5284eaed 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -198,6 +198,7 @@ class modAdherent extends DolibarrModules 4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'), 5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'), 6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'), + 7 => array('file'=>'box_members_by_tags.php', 'enabledbydefaulton'=>'membersindex'), ); // Permissions diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 37e6552af2f..ff80385235f 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -208,6 +208,13 @@ class modTicket extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'manage'; + $r++; + $this->rights[$r][0] = 56006; // id de la permission + $this->rights[$r][1] = "Export ticket"; // libelle de la permission + //$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'export'; + /* Seems not used and in conflict with societe->client->voir (see all thirdparties) $r++; $this->rights[$r][0] = 56005; // id de la permission @@ -318,6 +325,27 @@ class modTicket extends DolibarrModules 'target' => '', 'user' => 0); $r++; + + // Exports + //-------- + $r = 1; + + // Export list of tickets and attributes + $langs->load("ticket"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r] = array(array("ticket", "export")); + $this->export_icon[$r]='ticket'; + $keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')'; + $r++; } /** diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index 44885296bae..3d3b3b25a0e 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -41,6 +41,11 @@ class DolLogsCollector extends MessagesCollector */ protected $maxnboflines; + /** + * @var int number of lines + */ + protected $nboflines; + /** * Constructor * @@ -54,7 +59,7 @@ class DolLogsCollector extends MessagesCollector parent::__construct($name); $this->nboflines = 0; - $this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output + $this->maxnboflines = getDolGlobalInt('DEBUGBAR_LOGS_LINES_NUMBER', 250); // High number slows seriously output $this->path = $path ?: $this->getLogsFile(); } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index acd3b34961c..716e3728b57 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -772,7 +772,7 @@ class Don extends CommonObject */ public function setPaid($id, $modepayment = 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1"; if ($modepayment) { $sql .= ", fk_payment = ".((int) $modepayment); } @@ -782,6 +782,7 @@ class Don extends CommonObject if ($resql) { if ($this->db->affected_rows($resql)) { $this->statut = 2; + $this->paid = 1; return 1; } else { return 0; diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index e43a86da515..5616abbbd35 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -24,8 +24,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for EmailCollectorAction @@ -113,37 +111,6 @@ class EmailCollectorAction extends CommonObject public $status; // END MODULEBUILDER PROPERTIES - - - // If this object has a subtable with lines - - // /** - // * @var string Name of subtable line - // */ - //public $table_element_line = 'emailcollectoractiondet'; - - // /** - // * @var string Field with ID of parent key if this field has a parent - // */ - //public $fk_element = 'fk_emailcollectoraction'; - - // /** - // * @var string Name of subtable class that manage subtable lines - // */ - //public $class_element_line = 'EmailcollectorActionline'; - - // /** - // * @var array List of child tables. To test if we can delete object. - // */ - //protected $childtables=array(); - - // /** - // * @var EmailcollectorActionLine[] Array of subtable lines - // */ - //public $lines = array(); - - - /** * Constructor * @@ -225,16 +192,14 @@ class EmailCollectorAction extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { - //var_dump($key); - //var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); } } @@ -271,26 +236,10 @@ class EmailCollectorAction extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - // if ($result > 0 && !empty($this->table_element_line)) { - // $this->fetchLinesCommon(); - // } + return $result; } - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - /*public function fetchLines() - { - $this->lines=array(); - - // Load lines with object EmailcollectorActionLine - - return count($this->lines)?1:0; - }*/ - /** * Update object into database * @@ -336,7 +285,6 @@ class EmailCollectorAction extends CommonObject } $result = ''; - $companylink = ''; $label = ''.$langs->trans("EmailcollectorAction").''; $label .= '
'; @@ -487,7 +435,7 @@ class EmailCollectorAction extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); } diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index cff80aa4153..327159f61a4 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -206,16 +206,14 @@ class EmailCollectorFilter extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { - //var_dump($key); - //var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); } } @@ -252,26 +250,10 @@ class EmailCollectorFilter extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } + return $result; } - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - /*public function fetchLines() - { - $this->lines=array(); - - // Load lines with object EmailcollectorFilterLine - - return count($this->lines)?1:0; - }*/ - /** * Update object into database * @@ -317,7 +299,6 @@ class EmailCollectorFilter extends CommonObject } $result = ''; - $companylink = ''; $label = ''.$langs->trans("EmailcollectorFilter").''; $label .= '
'; @@ -468,7 +449,7 @@ class EmailCollectorFilter extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 75c5b02de10..7f3fb7d8b32 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1210,11 +1210,17 @@ if (empty($reshook)) { unset($date); } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } - $action = ''; + if (!$error) { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); + exit; + } else { + $action = ''; + } } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c8fc2814ad6..dfb6327bd3f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3071,7 +3071,8 @@ if ($action == 'create') { } if (isset($objectidnext) && $objectidnext > 0) { $facthatreplace = new FactureFournisseur($db); - $facthatreplace->fetch($facidnext); + + $facthatreplace->fetch($objectidnext); print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).''; } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index e8307cdeb8b..b0a1d263b65 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -1065,20 +1065,21 @@ class Job extends CommonObject public function getKanbanView($option = '', $arraydata = null) { global $selected, $langs; + $return = '
'; $return .= '
'; $return .= ''; $return .= img_picto('', $this->picto); $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).''; $return .= ''; - if (property_exists($this, 'deplacement')) { + /*if (property_exists($this, 'deplacement')) { $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['deplacement']['arrayofkeyval'][$this->deplacement].''; - } + }*/ if (property_exists($this, 'description') && !(empty($this->description))) { - $return .= '
'.$langs->trans("Description").' : '; + //$return .= '
'.$langs->trans("Description").' : '; $return .= '
'.(strlen($this->description) > 30 ? dol_substr($this->description, 0, 25).'...' : $this->description).''; } $return .= '
'; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 6e97c0d0483..18414cc9f11 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -116,11 +116,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -137,18 +137,15 @@ $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; -// Security check -if (empty($conf->hrm->enabled)) { - accessforbidden('Module not enabled'); -} - // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled('hrm')) { + accessforbidden('Module hrm not enabled'); +} if (!$permissiontoread) accessforbidden(); @@ -257,17 +254,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -287,7 +284,7 @@ $sql .= $hookmanager->resPrint; /* If a group by is required $sql .= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -302,8 +299,6 @@ $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); */ -$sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -313,24 +308,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); @@ -373,11 +368,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -398,7 +399,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -435,9 +436,12 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } @@ -461,7 +465,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -471,7 +475,15 @@ print '
'.dol_print_date($facture_static->date, 'day').''; + print ''; if ($product_static->id > 0) { print $product_static->getNomUrl(1); } @@ -649,7 +648,7 @@ if ($result) { } print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; @@ -683,15 +682,22 @@ if ($result) { // Found accounts print ''; + // First show default account for any products $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; + $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { + $shelp = $langs->trans("SaleEECWithVAT"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') { + $shelp = $langs->trans("SaleEECWithoutVATNumber"); + $ttype = 'warning'; } elseif ($suggestedaccountingaccountbydefaultfor == 'export') { $shelp .= $langs->trans("SaleExport"); } $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : ''.$langs->trans("NotDefined").''); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); + // Now show account for product if ($product_static->id > 0) { print '
'; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 0929c9c9e24..339ffe68b96 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -58,6 +58,8 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); + // Security check if (!isModEnabled('accounting')) { accessforbidden(); @@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) { if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } @@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { * Actions */ -if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { +if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) { // Clean database $db->begin(); $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; @@ -110,8 +112,7 @@ if ($action == 'validatehistory') { $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id"; - $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity); - $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,'; + $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity); $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er"; $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity); $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; @@ -182,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation")); $textprevyear = ''.img_previous().''; $textnextyear = ' '.img_next().''; + print load_fiche_titre($langs->trans("ExpenseReportsVentilation")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy'); print ''.$langs->trans("DescVentilExpenseReport").'
'; @@ -253,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= ' ORDER BY aa.account_number'; -dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); +dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 25b86a8d527..1cf9149024a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -419,8 +418,8 @@ if ($result) { print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', ''); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', ''); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 3b8e93cb54b..aae34a51e03 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); + $default_account = GETPOST('default_account', 'int'); // Select Box @@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); -$btn_ventil = GETPOST('ventil', 'alpha'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) { if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } @@ -532,8 +531,8 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); @@ -712,14 +711,19 @@ if ($result) { // Found accounts print '
'; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; + $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { + $shelp = $langs->trans("SaleEECWithVAT"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') { + $shelp = $langs->trans("SaleEECWithoutVATNumber"); + $ttype = 'warning'; } elseif ($suggestedaccountingaccountbydefaultfor == 'export') { $shelp .= $langs->trans("SaleExport"); } $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : ''.$langs->trans("NotDefined").''); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); if ($product_static->id > 0) { print '
'; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 72db71d07bd..ed2fa05cf51 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -171,4 +171,82 @@ class AdherentStats extends Stats return $this->_getAllByYear($sql); } + + + + /** + * Return count of member by status group by adh type, total and average + * + * @param int $numberYears Years to scan + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag + */ + public function countMembersByTagAndStatus($numberYears = 2) + { + global $user; + + $now = dol_now(); + $endYear = date('Y'); + $startYear = $endYear - $numberYears; + + $sql = "SELECT c.rowid as fk_categorie, c.label as label"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated"; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie as c"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type"; + $sql .= " WHERE c.entity IN (".getEntity('member_type').")"; + $sql .= " AND d.entity IN (" . getEntity('adherent') . ")"; + $sql .= " AND t.entity IN (" . getEntity('adherent') . ")"; + $sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'"; + $sql .= " AND c.fk_parent = 0"; + $sql .= " GROUP BY c.rowid"; + + dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $i = 0; + $MembersCountArray = []; + $totalstatus = array( + 'label' => 'Total', + 'members_draft' => 0, + 'members_pending' => 0, + 'members_uptodate' => 0, + 'members_expired' => 0, + 'members_excluded' => 0, + 'members_resiliated' => 0 + ); + while ($i < $num) { + $objp = $this->db->fetch_object($result); + $MembersCountArray[$objp->fk_categorie] = array( + 'label' => $objp->label, + 'members_draft' => (int) $objp->members_draft, + 'members_pending' => (int) $objp->members_pending, + 'members_uptodate' => (int) $objp->members_uptodate, + 'members_expired' => (int) $objp->members_expired, + 'members_excluded' => (int) $objp->members_excluded, + 'members_resiliated' => (int) $objp->members_resiliated + ); + $totalrow = 0; + foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) { + if ($key!='label') { + $totalrow += $nb; + $totalstatus[$key] += $nb; + } + } + $MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow; + $i++; + } + $this->db->free($result); + $MembersCountArray['total'] = $totalstatus; + $MembersCountArray['total']['all'] = array_sum($totalstatus); + } + return $MembersCountArray; + } } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d06d91cbea6..2e04aba9167 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -30,9 +30,9 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -41,47 +41,51 @@ $langs->loadLangs(array("members", "companies")); // Get parameters -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search -$mode = GETPOST('mode', 'alpha'); - +$backtopage = GETPOST('backtopage', 'alpha'); +$optioncss = GETPOST('optioncss', 'aZ'); +$mode = GETPOST('mode', 'alpha'); // Search fields -$search = GETPOST("search", 'alpha'); -$search_ref = GETPOST("search_ref", 'alpha'); -$search_lastname = GETPOST("search_lastname", 'alpha'); -$search_firstname = GETPOST("search_firstname", 'alpha'); -$search_gender = GETPOST("search_gender", 'alpha'); -$search_civility = GETPOST("search_civility", 'alpha'); -$search_company = GETPOST('search_company', 'alphanohtml'); -$search_login = GETPOST("search_login", 'alpha'); -$search_address = GETPOST("search_address", 'alpha'); -$search_zip = GETPOST("search_zip", 'alpha'); -$search_town = GETPOST("search_town", 'alpha'); -$search_state = GETPOST("search_state", 'alpha'); -$search_country = GETPOST("search_country", 'alpha'); -$search_phone = GETPOST("search_phone", 'alpha'); +$search = GETPOST("search", 'alpha'); +$search_ref = GETPOST("search_ref", 'alpha'); +$search_lastname = GETPOST("search_lastname", 'alpha'); +$search_firstname = GETPOST("search_firstname", 'alpha'); +$search_gender = GETPOST("search_gender", 'alpha'); +$search_civility = GETPOST("search_civility", 'alpha'); +$search_company = GETPOST('search_company', 'alphanohtml'); +$search_login = GETPOST("search_login", 'alpha'); +$search_address = GETPOST("search_address", 'alpha'); +$search_zip = GETPOST("search_zip", 'alpha'); +$search_town = GETPOST("search_town", 'alpha'); +$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state +$search_country = GETPOST("search_country", 'alpha'); +$search_phone = GETPOST("search_phone", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); -$search_type = GETPOST("search_type", 'alpha'); -$search_email = GETPOST("search_email", 'alpha'); -$search_categ = GETPOST("search_categ", 'int'); -$search_filter = GETPOST("search_filter", 'alpha'); -$search_status = GETPOST("search_status", 'intcomma'); -$search_morphy = GETPOST("search_morphy", 'alpha'); +$search_type = GETPOST("search_type", 'alpha'); +$search_email = GETPOST("search_email", 'alpha'); +$search_categ = GETPOST("search_categ", 'int'); +$search_morphy = GETPOST("search_morphy", 'alpha'); $search_import_key = trim(GETPOST("search_import_key", 'alpha')); -$catid = GETPOST("catid", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); -$socid = GETPOST('socid', 'int'); + +$catid = GETPOST("catid", 'int'); +$socid = GETPOST('socid', 'int'); + +$search_filter = GETPOST("search_filter", 'alpha'); +$search_status = GETPOST("search_status", 'intcomma'); // statut $filter = GETPOST("filter", 'alpha'); if ($filter) { $search_filter = $filter; // For backward compatibility } + $statut = GETPOST("statut", 'alpha'); if ($statut != '') { $search_status = $statut; // For backward compatibility @@ -93,6 +97,7 @@ if ($search_status < -2) { $search_status = ''; } +// Pagination parameters $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 79c42f6e2db..b366ea928ef 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -117,7 +117,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - if ($conf->global->COMMANDE_ADDON_PDF == "$value") { + if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) { dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); } } @@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) { // Default print '
'; - if ($conf->global->COMMANDE_ADDON_PDF == $name) { + if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 2adef615a70..3eae08bb60a 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -29,15 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; $langs->loadLangs(array('bookmarks', 'admin')); // Get Parameters -$action = GETPOST('action', 'aZ09'); +$id = GETPOST("id", 'int'); + +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search -$id = GETPOST("id", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); -$mode = GETPOST('mode', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'aZ09'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 8807ccd4764..a0176ca18b0 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -33,18 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + // Load translation files required by the page $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search -$optioncss = GETPOST('optioncss', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -$confirm = GETPOST('confirm', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); + $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); @@ -70,6 +74,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } +// Search Fields $search_id = GETPOST('search_id', 'alpha'); $search_title = GETPOST('search_title', 'alpha'); $search_note = GETPOST('search_note', 'alpha'); @@ -106,6 +111,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert = $user->id; } +// Pagination parameters $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e6162b45b52..9c848883332 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1419,7 +1419,7 @@ if ($object->id > 0) { $sql .= ', f.total_tva'; $sql .= ', f.total_ttc'; $sql .= ', f.entity'; - $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status'; + $sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status'; $sql .= ', s.nom, s.rowid as socid'; $sql .= ', SUM(pf.amount) as am'; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; @@ -1493,7 +1493,12 @@ if ($object->id > 0) { //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''.dol_print_date($db->jdate($objp->df), 'day').''.$langs->trans('DateInvoice').": ".dol_print_date($db->jdate($objp->df), 'day').'!!!'.$langs->trans('DateMaxPayment').": ".dol_print_date($db->jdate($objp->dl), 'day').'!!!
'; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -479,7 +491,7 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -487,9 +499,7 @@ foreach ($object->fields as $key => $val) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -497,6 +507,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print ''; } @@ -509,16 +525,23 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print '
'; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -527,21 +550,26 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +$totalarray['nbfield']++; print ''."\n"; @@ -559,9 +587,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -571,29 +601,35 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $object->setVarsFromFetchObj($obj); if ($mode == 'kanban') { - if ($i == 0) { - print ''; } } else { // Show here line of result - print ''; + $j = 0; + print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -614,7 +650,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { @@ -649,21 +689,24 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; } - print ''; if (!$i) { $totalarray['nbfield']++; } print ''."\n"; } + $i++; } @@ -678,14 +721,14 @@ if ($num == 0) { $colspan++; } } - print ''; + print ''; } $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; - print '
'; - } - // Output Kanban - $object->deplacement = $obj->deplacement; $object->description = $obj->description; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; - } - print $object->getKanbanView(''); + if ($i == 0) { + print '
'; + print '
'; } - if ($i == (min($num, $limit) - 1)) { + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { print '
'; print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; + print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
'."\n"; diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 52a1a3bbbb6..f86fbe069b8 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -78,6 +78,7 @@ -- Portugal -- Romania -> for Departmements -- San Salvador +-- Slovakia -- Slovenia -- Spain -- Switzerland/Suisse -> for Departmements/Cantons @@ -450,6 +451,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 8 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental'); +-- Slovakia Regions (rowid country=201) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20101', 'SK01', NULL, 'Bratislava Region'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20102', 'SK02', NULL, 'Western Slovakia'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20103', 'SK03', NULL, 'Central Slovakia'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20104', 'SK04', NULL, 'Eastern Slovakia'); + + -- Slovenia Regions (rowid country=202) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia'); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9e174dc3da1..b87c9fc4955 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -14,8 +14,8 @@ ACCOUNTING_EXPORT_ENDLINE=Select the carriage return type ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name ThisService=This service ThisProduct=This product -DefaultForService=Default for service -DefaultForProduct=Default for product +DefaultForService=Default for services +DefaultForProduct=Default for products ProductForThisThirdparty=Product for this thirdparty ServiceForThisThirdparty=Service for this thirdparty CantSuggest=Can't suggest @@ -101,7 +101,8 @@ ShowAccountingAccount=Show accounting account ShowAccountingJournal=Show accounting journal ShowAccountingAccountInLedger=Show accounting account in ledger ShowAccountingAccountInJournals=Show accounting account in journals -AccountAccountingSuggest=Accounting account suggested +DataUsedToSuggestAccount=Data used to suggest account +AccountAccountingSuggest=Account suggested MenuDefaultAccounts=Default accounts MenuBankAccounts=Bank accounts MenuVatAccounts=Vat accounts @@ -405,7 +406,7 @@ SaleLocal=Local sale SaleExport=Export sale SaleEEC=Sale in EEC SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account. -SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fallback on the product account for standard sales. You can fix the VAT ID of thirdparty or the product account if needed. +SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the thirdparty, or change the product account suggested for binding if needed. ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported. ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated. ## Dictionary @@ -476,5 +477,7 @@ FECFormatMulticurrencyCode=Multicurrency code (Idevise) DateExport=Date export WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. ExpenseReportJournal=Expense Report Journal +DocsAlreadyExportedAreExcluded=Docs already exported are excluded +ClickToHideAlreadyExportedLines=Click to hide already exported lines NAccounts=%s accounts diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 0ac1ecce545..9e80e36b119 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -24,6 +24,7 @@ BoxFicheInter=Latest interventions BoxCurrentAccounts=Open accounts balance BoxTitleMemberNextBirthdays=Birthdays of this month (members) BoxTitleMembersByType=Members by type and status +BoxTitleMembersByTags=Members by tags and status BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastProducts=Products/Services: last %s modified diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0d06736a23d..405417d7da6 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -916,8 +916,8 @@ ExportFilteredList=Export filtered list ExportList=Export list ExportOptions=Export Options IncludeDocsAlreadyExported=Include docs already exported -ExportOfPiecesAlreadyExportedIsEnable=Export of pieces already exported is enable -ExportOfPiecesAlreadyExportedIsDisable=Export of pieces already exported is disable +ExportOfPiecesAlreadyExportedIsEnable=Documents already exported are visible and will be exported +ExportOfPiecesAlreadyExportedIsDisable=Documents already exported are hidden and won't be exported AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported Miscellaneous=Miscellaneous diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ea560012afc..de54d475591 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -26,6 +26,7 @@ Permission56002=Modify tickets Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) +Permission56006=Export tickets Tickets=Tickets TicketDictType=Ticket - Types @@ -61,6 +62,8 @@ TypeContact_ticket_external_CONTRIBUTOR=External contributor OriginEmail=Reporter Email Notify_TICKET_SENTBYMAIL=Send ticket message by email +ExportDataset_ticket_1=Tickets + # Status Read=Read Assigned=Assigned diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index a45577b6608..afa7aa5eaa8 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -66,6 +66,7 @@ $error = 0; * Actions */ +$parameters = array(); $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'); @@ -291,13 +292,13 @@ if ($action == 'create') { // Date Start print ""; print ''.$langs->trans("DateStart").''; - print $form->selectDate($datestart ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); print ''; // Date End print ""; print ''.$langs->trans("DateEnd").''; - print $form->selectDate($dateend ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); print ''; // Number of terms diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 1225f5304be..b664d784e7e 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -42,6 +42,7 @@ $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'); +$massaction = GETPOST('massaction', 'alpha'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action @@ -148,6 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } $db->free($resql); } +$arrayfields = array(); // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 8b9feb7b60a..dea2a1a596e 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -55,9 +55,6 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/mymodule.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - - //require_once "../class/myclass.class.php"; // Translations diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8a5aecf1513..ac465b16bd7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1485,7 +1485,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } - if ($type == 1 && $conf->workstation->enabled) { + if ($type == 1 && isModEnabled("workstation")) { // Default workstation print ''.$langs->trans("DefaultWorkstation").''; print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 10581d19b7c..9946e7a9077 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -133,7 +133,7 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $form = new Form($db); $htmlother = new FormOther($db); -if ($objp->stock_physique < 0) { print ''; } +if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print ''; } $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index c929c2486bd..aafea0365e0 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -229,9 +229,10 @@ if ($action == "view_ticketlist") { $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $filter = array(); + $param = '&action=view_ticketlist'; if (!empty($entity) && isModEnabled('multicompany')) { - $param .= '&entity='.$entity; + $param .= '&entity='.((int) $entity); } // Definition of fields for list @@ -407,7 +408,8 @@ if ($action == "view_ticketlist") { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); + + print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); // Search bar print ''."\n"; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 02cbc9af957..97d6d19a4f9 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -72,7 +72,7 @@ if ($origin == 'reception') { } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); - } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { + } elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) { accessforbidden(); } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 5a5ccb08bf6..7bf61f3021f 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -97,6 +97,7 @@ $search_chq_number = GETPOST('search_chq_number', 'int'); $filtre = GETPOST("filtre", 'restricthtml'); +$search_type_id = ''; if (!GETPOST('search_type_id', 'int')) { $newfiltre = str_replace('filtre=', '', $filtre); $filterarray = explode('-', $newfiltre); @@ -532,6 +533,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $total = 0; $totalarray = array(); +$totalarray['nbfield'] = 0; while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -697,7 +699,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; } - $totalarray['val']['totalttcfield'] += $obj->amount; + if (!$i) { + $totalarray['val']['totalttcfield'] = $obj->amount; + } else { + $totalarray['val']['totalttcfield'] += $obj->amount; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a8a79e8bb34..0b987de469e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3803,7 +3803,7 @@ td.border, div.tagtable div div.border { } -.fichehalfright table.noborder { +.fichehalfright table.noborder , .fichehalfleft table.noborder{ margin: 0px 0px 0px 0px; } table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9e00ddc0920..964f4b9a67f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -422,8 +422,18 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); - $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); - $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); + /* + * Protection against deletion of ref_employee while the field is not present in the user tab + */ + if (GETPOSTISSET("ref_employee")) { + $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); + } + /* + * Protection against deletion of national_registration_number while the field is not present in the user tab + */ + if (GETPOSTISSET("national_registration_number")) { + $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); + } $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key;