From 24c5fcb5a7b0e6e0c2b97062bace7c5eab67a363 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sun, 15 Jan 2023 10:24:19 +0100 Subject: [PATCH 01/18] Update to PHP 8.1 --- build/docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index ead2a8af1c5..69f4d27b26f 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.3-apache +FROM php:8.1-apache-bullseye ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_MEMORY_LIMIT 256M @@ -25,7 +25,7 @@ RUN apt-get update -y \ mailutils \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* \ - && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-install -j$(nproc) ldap && \ From 0cb2af4ecb26b9cfdc932538e952a3918cb83a59 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sun, 15 Jan 2023 10:42:52 +0100 Subject: [PATCH 02/18] Fix update PHP config --- build/docker/README.md | 2 +- build/docker/docker-compose.yml | 2 ++ build/docker/docker-run.sh | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/docker/README.md b/build/docker/README.md index d469c7c7aae..007b5db6ace 100644 --- a/build/docker/README.md +++ b/build/docker/README.md @@ -25,7 +25,7 @@ The URL to go to the Dolibarr is : The URL to go to PhpMyAdmin is (login/password is root/root) : http://0.0.0.0:8080 - + In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev http://0.0.0.0:8081 diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 8994043cd8a..e197d5dd06e 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -34,6 +34,8 @@ services: build: . environment: HOST_USER_ID: $HOST_USER_ID + PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE + PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT volumes: - ../../htdocs:/var/www/html/ - ../../documents:/var/documents diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh index 4e69ea4a3a2..fbd256ab625 100644 --- a/build/docker/docker-run.sh +++ b/build/docker/docker-run.sh @@ -15,10 +15,10 @@ fi echo "[docker-run] => Set Permission to www-data for /var/documents" chown -R www-data:www-data /var/documents -if [ ! -f /usr/local/etc/php/php.ini ]; then - cat < /usr/local/etc/php/php.ini -date.timezone = $PHP_INI_DATE_TIMEZONE +echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini" +cat < ${PHP_INI_DIR}/conf.d/dolibarr-php.ini +date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC} +memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M} EOF -fi exec apache2-foreground From 70f3a6d84701dc212a905a27d4edadf64e440e36 Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 15 Jan 2023 22:53:17 +0100 Subject: [PATCH 03/18] load bom class file. --- htdocs/mrp/mo_list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 99e91fec184..c3ae9247c9d 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; // load mrp libraries require_once __DIR__.'/class/mo.class.php'; From 9b164b907c1a9e9b641ff7bd9d4c308e9e36ba83 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 16 Jan 2023 19:25:54 +0100 Subject: [PATCH 04/18] Add warehouse modify and create triggers. Clean and remove deprecated vars. --- htdocs/product/stock/class/entrepot.class.php | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 065883e7a2c..ce5bef9c939 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -182,16 +182,17 @@ class Entrepot extends CommonObject /** * Creation d'un entrepot en base * - * @param User $user Object user that create the warehouse + * @param User $user Object user that create the warehouse + * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int >0 if OK, =<0 if KO */ - public function create($user) + public function create($user, $notrigger = false) { global $conf; $error = 0; - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); // Error if label not defined if ($this->label == '') { @@ -222,14 +223,21 @@ class Entrepot extends CommonObject // Actions on extra fields if (!$error) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return $id; @@ -254,11 +262,12 @@ class Entrepot extends CommonObject /** * Update properties of a warehouse * - * @param int $id id of warehouse to modify - * @param User $user User object + * @param int $id id of warehouse to modify + * @param User $user User object + * @param bool $notrigger false=launch triggers after, true=disable trigge * @return int >0 if OK, <0 if KO */ - public function update($id, $user) + public function update($id, $user, $notrigger = false) { global $conf; @@ -267,9 +276,6 @@ class Entrepot extends CommonObject if (empty($id)) { $id = $this->id; } - if (empty($this->label)) { - $this->label = $this->libelle; // For backward compatibility - } // Check if new parent is already a child of current warehouse if (!empty($this->fk_parent)) { @@ -281,7 +287,7 @@ class Entrepot extends CommonObject } } - $this->label = trim(!empty($this->label) ? $this->label : $this->libelle); + $this->label = trim($this->label); $this->description = trim($this->description); @@ -324,6 +330,15 @@ class Entrepot extends CommonObject } } + if (!$error && !$notrigger) { + // Call triggers + $result = $this->call_trigger('WAREHOUSE_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { $this->db->commit(); return 1; @@ -461,7 +476,6 @@ class Entrepot extends CommonObject $this->fk_project = $obj->fk_project; $this->ref = $obj->label; $this->label = $obj->label; - $this->libelle = $obj->label; // deprecated $this->description = $obj->description; $this->statut = $obj->statut; $this->lieu = $obj->lieu; @@ -705,7 +719,7 @@ class Entrepot extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref); + $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); if (!empty($this->lieu)) { $label .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; } @@ -742,7 +756,7 @@ class Entrepot extends CommonObject $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : (empty($this->label) ? $this->libelle : $this->label)); + $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label); } $result .= $linkend; @@ -798,7 +812,7 @@ class Entrepot extends CommonObject // phpcs:enable global $user, $langs, $conf; - $TArbo = array(empty($this->label) ? $this->libelle : $this->label); + $TArbo = array($this->label); $protection = 100; // We limit depth of warehouses to 100 From 73f4b80a0588a787f55e786dbc6b8f8062519d7c Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 16 Jan 2023 19:47:32 +0100 Subject: [PATCH 05/18] Update changelog for removed libelle --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1a3e96b18ce..fe39e1c1497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Following changes may create regressions for some external modules, but were nec * The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead. * The method "nb_expedition()" has been renamed into "countNbOfShipments()" * Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). +* Deprecated property libelle removed from entrepot class. From ce0c69ae96d589d91b3eef113ccc15d6ad65d231 Mon Sep 17 00:00:00 2001 From: Randall Mora <50120822+randallmoraes@users.noreply.github.com> Date: Mon, 16 Jan 2023 23:15:51 -0600 Subject: [PATCH 06/18] Restrict by supplier instead of customer restrict permissions if user does not have access to view providers --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a671ea31756..d354bc2445c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1273,7 +1273,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); } if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire') ); } $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire')); From 95b391ae0a944e83b4f3d393a54a803c35e485da Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 10:21:00 +0100 Subject: [PATCH 07/18] Fix - pos total qty --- htdocs/commande/list_det.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..a763394b15b 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1509,10 +1509,7 @@ if ($resql) { } // Product QtyOrdered if (!empty($arrayfields['cdet.qty']['checked'])) { - print ''.$obj->qty.''; - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; - } + print ''.$obj->qty.''; if (isset($totalarray['val']['cdet.qty'])) { $totalarray['val']['cdet.qty'] += $obj->qty; } else { @@ -1521,6 +1518,9 @@ if ($resql) { if (!$i) { $totalarray['nbfield']++; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'cdet.qty'; + } } // Ref From eb6b42d1e34f8f177f58f62e473b26a59bb6b017 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 11:25:16 +0100 Subject: [PATCH 08/18] NEW - Add sub total in order list det --- htdocs/commande/list_det.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..e638e56ff9a 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1402,6 +1402,7 @@ if ($resql) { $total_ht = 0; $total_margin = 0; + // Détail commande $totalqty = 0; @@ -1419,6 +1420,15 @@ if ($resql) { $text_warning = ''; $nbprod = 0; + // Print SubTotal + if (empty($i)) { + $oldref = $obj->product_ref; + } + if ($oldref != $obj->product_ref) { + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + $oldref = $obj->product_ref; + } + $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->name_alias = $obj->alias; From 9c082d5df26e89494225b96aec026162b700cc0b Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 11:31:40 +0100 Subject: [PATCH 09/18] kanban mode for liste of expensereport --- .../class/expensereport.class.php | 37 ++ htdocs/expensereport/list.php | 373 ++++++++++-------- 2 files changed, 237 insertions(+), 173 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 63cbeaad67b..e0b10319b45 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2675,6 +2675,43 @@ class ExpenseReport extends CommonObject return -1; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_user_author') && !empty($this->id)) { + $return .= '
'.$this->fk_user_author.''; + } + if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { + $return .= '
'.dol_print_date($this->date_debut, 'day').''; + $return .= ' '.$langs->trans("To").' '; + $return .= ''.dol_print_date($this->date_fin, 'day').''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ad16d5fb09f..918c916a52c 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -50,6 +50,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'expensereportlist'; +$mode = GETPOST('mode', 'alpha'); $childids = $user->getAllChildIds(1); @@ -378,6 +379,9 @@ if ($resql) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -471,6 +475,7 @@ if ($resql) { print ''; print ''; print ''; + print ''; if ($id > 0) { print ''; } @@ -512,7 +517,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->rights->expensereport->creer); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'trip', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -739,185 +747,204 @@ if ($resql) { $expensereportstatic->note_private = $obj->note_private; $expensereportstatic->note_public = $obj->note_public; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + $usertmp->fetch($obj->id_user); + $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); - print ''; - // 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; + // Output Kanban + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + + print $expensereportstatic->getKanbanView(''); } - print ''; } - print ''; - } - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print ''; - print ''; - print ''; - // Warning late icon and note - print ''; } - if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { - print img_warning($langs->trans("Late")); - } - if (!empty($obj->note_private) || !empty($obj->note_public)) { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - print ''; - } - print ''; - print ''; - print '
'; - print $expensereportstatic->getNomUrl(1); - print ''; - if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { - print img_warning($langs->trans("Late")); + if ($i == (min($num, $limit) - 1)) { + print ''; + print '
'; - $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; - print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); - print '
'; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // User - if (!empty($arrayfields['user']['checked'])) { - print ''; - $usertmp->id = $obj->id_user; - $usertmp->lastname = $obj->lastname; - $usertmp->firstname = $obj->firstname; - $usertmp->login = $obj->login; - $usertmp->statut = $obj->statut; - $usertmp->photo = $obj->photo; - $usertmp->email = $obj->email; - print $usertmp->getNomUrl(-1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Start date - if (!empty($arrayfields['d.date_debut']['checked'])) { - print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // End date - if (!empty($arrayfields['d.date_fin']['checked'])) { - print ''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['d.date_valid']['checked'])) { - print ''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date approval - if (!empty($arrayfields['d.date_approve']['checked'])) { - print ''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Amount HT - if (!empty($arrayfields['d.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; - } - $totalarray['val']['d.total_ht'] += $obj->total_ht; - } - // Amount VAT - if (!empty($arrayfields['d.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; - } - $totalarray['val']['d.total_tva'] += $obj->total_tva; - } - // Amount TTC - if (!empty($arrayfields['d.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; - } - $totalarray['val']['d.total_ttc'] += $obj->total_ttc; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['d.date_create']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_create), 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['d.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['d.fk_statut']['checked'])) { - print ''.$expensereportstatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // 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; + } else { + print ''; + // 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 ''; } - print ''; + print ''; } - print ''; + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print ''; + print ''; + print ''; + // Warning late icon and note + print ''; + print ''; + print '
'; + print $expensereportstatic->getNomUrl(1); + print ''; + if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) { + print img_warning($langs->trans("Late")); + } + if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) { + print img_warning($langs->trans("Late")); + } + if (!empty($obj->note_private) || !empty($obj->note_public)) { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; + print ''; + } + print ''; + $filename = dol_sanitizeFileName($obj->ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir); + print '
'; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // User + if (!empty($arrayfields['user']['checked'])) { + print ''; + $usertmp->id = $obj->id_user; + $usertmp->lastname = $obj->lastname; + $usertmp->firstname = $obj->firstname; + $usertmp->login = $obj->login; + $usertmp->statut = $obj->statut; + $usertmp->photo = $obj->photo; + $usertmp->email = $obj->email; + print $usertmp->getNomUrl(-1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Start date + if (!empty($arrayfields['d.date_debut']['checked'])) { + print ''.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // End date + if (!empty($arrayfields['d.date_fin']['checked'])) { + print ''.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['d.date_valid']['checked'])) { + print ''.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date approval + if (!empty($arrayfields['d.date_approve']['checked'])) { + print ''.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount HT + if (!empty($arrayfields['d.total_ht']['checked'])) { + print ''.price($obj->total_ht)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht'; + } + $totalarray['val']['d.total_ht'] += $obj->total_ht; + } + // Amount VAT + if (!empty($arrayfields['d.total_vat']['checked'])) { + print ''.price($obj->total_tva)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva'; + } + $totalarray['val']['d.total_tva'] += $obj->total_tva; + } + // Amount TTC + if (!empty($arrayfields['d.total_ttc']['checked'])) { + print ''.price($obj->total_ttc)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc'; + } + $totalarray['val']['d.total_ttc'] += $obj->total_ttc; + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['d.date_create']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_create), 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['d.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['d.fk_statut']['checked'])) { + print ''.$expensereportstatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // 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 ''; + } + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print "\n"; } - if (!$i) { - $totalarray['nbfield']++; - } - - print "\n"; - - $total_total_ht = $total_total_ht + $obj->total_ht; - $total_total_tva = $total_total_tva + $obj->total_tva; - $total_total_ttc = $total_total_ttc + $obj->total_ttc; - + $total_total_ht = $total_total_ht + $obj->total_ht; + $total_total_tva = $total_total_tva + $obj->total_tva; + $total_total_ttc = $total_total_ttc + $obj->total_ttc; $i++; } } else { From a165489237b8dc5da4b8213b247d33365d779e74 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 11:46:39 +0100 Subject: [PATCH 10/18] Move checkbox --- htdocs/commande/list_det.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index fd36f229e5c..385408663fd 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -830,10 +830,6 @@ if ($resql) { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); - print ''; - print ''; - print ''; - $topicmail = "SendOrderRef"; $modelmail = "order_send"; $objecttmp = new Commande($db); @@ -849,6 +845,11 @@ if ($resql) { $moreforfilter = ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= ''; + $moreforfilter .= '
'; + // If the user can view prospects other than his' if ($user->rights->user->user->lire) { $langs->load("commercial"); @@ -888,6 +889,8 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } + + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) { From c3a5d32b8dd1c33e26781112723d2506b1452ca0 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 17 Jan 2023 12:07:02 +0100 Subject: [PATCH 11/18] FIX - Filter checkbox memory to reload page --- htdocs/commande/list_det.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 385408663fd..651b8fffe8d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -793,6 +793,15 @@ if ($resql) { if ($search_fk_input_reason > 0) { $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); } + if (!empty($productobuy)) { + $param .= '&productobuy='.urlencode($productobuy); + } + if (!empty($productonly)) { + $param .= '&productonly='.urlencode($productonly); + } + if (!empty($disablelinefree)) { + $param .= '&disablelinefree='.urlencode($disablelinefree); + } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From fc8aed1a6d95d021ed5f934a10be241e18d319c3 Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 17 Jan 2023 12:16:03 +0100 Subject: [PATCH 12/18] New #23494 : add birthday to thirdparty contact list --- htdocs/core/lib/company.lib.php | 37 +++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index d49538f41dc..a29c22cbcf7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -957,7 +957,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $search_poste = GETPOST("search_poste", 'alpha'); $search_note_private = GETPOST('search_note_private', 'alphanohtml'); $search_roles = GETPOST("search_roles", 'array'); + $search_birthday_dtstart = GETPOST("search_birthday_dtstart", 'alpha'); + $search_birthday_dtend = GETPOST("search_birthday_dtend", 'alpha'); + if ($search_birthday_dtstart != '' || $search_birthday_dtend != '') { + $search_birthday_dtstart = dol_mktime(0, 0, 0, GETPOST('search_birthday_dtstartmonth', 'int'), GETPOST('search_birthday_dtstartday', 'int'), GETPOST('search_birthday_dtstartyear', 'int')); + $search_birthday_dtend = dol_mktime(23, 59, 59, GETPOST('search_birthday_dtendmonth', 'int'), GETPOST('search_birthday_dtendday', 'int'), GETPOST('search_birthday_dtendyear', 'int')); + } $socialnetworks = getArrayOfSocialNetworks(); $searchAddressPhoneDBFields = array( @@ -1007,6 +1013,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35), 'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40), + 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45), 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))), ); @@ -1018,6 +1025,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), 't.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position'=>35), 'sc.role'=>array('label'=>"ContactByDefaultFor", 'checked'=>1, 'position'=>40), + 't.birthday'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>45), 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'), ); // Extra fields @@ -1052,6 +1060,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $search_address = ''; $search_poste = ''; $search_note_private = ''; + $search_birthday_dtstart = ''; + $search_birthday_dtend = ''; $search = array(); $search_array_options = array(); @@ -1111,6 +1121,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl if ($search_note_private != '') { $param .= '&search_note_private='.urlencode($search_note_private); } + if ($search_birthday != '') { + $param .= '&search_birthday='.urlencode($search_birthday); + } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -1120,7 +1133,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,"; - $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; + $sql .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday"; $sql .= ", t.note_private"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -1144,6 +1157,12 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl if ($search_note_private) { $sql .= natural_search('t.note_private', $search_note_private); } + if ($search_birthday_dtstart != '') { + $sql .= " AND t.birthday >= '".$db->idate($search_birthday_dtstart)."'"; + } + if ($search_birthday_dtend != '') { + $sql .= " AND t.birthday <= '".$db->idate($search_birthday_dtend)."'"; + } if (count($search_roles) > 0) { $sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))"; } @@ -1188,6 +1207,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage'); } elseif (in_array($key, array('role'))) { print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300'); + } elseif (in_array($key, array('birthday'))) { + print '
'; + print $form->selectDate($search_birthday_dtstart ? $search_birthday_dtstart : '', "search_birthday_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_birthday_dtend ? $search_birthday_dtend : '', "search_birthday_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; } else { print ''; } @@ -1342,6 +1368,13 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print ''; } + // Birthday + if (!empty($arrayfields['t.birthday']['checked'])) { + print ''; + print dol_print_date($obj->birthday); + print ''; + } + // Status if (!empty($arrayfields['t.statut']['checked'])) { print ''.$contactstatic->getLibStatut(5).''; @@ -1384,7 +1417,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $i++; } } else { - $colspan = 1; + $colspan = 2; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { $colspan++; From 070128367d5df25c488045603b8c50e30184a00d Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 12:36:58 +0100 Subject: [PATCH 13/18] kanban mode for list of expensereport payments --- .../class/paymentexpensereport.class.php | 37 +++ htdocs/expensereport/payment/list.php | 233 ++++++++++-------- 2 files changed, 169 insertions(+), 101 deletions(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index c0ba86d55ff..5ca4135dc30 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -713,4 +713,41 @@ class PaymentExpenseReport extends CommonObject dol_print_error($this->db); } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'datep')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->datep), 'dayhour').''; + } + if (property_exists($this, 'fk_typepayment')) { + $return .= '
'.$langs->trans("Type").' : '.$this->fk_typepayment.''; + } + if (property_exists($this, 'fk_bank') && !is_null($this->fk_bank)) { + $return .= '
'.$langs->trans("Account").' : '.$this->fk_bank.''; + } + if (property_exists($this, 'amount') ) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index cb93aae4ff0..4c838a73b1e 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -48,6 +48,7 @@ $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist'; +$mode = GETPOST('mode', 'alpha'); $socid = GETPOST('socid', 'int'); @@ -254,6 +255,9 @@ $num = $db->num_rows($resql); $i = 0; $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { $param .= '&contextpage='.urlencode($contextpage); } @@ -315,8 +319,13 @@ print ''; print ''; print ''; +print ''; -print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, '', '', $limit, 0, 0, 1); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + +print_barre_liste($langs->trans('ExpenseReportPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'expensereport', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($search_all) { foreach ($fieldstosearchall as $key => $val) { @@ -473,116 +482,138 @@ while ($i < min($num, $limit)) { $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->ref = $objp->ref; - $paymentexpensereportstatic->datepaye = $objp->datep; + $paymentexpensereportstatic->datep = $objp->datep; + $paymentexpensereportstatic->amount = $objp->pamount; + $paymentexpensereportstatic->fk_typepayment = $objp->paiement_type; + + if ($objp->bid) { + $accountstatic->fetch($objp->bid); + $paymentexpensereportstatic->fk_bank = $accountstatic->getNomUrl(1); + } else { + $paymentexpensereportstatic->fk_bank = null; + } $userstatic->id = $objp->userid; $userstatic->lastname = $objp->lastname; $userstatic->firstname = $objp->firstname; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + print $paymentexpensereportstatic->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''.(($offset * $limit) + $i).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Ref + if (!empty($arrayfields['pndf.rowid']['checked'])) { + print ''.$paymentexpensereportstatic->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date + if (!empty($arrayfields['pndf.datep']['checked'])) { + $dateformatforpayment = 'dayhour'; + print ''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Thirdparty + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id > 0) { + print $userstatic->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Pyament type + if (!empty($arrayfields['c.libelle']['checked'])) { + $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle; + print ''.$payment_type.' '.dol_trunc($objp->num_payment, 32).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Cheque number (fund transfer) + if (!empty($arrayfields['pndf.num_payment']['checked'])) { + print ''.$objp->num_payment.''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Bank account + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + if ($objp->bid) { + $accountstatic->id = $objp->bid; + $accountstatic->ref = $objp->bref; + $accountstatic->label = $objp->blabel; + $accountstatic->number = $objp->number; + $accountstatic->iban = $objp->iban_prefix; + $accountstatic->bic = $objp->bic; + $accountstatic->currency_code = $objp->currency_code; + $accountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->code; + + print $accountstatic->getNomUrl(1); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Amount + if (!empty($arrayfields['pndf.amount']['checked'])) { + print ''.price($objp->pamount).''; + if (!$i) { + $totalarray['nbfield']++; + } + $totalarray['pos'][$checkedCount] = 'amount'; + if (empty($totalarray['val']['amount'])) { + $totalarray['val']['amount'] = $objp->pamount; + } else { + $totalarray['val']['amount'] += $objp->pamount; + } + } + + // Buttons + print ''; if (!$i) { $totalarray['nbfield']++; } + + print ''; } - - // Ref - if (!empty($arrayfields['pndf.rowid']['checked'])) { - print ''.$paymentexpensereportstatic->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Date - if (!empty($arrayfields['pndf.datep']['checked'])) { - $dateformatforpayment = 'dayhour'; - print ''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Thirdparty - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id > 0) { - print $userstatic->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Pyament type - if (!empty($arrayfields['c.libelle']['checked'])) { - $payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle; - print ''.$payment_type.' '.dol_trunc($objp->num_payment, 32).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Cheque number (fund transfer) - if (!empty($arrayfields['pndf.num_payment']['checked'])) { - print ''.$objp->num_payment.''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Bank account - if (!empty($arrayfields['ba.label']['checked'])) { - print ''; - if ($objp->bid) { - $accountstatic->id = $objp->bid; - $accountstatic->ref = $objp->bref; - $accountstatic->label = $objp->blabel; - $accountstatic->number = $objp->number; - $accountstatic->iban = $objp->iban_prefix; - $accountstatic->bic = $objp->bic; - $accountstatic->currency_code = $objp->currency_code; - $accountstatic->account_number = $objp->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->code; - - print $accountstatic->getNomUrl(1); - } else { - print ' '; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Amount - if (!empty($arrayfields['pndf.amount']['checked'])) { - print ''.price($objp->pamount).''; - if (!$i) { - $totalarray['nbfield']++; - } - $totalarray['pos'][$checkedCount] = 'amount'; - if (empty($totalarray['val']['amount'])) { - $totalarray['val']['amount'] = $objp->pamount; - } else { - $totalarray['val']['amount'] += $objp->pamount; - } - } - - // Buttons - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''; $i++; } From 86698834a3bd527b2c2abb22628069e55dec3247 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 13:25:10 +0100 Subject: [PATCH 14/18] kanban for recruitment job list --- .../class/recruitmentjobposition.class.php | 39 +++++++++++++++++++ .../recruitmentjobposition_list.php | 11 +++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index fb34e33376e..1ee8d8e51fd 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1107,4 +1107,43 @@ class RecruitmentJobPosition extends CommonObject return $error; } + + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected,$obj; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'date_planned')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->date_planned), 'day').''; + } + if (property_exists($this, 'qty')) { + $return .= '
'.$langs->trans("NbOfEmployeesExpected", '', '', '', '', 2).' : '.$this->qty.''; + } + if (property_exists($this, 'remuneration_suggested')) { + $return .= ' | '.$langs->trans("Remuneration").' : '.$this->remuneration_suggested.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index e6b538b5167..670eca08040 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -585,14 +585,21 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->date_planned = $obj->date_planned; + if ($mode == 'kanban') { if ($i == 0) { print ''; print '
'; } - // Output Kanban - print $object->getKanbanView(''); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + } + // Output Kanban + print $object->getKanbanView(''); + } if ($i == ($imaxinloop - 1)) { print '
'; print ''; From cc2ab0dd3e53d896f1aa5afcce748b217acb4a14 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 13:48:57 +0100 Subject: [PATCH 15/18] kanban mode for list of applications job --- .../class/recruitmentcandidature.class.php | 35 +++++++++++++++++++ .../recruitmentcandidature_list.php | 12 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 1690f13da56..a1e49560adb 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1024,6 +1024,41 @@ class RecruitmentCandidature extends CommonObject return $error; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_recruitmentjobposition')) { + $return .= '
'.$langs->trans('Job').' : '.$this->fk_recruitmentjobposition.''; + } + if (property_exists($this, 'phone')) { + $return .= '
'.$langs->trans("phone").' : '.$this->phone.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 9b860ac54d5..8b62a5a202f 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -735,8 +735,18 @@ while ($i < $imaxinloop) { print ''; print '
'; } + $recuitment = new RecruitmentJobPosition($db); + $recuitment->fetch($obj->fk_recruitmentjobposition); + $object->fk_recruitmentjobposition = $recuitment->getNomUrl(); + $object->phone = $obj->phone; // Output Kanban - print $object->getKanbanView(''); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; + } + // Output Kanban + print $object->getKanbanView(''); + } if ($i == ($imaxinloop - 1)) { print '
'; print ''; From 28e5c3c7e4de01b02bc74ccd8de33c635231530f Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 14:39:47 +0100 Subject: [PATCH 16/18] kanban view for list of knowledge records --- .../class/knowledgerecord.class.php | 36 +++ .../knowledgerecord_list.php | 243 ++++++++++-------- 2 files changed, 168 insertions(+), 111 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index bf2bf38bbef..6dde2c42c19 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1066,6 +1066,42 @@ class KnowledgeRecord extends CommonObject require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'question')) { + $return .= '
'.$langs->trans('Question').' : '.$this->question.''; + } + if (property_exists($this, 'lang') && !empty($this->lang)) { + $return .= '
'.$langs->trans("Language").' : lang).'">'.$langs->trans("Language_".$this->lang, '', '', '', '', 12).''; + $return .= picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"'); + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index dffd3d63d7b..1c3fce89841 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -447,8 +447,12 @@ print ''; print ''; print ''; print ''; +print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -636,131 +640,148 @@ while ($i < $imaxinloop) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - $j = 0; - print ''; - // Action column - 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; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { + $selected = 0; } - print ''; + print $object->getKanbanView(''); } - 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'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'fk_user_creat') { - if ($object->fk_user_creat > 0) { - if (isset($conf->cache['user'][$object->fk_user_creat])) { - $user_temp = $conf->cache['user'][$object->fk_user_creat]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_creat); - $conf->cache['user'][$object->fk_user_creat] = $user_temp; - } - print $user_temp->getNomUrl(-1); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + 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; } - } elseif ($key == 'fk_user_modif') { - if ($object->fk_user_modif > 0) { - if (isset($conf->cache['user'][$object->fk_user_modif])) { - $user_temp = $conf->cache['user'][$object->fk_user_modif]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_modif); - $conf->cache['user'][$object->fk_user_modif] = $user_temp; - } - print $user_temp->getNomUrl(-1); - } - } elseif ($key == 'fk_user_valid') { - if ($object->fk_user_valid > 0) { - if (isset($conf->cache['user'][$object->fk_user_valid])) { - $user_temp = $conf->cache['user'][$object->fk_user_valid]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_valid); - $conf->cache['user'][$object->fk_user_valid] = $user_temp; - } - print $user_temp->getNomUrl(-1); - } - } elseif ($key == 'lang') { - $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : ''); - print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"'); - print $labellang; - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print ''; } print ''; - if (!$i) { - $totalarray['nbfield']++; + } + 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'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'fk_user_creat') { + if ($object->fk_user_creat > 0) { + if (isset($conf->cache['user'][$object->fk_user_creat])) { + $user_temp = $conf->cache['user'][$object->fk_user_creat]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_creat); + $conf->cache['user'][$object->fk_user_creat] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'fk_user_modif') { + if ($object->fk_user_modif > 0) { + if (isset($conf->cache['user'][$object->fk_user_modif])) { + $user_temp = $conf->cache['user'][$object->fk_user_modif]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_modif); + $conf->cache['user'][$object->fk_user_modif] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'fk_user_valid') { + if ($object->fk_user_valid > 0) { + if (isset($conf->cache['user'][$object->fk_user_valid])) { + $user_temp = $conf->cache['user'][$object->fk_user_valid]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_valid); + $conf->cache['user'][$object->fk_user_valid] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif ($key == 'lang') { + $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : ''); + print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"'); + print $labellang; + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - 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; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + 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 ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } From 6083aa3e50978ccd352bae9cf9450c744c19f5c0 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 17 Jan 2023 15:19:34 +0100 Subject: [PATCH 17/18] kanban mode for list of tickets --- htdocs/ticket/class/ticket.class.php | 36 +++ htdocs/ticket/list.php | 333 +++++++++++++++------------ 2 files changed, 217 insertions(+), 152 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e27a7a5e0c7..d390fd6f351 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2932,6 +2932,42 @@ class Ticket extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs, $selected,$arrayofselected,$obj; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (in_array($this->id, $arrayofselected)) { + $selected = 1; + } + $return .= ''; + if (property_exists($this, 'fk_user_assign') && !empty($this->fk_user_assign)) { + $return .= '
'.$langs->trans("AssignedTo").' : '.$this->fk_user_assign.''; + } + if (property_exists($this, 'type_code') && !empty($this->type_code)) { + $return .= '
'.$langs->trans("Type").' : '; + $return .= $langs->getLabelFromKey($this->db, 'TicketTypeShort'.$this->type_code, 'c_ticket_type', 'code', 'label', $this->type_code); + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 79db9e0e73e..1d2cefaf622 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -629,6 +629,9 @@ if ($projectid > 0 || $project_ref) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -740,7 +743,10 @@ $url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid if (!empty($socid)) { $url .= '&socid='.$socid; } -$newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write); $picto = 'ticket'; if ($socid > 0) { @@ -999,176 +1005,199 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $object->setVarsFromFetchObj($obj); $object->status = $object->fk_statut; // fk_statut is deprecated - // Show here line of result - print ''; - // 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 ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - 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'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } - if (in_array($key, array('ref', 'fk_project'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; - } - if ($key == 'fk_statut' || $key == 'severity_code') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'fk_statut') { - print $object->getLibStatut(5); - } elseif ($key == 'subject') { - $s = $obj->subject; - print ''; - print dol_escape_htmltag($s); - print ''; - } elseif ($key == 'type_code') { - $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); - print ''; - print $s; - print ''; - } elseif ($key == 'category_code') { - $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); - print ''; - print $s; - print ''; - } elseif ($key == 'severity_code') { - $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); - print ''; - print $s; - print ''; - } elseif ($key == 'tms') { - print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); - } elseif ($key == 'fk_user_create') { - if ($object->fk_user_create > 0) { - if (isset($conf->cache['user'][$object->fk_user_create])) { - $user_temp = $conf->cache['user'][$object->fk_user_create]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_create); - $conf->cache['user'][$object->fk_user_create] = $user_temp; - } - print $user_temp->getNomUrl(-1); + print $object->getKanbanView(''); + } + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + // Show here line of result + print ''; + // 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; } - } elseif ($key == 'fk_user_assign') { - if ($object->fk_user_assign > 0) { - if (isset($conf->cache['user'][$object->fk_user_assign])) { - $user_temp = $conf->cache['user'][$object->fk_user_assign]; - } else { - $user_temp = new User($db); - $user_temp->fetch($object->fk_user_assign); - $conf->cache['user'][$object->fk_user_assign] = $user_temp; - } - print $user_temp->getNomUrl(-1); + print ''; + } + 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'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + if (in_array($key, array('ref', 'fk_project'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; + } + if ($key == 'fk_statut' || $key == 'severity_code') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + if (!empty($arrayfields['t.'.$key]['checked'])) { + print 'trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + print $cssforfield; + if ($cssforfield && array_key_exists('css', $val) && $val['css']) { + print ' '; + } + if (array_key_exists('css', $val)) { + print $val['css']; + } + if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) { + print '"'; + } + print '>'; + if ($key == 'fk_statut') { + print $object->getLibStatut(5); + } elseif ($key == 'subject') { + $s = $obj->subject; + print ''; + print dol_escape_htmltag($s); + print ''; + } elseif ($key == 'type_code') { + $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); + print ''; + print $s; + print ''; + } elseif ($key == 'category_code') { + $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + print ''; + print $s; + print ''; + } elseif ($key == 'severity_code') { + $s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); + print ''; + print $s; + print ''; + } elseif ($key == 'tms') { + print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); + } elseif ($key == 'fk_user_create') { + if ($object->fk_user_create > 0) { + if (isset($conf->cache['user'][$object->fk_user_create])) { + $user_temp = $conf->cache['user'][$object->fk_user_create]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_create); + $conf->cache['user'][$object->fk_user_create] = $user_temp; } - } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { - print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + print $user_temp->getNomUrl(-1); } - } - } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... - $tmp = explode(':', $val['type']); - if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { - // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. - //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']); - if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) { - $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']]; + } elseif ($key == 'fk_user_assign') { + if ($object->fk_user_assign > 0) { + if (isset($conf->cache['user'][$object->fk_user_assign])) { + $user_temp = $conf->cache['user'][$object->fk_user_assign]; + } else { + $user_temp = new User($db); + $user_temp->fetch($object->fk_user_assign); + $conf->cache['user'][$object->fk_user_assign] = $user_temp; + } + print $user_temp->getNomUrl(-1); + } + } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + } elseif ($key == 'ref') { + print $object->showOutputField($val, $key, $obj->$key, ''); + + // display a warning on untreated tickets + $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); + $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + if ($is_open && $should_show_warning) { + $date_last_msg_sent = (int) $object->date_last_msg_sent; + $hour_diff = ($now - $date_last_msg_sent) / 3600 ; + + if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + $creation_date = $object->datec; + $hour_diff_creation = ($now - $creation_date) / 3600 ; + if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + } + } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } + } + } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... + $tmp = explode(':', $val['type']); + if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { + // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. + //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']); + if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) { + $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']]; + } else { + $result = $object->showOutputField($val, $key, $obj->$key, ''); + $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result; + } } else { $result = $object->showOutputField($val, $key, $obj->$key, ''); - $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result; } - } else { - $result = $object->showOutputField($val, $key, $obj->$key, ''); + print $result; } - print $result; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // 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; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // 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 ''; } - print ''; + print ''; + } + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + print ''."\n"; + } $i++; } From 781c6ed0b87740dc587771fe3f2cb9bf7e20c8fe Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 17 Jan 2023 15:18:22 +0000 Subject: [PATCH 18/18] Fixing style errors. --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d354bc2445c..dbc2be872eb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1273,7 +1273,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); } if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire') ); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire')); } $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire'));