From 86eda8ede57d294fbd13014ae53136e0ae38cd16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Apr 2024 20:02:09 +0200 Subject: [PATCH 01/11] add filters for level 4 (#29532) --- phpstan.neon.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4bb2cf6eaed..72bd0fb21fb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -44,6 +44,7 @@ parameters: polluteScopeWithAlwaysIterableForeach: true reportMagicMethods: false reportMagicProperties: false + treatPhpDocTypesAsCertain: false ignoreErrors: - '#Result of function fieldList#' - '#Caught class Stripe#' @@ -54,6 +55,7 @@ parameters: - '#(\$force_dolibarr_lib|\$dolibarr_main_db).*in empty\(\) is never defined.#' - '#Sprain\\SwissQrBill\\#' - '#Constructor of class .* has an unused parameter #' + - '#.*phan-var-force #' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 From 08855a2ec847ec3e2b2803e08742c3eb28e23a8f Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Mon, 29 Apr 2024 21:51:55 +0200 Subject: [PATCH 02/11] New display ShowConversation for product (#29535) --- htdocs/product/agenda.php | 11 +- htdocs/product/card.php | 6 +- htdocs/product/messaging.php | 237 +++++++++++++++++++++++++++++++++++ 3 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 htdocs/product/messaging.php diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index ee8fc25c00d..ff55f62d329 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -190,6 +190,12 @@ if ($id > 0 || $ref) { $out = ''; $morehtmlcenter = ''; + + $messagingUrl = DOL_URL_ROOT.'/product/messaging.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + $messagingUrl = DOL_URL_ROOT.'/product/agenda.php?id='.$object->id; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + if (isModEnabled('agenda')) { $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objproduct->id) || !empty($objcon->id)) && $permok) { @@ -200,9 +206,10 @@ if ($id > 0 || $ref) { } $linktocreatetimeBtnStatus = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); } + if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { print '
'; @@ -215,7 +222,7 @@ if ($id > 0 || $ref) { } // @phan-suppress-next-line PhanPluginSuspiciousParamPosition, PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("ActionsOnProduct"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnProduct"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 0); // List of all actions $filters = array(); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 9d076144121..9f597611203 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -3080,8 +3080,10 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { print '
'; $MAXEVENT = 10; - - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/agenda.php?id='.$object->id); + $morehtmlcenter = '
'; + $morehtmlcenter .= dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', DOL_URL_ROOT.'/product/messaging.php?id='.$object->id); + $morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/product/agenda.php?id='.$object->id); + $morehtmlcenter .= '
'; // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; diff --git a/htdocs/product/messaging.php b/htdocs/product/messaging.php new file mode 100644 index 00000000000..2ece99ce5b4 --- /dev/null +++ b/htdocs/product/messaging.php @@ -0,0 +1,237 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006-2019 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/societe/messaging.php + * \ingroup societe + * \brief Page of third party events + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); + +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'thirdpartyagenda'; + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); +} + +$search_rowid = GETPOST('search_rowid'); +$search_agenda_label = GETPOST('search_agenda_label'); + +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'a.datep,a.id'; +} +if (!$sortorder) { + $sortorder = 'DESC,DESC'; +} + +// Initialize technical objects +$object = new Product($db); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('agendathirdparty', 'globalcard')); + +// Security check +$id = GETPOSTINT('id'); +$socid =0; +if ($user->socid) { + $socid = $user->socid; +} + +$result = restrictedArea($user, 'produit', $socid, ''); + + + +/* + * Actions + */ + +$parameters = array('id' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; + } +} + + + +/* + * View + */ + +$form = new Form($db); + +$result = $object->fetch($id, $ref); + +$title = $langs->trans("Agenda"); + +$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|DE:Modul_Terminplanung'; + +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { + $title = $object->name." - ".$title; +} +llxHeader('', $title, $help_url); + +if (isModEnabled('notification')) { + $langs->load("mails"); +} + $type = $langs->trans('Product'); +if ($object->isService()) { + $type = $langs->trans('Service'); +} + + $head = product_prepare_head($object); + + $titre = $langs->trans("CardProduct".$object->type); + $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); + print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = ''; + +dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'rowid', 'label', $morehtmlref); + +print '
'; + +print '
'; + +$object->info($id); +dol_print_object_info($object, 1); + +print '
'; + +print dol_get_fiche_end(); + + + +// Actions buttons + +$objthirdparty = $object; +$objcon = new stdClass(); + +$out = ''; +$permok = $user->hasRight('agenda', 'myactions', 'create'); +if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { + $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); + } + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); +} + +$morehtmlright = ''; + +$messagingUrl = DOL_URL_ROOT.'/product/messaging.php?id='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); +$messagingUrl = DOL_URL_ROOT.'/product/agenda.php?id='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + +// // Show link to send an email (if read and not closed) +// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; +// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; +// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + +// // Show link to add a private message (if read and not closed) +// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; +// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; +// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + +if (isModEnabled('agenda')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } +} + +if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + print '
'; + + $param = '&socid='.urlencode((string) ($socid)); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); + } + + // Try to know count of actioncomm from cache + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_thirdparty_'.$object->id; + $nbEvent = dol_getcache($cachekey); + + $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); + if (!empty($conf->dol_optimize_smallscreen)) { + $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''); + } + + print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; + + // TODO Replace this with same code than into list.php + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); +} + +// End of page +llxFooter(); +$db->close(); From 6da59ca0c08a8988e16269cdb008431d33592ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Apr 2024 22:53:43 +0200 Subject: [PATCH 03/11] fix fichinter_rec (#29537) * fix fichinter_rec * fix fichinter_rec * fix fichinter_rec --- htdocs/fichinter/card-rec.php | 20 +++++------ htdocs/fichinter/class/fichinterrec.class.php | 33 ++++++++++--------- .../install/mysql/migration/19.0.0-20.0.0.sql | 4 +-- .../mysql/tables/llx_fichinter_rec.sql | 6 ++-- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index bd5fa91bbf8..e2c99bbd3b6 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -8,7 +8,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016-2018 Charlie Benke - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 William Mead * Copyright (C) 2024 MDW * @@ -27,7 +27,7 @@ */ /** - * \file fichinter/card-rec.php + * \file htdocs/fichinter/card-rec.php * \ingroup intervention * \brief Page to show predefined fichinter */ @@ -98,7 +98,7 @@ $extrafields = new ExtraFields($db); $arrayfields = array( - 'f.titre' => array('label' => "Ref", 'checked' => 1), + 'f.title' => array('label' => "Ref", 'checked' => 1), 's.nom' => array('label' => "ThirdParty", 'checked' => 1), 'f.fk_contrat' => array('label' => "Contract", 'checked' => 1), 'f.duree' => array('label' => "Duration", 'checked' => 1), @@ -130,7 +130,7 @@ if ($cancel) { // Create predefined intervention if ($action == 'add') { - if (!GETPOST('titre')) { + if (!GETPOST('title')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); $action = "create"; $error++; @@ -167,7 +167,7 @@ if ($action == 'add') { if (!$error) { $object->id_origin = $id; - $object->title = GETPOST('titre', 'alpha'); + $object->title = GETPOST('title', 'alpha'); $object->description = GETPOST('description', 'restricthtml'); $object->socid = GETPOSTINT('socid'); $object->fk_project = GETPOSTINT('projectid'); @@ -322,7 +322,7 @@ if ($action == 'create') { // Title print ''.$langs->trans("Title").''; - print ''; + print ''; print ''; // Note @@ -777,9 +777,9 @@ if ($action == 'create') { /* * List mode */ - $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title,"; + $sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.title,"; $sql .= " f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,"; - $sql .= " f.date_last_gen, f.date_when, f.datec"; + $sql .= " f.date_last_gen, f.date_when, f.datec, f.status"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s "; @@ -796,7 +796,7 @@ if ($action == 'create') { } /* if (!empty($search_ref)) { - $sql .= natural_search('f.titre', $search_ref); + $sql .= natural_search('f.title', $search_ref); } */ if (!empty($search_societe)) { @@ -824,7 +824,7 @@ if ($action == 'create') { $i = 0; print ''; print ''; - print_liste_field_titre("Ref", $_SERVER['PHP_SELF'], "f.titre", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Ref", $_SERVER['PHP_SELF'], "f.title", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "s.nom", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); if (isModEnabled('contract')) { print_liste_field_titre("Contract", $_SERVER['PHP_SELF'], "f.fk_contrat", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index cf3751fa06e..abe2c3131fd 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -290,11 +290,12 @@ class FichinterRec extends Fichinter */ public function fetch($rowid = 0, $ref = '', $ref_ext = '') { - $sql = 'SELECT f.title as title, f.fk_soc'; + $sql = 'SELECT f.title, f.fk_soc'; $sql .= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description'; $sql .= ', f.note_private, f.note_public, f.fk_user_author'; $sql .= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.auto_validate'; $sql .= ', f.note_private, f.note_public, f.fk_user_author'; + $sql .= ', f.status'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinter_rec as f'; if ($rowid > 0) { $sql .= " WHERE f.rowid = ".((int) $rowid); @@ -311,28 +312,28 @@ class FichinterRec extends Fichinter $this->id = $rowid; $this->title = $obj->title; - $this->ref = $obj->title; + $this->ref = $obj->title; $this->description = $obj->description; - $this->datec = $obj->datec; + $this->datec = $obj->datec; $this->duration = $obj->duree; - $this->socid = $obj->fk_soc; - $this->status = 0; - $this->statut = 0; // deprecated - $this->fk_project = $obj->fk_projet; - $this->fk_contrat = $obj->fk_contrat; + $this->socid = $obj->fk_soc; + $this->status = $obj->status; + $this->statut = $obj->status; // deprecated + $this->fk_project = $obj->fk_projet; + $this->fk_contrat = $obj->fk_contrat; $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->user_author = $obj->fk_user_author; - $this->model_pdf = empty($obj->model_pdf) ? "" : $obj->model_pdf; + $this->note_public = $obj->note_public; + $this->user_author = $obj->fk_user_author; + $this->model_pdf = empty($obj->model_pdf) ? "" : $obj->model_pdf; $this->rang = !empty($obj->rang) ? $obj->rang : ""; $this->special_code = !empty($obj->special_code) ? $obj->special_code : ""; - $this->frequency = $obj->frequency; + $this->frequency = $obj->frequency; $this->unit_frequency = $obj->unit_frequency; - $this->date_when = $this->db->jdate($obj->date_when); - $this->date_last_gen = $this->db->jdate($obj->date_last_gen); + $this->date_when = $this->db->jdate($obj->date_when); + $this->date_last_gen = $this->db->jdate($obj->date_last_gen); $this->nb_gen_done = $obj->nb_gen_done; $this->nb_gen_max = $obj->nb_gen_max; - $this->auto_validate = $obj->auto_validate; + $this->auto_validate = $obj->auto_validate; // Lines $result = $this->fetch_lines(); @@ -874,7 +875,7 @@ class FichinterRec extends Fichinter $sql .= ' , date_last_gen = now()'; // si on et arrivé à la fin des génération if ($this->nb_gen_max <= $this->nb_gen_done + 1) { - $sql .= ' , statut = 1'; + $sql .= ' , status = 1'; } $sql .= " WHERE rowid = ".((int) $this->id); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 8b73838d634..37a04ad56bb 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -189,7 +189,8 @@ ALTER TABLE llx_product_customer_price_log ADD COLUMN price_label varchar(255) A ALTER TABLE llx_product_customer_price ADD COLUMN price_label varchar(255) AFTER fk_user; ALTER TABLE llx_product ADD COLUMN price_label varchar(255) AFTER price_base_type; - +ALTER TABLE llx_fichinter_rec ADD COLUMN status smallint DEFAULT 0; +ALTER TABLE llx_fichinter_rec CHANGE COLUMN titre title varchar(50) NOT NULL; CREATE TABLE llx_product_thirdparty ( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, @@ -313,4 +314,3 @@ DELETE FROM llx_c_action_trigger WHERE code = 'BILLREC_AUTOCREATEBILL'; -- element_element, see https://github.com/Dolibarr/dolibarr/pull/29329 ALTER TABLE element_element ADD COLUMN relationtype varchar(64) DEFAULT NULL AFTER targettype; - diff --git a/htdocs/install/mysql/tables/llx_fichinter_rec.sql b/htdocs/install/mysql/tables/llx_fichinter_rec.sql index 4f52e9f4600..bd261ed6519 100644 --- a/htdocs/install/mysql/tables/llx_fichinter_rec.sql +++ b/htdocs/install/mysql/tables/llx_fichinter_rec.sql @@ -23,7 +23,7 @@ create table llx_fichinter_rec ( rowid integer AUTO_INCREMENT PRIMARY KEY, - titre varchar(50) NOT NULL, + title varchar(50) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer DEFAULT NULL, datec datetime, -- date de creation @@ -43,6 +43,6 @@ create table llx_fichinter_rec date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented) nb_gen_max integer DEFAULT NULL, -- maximum number of generation - auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention - + auto_validate integer NULL DEFAULT NULL, -- status of the generated intervention + status smallint DEFAULT 0 -- status of the model )ENGINE=innodb; From 0dd7d14ca7c2c75dd6cdee39315195bf8e46d749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Apr 2024 22:55:28 +0200 Subject: [PATCH 04/11] fix ajax product search (#29538) --- htdocs/product/ajax/products.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 711af593d2e..40e30036df0 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +45,8 @@ require '../../main.inc.php'; $htmlname = GETPOST('htmlname', 'aZ09'); $socid = GETPOSTINT('socid'); -$type = GETPOSTINT('type'); +// type can be empty string or 0 or 1 +$type = GETPOST('type', 'int'); $mode = GETPOSTINT('mode'); $status = ((GETPOSTINT('status') >= 0) ? GETPOSTINT('status') : - 1); // status buy when mode = customer , status purchase when mode = supplier $status_purchase = ((GETPOSTINT('status_purchase') >= 0) ? GETPOSTINT('status_purchase') : - 1); // status purchase when mode = customer From 9d81482dba2f0ca86ee3c9ae9218dcc54f22c249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Apr 2024 23:41:37 +0200 Subject: [PATCH 05/11] enable includedocgeneration (#29539) --- htdocs/admin/hrm.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 521e9a0621a..8b3db038689 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -68,9 +68,15 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $moduledir = 'hrm'; -$myTmpObjects = array(); // TODO Scan list of objects to fill this array -$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'Evaluation'); +$myTmpObjects = [ + 'evaluation' => [ + 'label' => 'Evaluation', + 'includerefgeneration' => 1, + 'includedocgeneration' => 1, + 'class' => 'Evaluation' + ], +]; $tmpobjectkey = GETPOST('object', 'aZ09'); if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) { From c0784ac9d6ad7ca609574417e57686ac4f6254a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2024 00:28:47 +0200 Subject: [PATCH 06/11] Debug v20 --- htdocs/admin/hrm.php | 3 +- .../modules/hrm/doc/pdf_standard.modules.php | 1 + .../install/mysql/migration/19.0.0-20.0.0.sql | 2 ++ .../mysql/tables/llx_hrm_evaluation-hrm.sql | 31 ++++++++++--------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 8b3db038689..685f2db64c8 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -36,6 +36,7 @@ global $langs, $user; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm.lib.php'; require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php'; //require_once "../class/myclass.class.php"; // Translations @@ -136,7 +137,7 @@ if ($action == 'update') { $classname = ''; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); + $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { $classname = "pdf_".$modele; break; diff --git a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php index 35877acb40a..b7a2078bd3a 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php @@ -590,6 +590,7 @@ class pdf_standard extends ModelePDFEvaluation $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities('Employee').' : '.$outputlangs->convToOutputCharset(ucfirst($employee->firstname) . ' ' . strtoupper($employee->lastname)); // Position + include_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; $job = new Job($db); $job->fetch($object->fk_job); $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities('JobProfile').' : '.$outputlangs->convToOutputCharset($job->label); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 37a04ad56bb..0a4829fd61b 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -231,6 +231,8 @@ ALTER TABLE llx_product DROP COLUMN onportal; ALTER TABLE llx_product ADD COLUMN last_main_doc varchar(255); +ALTER TABLE llx_hrm_evaluation ADD COLUMN last_main_doc varchar(255); + ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtext; ALTER TABLE llx_commande_fournisseur_dispatch_extrafields RENAME TO llx_receptiondet_batch_extrafields; diff --git a/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql b/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql index 7fce5a1bd6b..97bf73f3a01 100644 --- a/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql +++ b/htdocs/install/mysql/tables/llx_hrm_evaluation-hrm.sql @@ -18,22 +18,23 @@ CREATE TABLE llx_hrm_evaluation( -- BEGIN MODULEBUILDER FIELDS - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) DEFAULT '(PROV)' NOT NULL, - label varchar(255), - description text, - note_public text, - note_private text, - model_pdf varchar(255), + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) DEFAULT '(PROV)' NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + model_pdf varchar(255), last_main_doc varchar(255), - date_creation datetime NOT NULL, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - fk_user_creat integer NOT NULL, - fk_user_modif integer, - import_key varchar(14), - status smallint NOT NULL, + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status smallint NOT NULL, date_eval date, - fk_user integer NOT NULL, - fk_job integer NOT NULL + fk_user integer NOT NULL, + fk_job integer NOT NULL, + last_main_doc varchar(255) -- END MODULEBUILDER FIELDS ) ENGINE=innodb; From f4e8fd2b5fd8b9c2ad291f18fd97c61cc8281ce7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2024 01:01:01 +0200 Subject: [PATCH 07/11] Debug v20 --- htdocs/admin/hrm.php | 8 +++++--- htdocs/core/lib/files.lib.php | 1 - htdocs/document.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 685f2db64c8..c214e9676a5 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -151,7 +151,7 @@ if ($action == 'update') { '@phan-var-force CommonDocGenerator $module'; if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=hrm&file=evaluation/SPECIMEN.pdf"); return; } else { setEventMessages($module->error, null, 'errors'); @@ -368,8 +368,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { dol_print_error($db); } - print "
\n"; - print "\n"; + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print '
'."\n"; + print ''."\n"; print ''; print ''; print '\n"; @@ -484,6 +485,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."
'; + print '
'; } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7f9a959f594..8b318d895a6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3254,7 +3254,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if ($fuser->hasRight('banque', $lire) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - $original_file = $conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result } elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { // Wrapping for bank diff --git a/htdocs/document.php b/htdocs/document.php index 2090fe89838..e204956acd3 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -103,7 +103,7 @@ $original_file = GETPOST('file', 'alphanohtml'); $hashp = GETPOST('hashp', 'aZ09'); $modulepart = GETPOST('modulepart', 'alpha'); $urlsource = GETPOST('urlsource', 'alpha'); -$entity = GETPOSTINT('entity') ?GETPOSTINT('entity') : $conf->entity; +$entity = GETPOSTINT('entity', $conf->entity); // Security check if (empty($modulepart) && empty($hashp)) { From d61afcc74c4049f06a5ee2bd68c3b4fe8003777e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2024 01:08:15 +0200 Subject: [PATCH 08/11] trans --- htdocs/langs/en_US/hrm.lang | 19 ++++++++++--------- htdocs/langs/en_US/trips.lang | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 4d99d0439ec..4219b7376ec 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -24,7 +24,7 @@ SkillsManagement=Skills management HRM_MAXRANK=Maximum number of levels to rank a skill HRM_DEFAULT_SKILL_DESCRIPTION=Default description of ranks when skill is created deplacement=Shift -DateEval=Evaluation date +DateEval=Competency assessment date JobCard=Job card NewJobProfile=New Job Profile JobProfile=Job profile @@ -41,12 +41,12 @@ Skill=Skill Skills=Skills SkillCard=Skill card EmployeeSkillsUpdated=Employee skills have been updated (see "Skills" tab of employee card) -Eval=Evaluation -Evals=Evaluations -NewEval=New evaluation -ValidateEvaluation=Validate evaluation -ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with the reference %s? -EvaluationCard=Evaluation card +Eval=Competency assessment +Evals=Competency assessments +NewEval=New competency assessment +ValidateEvaluation=Validate competency assessment +ConfirmValidateEvaluation=Are you sure you want to validate this competency assessment with the reference %s? +EvaluationCard=Competency assessment RequiredRank=Required rank for the job profile RequiredRankShort=Required rank PositionsWithThisProfile=Positions with this job profiles @@ -90,8 +90,9 @@ SaveAddSkill = Skill(s) added SaveLevelSkill = Skill(s) level saved DeleteSkill = Skill removed SkillsExtraFields=Complementary attributes (Skills) -JobsExtraFields=Complementary attributes (Job profile) -EvaluationsExtraFields=Complementary attributes (Evaluations) +JobsExtraFields=Complementary attributes (Job profiles) +EvaluationsExtraFields=Complementary attributes (Competency assessments) NeedBusinessTravels=Need business travels NoDescription=No description TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has no skill defined on it. Please add skill(s), then delete and restart the evaluation. +PDFStandardHrmEvaluation=Standard template to generate a PDF document for a competency assessment diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index d84ea05a786..1595e6dcd5a 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -95,7 +95,7 @@ nolimitbyEX_YEA=by year (no limitation) NoTripsToExportCSV=No expense report to export for this period. NOT_AUTHOR=You are not the author of this expense report. Operation canceled. OnExpense=Expense line -PDFStandardExpenseReports=Standard template to generate a PDF document for expense report +PDFStandardExpenseReports=Standard template to generate a PDF document for an expense report PaidTrip=Pay an expense report REFUSEUR=Denied by RangeIk=Mileage range From 662162ce85ee1ebd013c36d27c7e85f8edb38f58 Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Tue, 30 Apr 2024 01:10:22 +0200 Subject: [PATCH 09/11] FIX display massaction for bank entries list (#29533) * FIX display massaction for bank entries list * remove lignes --- htdocs/compta/bank/bankentries_list.php | 34 +++++-------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index d5d2488c092..e2e3e2d17d2 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1086,6 +1086,8 @@ if ($resql) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields + $selectedfields .= ($action == 'reconcile' ? $form->showCheckAddButtons('checkforselect', 1) : ''); + // When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation). if ($action == 'reconcile') { $arrayfields['b.num_releve']['checked'] = 1; @@ -1401,14 +1403,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['b.num_releve']['checked'])) { - print ''; - print ''; - print ' '; - print ''; + print ''; } // conciliate @@ -1462,12 +1457,8 @@ if ($resql) { // Action column if (getDolGlobalString('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($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if (!$objp->conciliated && $action == 'reconcile') { + print 'rowid]) ? ' checked' : '').'>'; } print ''; if (!$i) { @@ -1799,13 +1790,6 @@ if ($resql) { if ($objp->num_releve) { print ''.dol_escape_htmltag($objp->num_releve).''; } - if (!$objp->conciliated && $action == 'reconcile') { - if ($objp->num_releve) { - print ' '; - } - $tmparray = GETPOST('rowid', 'array:int'); - print 'rowid]) ? ' checked' : '').'>'; - } } print ''; if (!$i) { @@ -1874,12 +1858,8 @@ if ($resql) { // Action column if (!getDolGlobalString('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($objp->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + if (!$objp->conciliated && $action == 'reconcile') { + print 'rowid]) ? ' checked' : '').'>'; } print ''; if (!$i) { From 5c66d59557a3ca4f5acf6caac3aef5d0000c2562 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2024 01:14:18 +0200 Subject: [PATCH 10/11] Doc --- htdocs/compta/bank/bankentries_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index e2e3e2d17d2..4583d28a456 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -8,8 +8,8 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2021 Gauthier VERDOL * * 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 From 8ff36d2dca204da38191cbb902400e0956a28cb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Apr 2024 02:47:03 +0200 Subject: [PATCH 11/11] Debug v20 --- htdocs/compta/bank/bankentries_list.php | 170 ++++++++++++------------ htdocs/compta/bank/releve.php | 24 ++-- htdocs/core/class/html.form.class.php | 1 + htdocs/core/lib/functions.lib.php | 5 +- htdocs/product/stock/list.php | 5 +- htdocs/theme/eldy/global.inc.php | 7 +- htdocs/theme/md/style.css.php | 5 + 7 files changed, 119 insertions(+), 98 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 4583d28a456..c2ccf442c28 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -819,84 +819,6 @@ if ($resql) { print ''; } - // Form to reconcile - if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') { - print '
'; - if (getDolGlobalInt('NW_RECEIPTNUMBERFORMAT')) { - print ''.$langs->trans("InputReceiptNumber").': '; - print ''; - } else { - $texttoshow = $langs->trans("InputReceiptNumber").': '; - $yyyy = dol_substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1); - $mm = dol_substr($langs->transnoentitiesnoconv("Month"), 0, 1).substr($langs->transnoentitiesnoconv("Month"), 0, 1); - $dd = dol_substr($langs->transnoentitiesnoconv("Day"), 0, 1).substr($langs->transnoentitiesnoconv("Day"), 0, 1); - $placeholder = $yyyy.$mm; - $placeholder .= ' '.$langs->trans("or").' '; - $placeholder .= $yyyy.$mm.$dd; - if (!$placeholder) { - $texttoshow .= $langs->trans("InputReceiptNumberBis"); - } - print $texttoshow; - print ''; // The only default value is value we just entered - } - print '
'; - if (is_array($options) && count($options)) { - print $langs->trans("EventualyAddCategory").': '; - print Form::selectarray('cat', $options, GETPOST('cat'), 1); - } - print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; - print ''; - print ' '.$langs->trans("or").' '; - print ''; - print ' '.$langs->trans("or").' '; - print ''; - print '
'; - - // Show last bank statements - $nbmax = 12; // We show last 12 receipts (so we can have more than one year) - $liste = ""; - $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".((int) $object->id)." AND num_releve IS NOT NULL"; - $sql .= $db->order("num_releve", "DESC"); - $sql .= $db->plimit($nbmax + 1); - print '
'; - print $langs->trans("LastAccountStatements").' : '; - $resqlr = $db->query($sql); - if ($resqlr) { - $numr = $db->num_rows($resqlr); - $i = 0; - $last_ok = 0; - while (($i < $numr) && ($i < $nbmax)) { - $objr = $db->fetch_object($resqlr); - if (!$last_ok) { - $last_releve = $objr->num_releve; - $last_ok = 1; - } - $i++; - $liste = ''.$objr->num_releve.'   '.$liste; - } - if ($numr >= $nbmax) { - $liste = "...   ".$liste; - } - print $liste; - if ($numr <= 0) { - print ''.$langs->trans("None").''; - } - } else { - dol_print_error($db); - } - - // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) - if (getDolGlobalString('BANK_REPORT_LAST_NUM_RELEVE')) { - print ' - - '; - } - print '

'; - } - // Form to add a transaction with no invoice if ($user->hasRight('banque', 'modifier') && $action == 'addline' && getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT')) { print load_fiche_titre($langs->trans("AddBankRecordLong"), '', ''); @@ -991,7 +913,7 @@ if ($resql) { $bankcateg = new BankCateg($db); $newcardbutton = ''; - if ($action != 'addline' && $action != 'reconcile') { + if ($action != 'addline') { if (!getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) { if (!getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT')) { // Default is to record miscellaneous direct entries using miscellaneous payments $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.urlencode($search_account).'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); @@ -1015,7 +937,7 @@ if ($resql) { $morehtml .= $buttonreconcile; } - $morehtml .= ''.$newcardbutton; + $morehtmlright = ''.$newcardbutton; $picto = 'bank_account'; if ($id > 0 || !empty($ref)) { @@ -1023,7 +945,86 @@ if ($resql) { } // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton.$morehtml, $num, $nbtotalofrecords, $picto, 0, $morehtmlright, '', $limit, 0, 0, 1); + + // Form to reconcile + if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') { + print ''."\n"; + print '
'; + if (getDolGlobalInt('NW_RECEIPTNUMBERFORMAT')) { + print ''.$langs->trans("InputReceiptNumber").': '; + print ''; + } else { + $texttoshow = $langs->trans("InputReceiptNumber").': '; + $yyyy = dol_substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1); + $mm = dol_substr($langs->transnoentitiesnoconv("Month"), 0, 1).substr($langs->transnoentitiesnoconv("Month"), 0, 1); + $dd = dol_substr($langs->transnoentitiesnoconv("Day"), 0, 1).substr($langs->transnoentitiesnoconv("Day"), 0, 1); + $placeholder = $yyyy.$mm; + $placeholder .= ' '.$langs->trans("or").' '; + $placeholder .= $yyyy.$mm.$dd; + if (!$placeholder) { + $texttoshow .= $langs->trans("InputReceiptNumberBis"); + } + print $texttoshow; + print ''; // The only default value is value we just entered + } + print '
'; + if (is_array($options) && count($options)) { + print $langs->trans("EventualyAddCategory").': '; + print Form::selectarray('cat', $options, GETPOST('cat'), 1); + } + print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; + print ''; + print ' '.$langs->trans("or").' '; + print ''; + print ' '.$langs->trans("or").' '; + print ''; + print '
'; + + // Show last bank statements + $nbmax = 12; // We show last 12 receipts (so we can have more than one year) + $liste = ""; + $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".((int) $object->id)." AND num_releve IS NOT NULL"; + $sql .= $db->order("num_releve", "DESC"); + $sql .= $db->plimit($nbmax + 1); + print '
'; + print $langs->trans("LastAccountStatements").' : '; + $resqlr = $db->query($sql); + if ($resqlr) { + $numr = $db->num_rows($resqlr); + $i = 0; + $last_ok = 0; + while (($i < $numr) && ($i < $nbmax)) { + $objr = $db->fetch_object($resqlr); + if (!$last_ok) { + $last_releve = $objr->num_releve; + $last_ok = 1; + } + $i++; + $liste = ''.dol_escape_htmltag($objr->num_releve).'   '.$liste; + } + if ($numr >= $nbmax) { + $liste = "...   ".$liste; + } + print $liste; + if ($numr <= 0) { + print ''.$langs->trans("None").''; + } + } else { + dol_print_error($db); + } + + // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) + if (getDolGlobalString('BANK_REPORT_LAST_NUM_RELEVE')) { + print ' + + '; + } + print '

'; + } // We can add page now to param if ($page != '') { @@ -1031,7 +1032,6 @@ if ($resql) { } $moreforfilter = ''; - $moreforfilter .= '
'; $moreforfilter .= $langs->trans('DateOperationShort'); $moreforfilter .= ($conf->browser->layout == 'phone' ? '
' : ' '); @@ -1456,7 +1456,7 @@ if ($resql) { // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; if (!$objp->conciliated && $action == 'reconcile') { print 'rowid]) ? ' checked' : '').'>'; } @@ -1857,7 +1857,7 @@ if ($resql) { // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; if (!$objp->conciliated && $action == 'reconcile') { print 'rowid]) ? ' checked' : '').'>'; } @@ -1891,7 +1891,7 @@ if ($resql) { } elseif ($i == $posconciliatecol) { print ''; if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') { - print ''; + print ''; } print ''; } else { diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ef5d98f2d93..7911ff8406c 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -274,6 +274,7 @@ if (empty($numref)) { $sql = "SELECT DISTINCT(b.num_releve) as numr"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " WHERE b.fk_account = ".((int) $object->id); + $sql .= " AND b.num_releve IS NOT NULL"; $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -285,9 +286,9 @@ if (empty($numref)) { $sql .= $db->plimit($conf->liste_limit + 1, $offset); - $result = $db->query($sql); - if ($result) { - $numrows = $db->num_rows($result); + $resql = $db->query($sql); + if ($resql) { + $numrows = $db->num_rows($resql); $i = 0; // Onglets @@ -360,7 +361,7 @@ if (empty($numref)) { $content = array(); while ($i < min($numrows, $conf->liste_limit)) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); if (!isset($objp->numr)) { // @@ -414,6 +415,11 @@ if (empty($numref)) { } $i++; } + + if (empty($numrows)) { + print ''.$langs->trans("None").''; + } + print "\n"; print ''; @@ -481,9 +487,9 @@ if (empty($numref)) { // Recherche les ecritures pour le releve $sql = $sqlrequestforbankline; - $result = $db->query($sql); - if ($result) { - $numrows = $db->num_rows($result); + $resql = $db->query($sql); + if ($resql) { + $numrows = $db->num_rows($resql); $i = 0; // Ligne Solde debut releve @@ -493,7 +499,7 @@ if (empty($numref)) { print "\n"; while ($i < $numrows) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $total = $total + $objp->amount; print ''; @@ -696,7 +702,7 @@ if (empty($numref)) { print ""; $i++; } - $db->free($result); + $db->free($resql); } else { dol_print_error($db); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4bf5d9f6fcf..bb19b01f538 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8587,6 +8587,7 @@ class Form } } $out .= ""; + // Add code for jquery to use multiselect if ($addjscombo && $jsbeautify) { // Enhance with select2 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 669a402e298..e16a732bd6c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6235,7 +6235,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be print ''; } else { print '
  • '; - print ''; } $tmpchoice = explode(',', $pagesizechoices); $tmpkey = $limit.':'.$limit; @@ -6263,7 +6263,8 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be print ''; } else { print ''; - print ajax_combobox("limit"); + print ajax_combobox("limit", array(), 0, 0, 'resolve', -1, 'limit'); + //print ajax_combobox("limit"); } if ($conf->use_javascript_ajax) { diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 3d684a71a09..7caef3b1493 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -335,6 +335,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); +//print $sql; $result = $db->query($sql); if ($result) { @@ -358,7 +359,9 @@ $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/LEFT JOIN [a-z]+_product_stock as ps ON t.rowid = ps.fk_entrepot LEFT JOIN [a-z]+_product as p ON ps.fk_product = p.rowid/', '', $sqlforcount); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); if ($resql) { $objforcount = $db->fetch_object($resql); @@ -557,7 +560,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), (isset($val['notnull']) ? $val['notnull'] : 0), 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d26256632c2..8095fb1ae42 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1406,7 +1406,7 @@ select.flat.selectlimit { border-bottom-left-radius: 0; border-bottom-right-radius: 0; } -.selectlimit, .marginrightonly { +.marginrightonly { margin-: 10px !important; } .marginleftonly { @@ -6833,6 +6833,11 @@ select.multiselectononeline { } } +/* must be after the other .select2-container.select2-container--open .select2-dropdown.ui-dialog */ +.limit.select2-container.select2-container--open .select2-dropdown.ui-dialog { + min-width: 100px !important; +} + /* ============================================================================== */ /* For categories */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 17e77437fbc..1d56e60b832 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6714,6 +6714,11 @@ select.multiselectononeline { } } +/* must be after the other .select2-container.select2-container--open .select2-dropdown.ui-dialog */ +.limit.select2-container.select2-container--open .select2-dropdown.ui-dialog { + min-width: 100px !important; +} + .parentonrightofpage { direction: rtl; }