From d5e6c08319ab297297ebae7bd74b516c1c29d260 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 1 Dec 2022 16:50:32 +0100 Subject: [PATCH 01/17] NEW operation type in email collector to load or create contact --- htdocs/admin/emailcollector_card.php | 1 + .../class/emailcollector.class.php | 114 ++++++++++++++++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 4 files changed, 117 insertions(+) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 8dfafb19b63..b3d6e045470 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -668,6 +668,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $arrayoftypes = array( 'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")), 'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")), + 'loadandcreatecontact' => $langs->trans('LoadContactFromEmailOrCreate', $langs->transnoentities("Email")), 'recordjoinpiece' => 'AttachJoinedDocumentsToObject', 'recordevent' => 'RecordEvent' ); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 8d72666ad53..db932e0a4ca 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2141,6 +2141,120 @@ class EmailCollector extends CommonObject } } } + } + // Search and create contact + elseif ($operation['type'] == 'loadandcreatecontact') { + if (empty($operation['actionparam'])) { + $errorforactions++; + $this->error = "Action loadandcreatecontact has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; + $this->errors[] = $this->error; + } else { + $contact_static = new Contact($this->db); + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contact_static, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + if ($errorforthisaction) { + $errorforactions++; + } else { + if (!empty($contact_static->email) && $contact_static->email != $from) $from = $contact_static->email; + + $result = $contactstatic->fetch(0, null, '', $from); + if ($result < 0) { + $errorforactions++; + $this->error = 'Error when getting contact with email ' . $from; + $this->errors[] = $this->error; + break; + } elseif ($result == 0) { + dol_syslog("Contact with email " . $from . " was not found. We try to create it."); + $contactstatic = new Contact($this->db); + + // Create contact + $contactstatic->email = $from; + $operationslog .= '
We set property email='.dol_escape_htmltag($from); + + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($contactstatic, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + if ($errorforthisaction) { + $errorforactions++; + } else { + // Search country by name or code + if (!empty($contactstatic->country)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry('', 3, $this->db, '', 1, $contactstatic->country); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this name '" . $contactstatic->country . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this name '" . $contactstatic->country . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->country_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + $result = getCountry($contactstatic->country_code, 3, $this->db); + if ($result == 'NotDefined') { + $errorforactions++; + $this->error = "Error country not found by this code '" . $contactstatic->country_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search country by this code '" . $contactstatic->country_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->country_id = $result; + $operationslog .= '
We set property country_id='.dol_escape_htmltag($result); + } + } + + if (!$errorforactions) { + // Search state by name or code (for country if defined) + if (!empty($contactstatic->state)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this name '" . $contactstatic->state . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this name '" . $contactstatic->state . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } elseif (!empty($contactstatic->state_code)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; + $result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid'); + if (empty($result)) { + $errorforactions++; + $this->error = "Error state not found by this code '" . $contactstatic->state_code . "'"; + } elseif (!($result > 0)) { + $errorforactions++; + $this->error = "Error when search state by this code '" . $contactstatic->state_code . "'"; + $this->errors[] = $this->db->lasterror(); + } else { + $contactstatic->state_id = $result; + $operationslog .= '
We set property state_id='.dol_escape_htmltag($result); + } + } + } + + if (!$errorforactions) { + $result = $contactstatic->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = $contactstatic->error; + $this->errors = $contactstatic->errors; + } else { + $operationslog .= '
Contact created -> id = '.dol_escape_htmltag($contactstatic->id); + } + } + } + } + } + } } elseif ($operation['type'] == 'recordevent') { // Create event $actioncomm = new ActionComm($this->db); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b6c780a6be0..9fa5f7f1c28 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2119,6 +2119,7 @@ CodeLastResult=Latest result code NbOfEmailsInInbox=Number of emails in source directory LoadThirdPartyFromName=Load third party searching on %s (load only) LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found) +LoadContactFromEmailOrCreate=Load contact searching on %s (create if not found) AttachJoinedDocumentsToObject=Save attached files into object documents if a ref of an object is found into email topic. WithDolTrackingID=Message from a conversation initiated by a first email sent from Dolibarr WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 79a266df816..6a59583e7c0 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2115,6 +2115,7 @@ CodeLastResult=Dernier code de retour NbOfEmailsInInbox=Nombre de courriels dans le répertoire source LoadThirdPartyFromName=Charger le Tiers en cherchant sur %s (chargement uniquement) LoadThirdPartyFromNameOrCreate=Charger le Tiers en cherchant sur %s (créer si non trouvé) +LoadContactFromEmailOrCreate=Charger le Contact en cherchant sur %s (créer si non trouvé) AttachJoinedDocumentsToObject=Enregistrez les fichiers joints dans des documents d'objet si la référence d'un objet est trouvée dans le sujet de l'e-mail. WithDolTrackingID=Message d'une conversation initiée par un premier mail envoyé depuis Dolibarr WithoutDolTrackingID=Message d'une conversation initiée par un premier e-mail NON envoyé depuis Dolibarr From 3be0f0e1d0f2c206442cc83b7325d6f8ac6ac7d9 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 1 Dec 2022 17:21:41 +0100 Subject: [PATCH 02/17] FIX stickler-ci --- htdocs/emailcollector/class/emailcollector.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index db932e0a4ca..1393913bb35 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2141,9 +2141,7 @@ class EmailCollector extends CommonObject } } } - } - // Search and create contact - elseif ($operation['type'] == 'loadandcreatecontact') { + } elseif ($operation['type'] == 'loadandcreatecontact') { // Search and create contact if (empty($operation['actionparam'])) { $errorforactions++; $this->error = "Action loadandcreatecontact has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; From 3f2367dc16406967486a3325c29cdda3c241ad9f Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 13:49:54 +0200 Subject: [PATCH 03/17] NEW|New [Bulk delete Project tasks] Massaction to delete multiple tasks from tab Taks of Project --- htdocs/core/lib/project.lib.php | 13 +++++++++++- htdocs/projet/tasks.php | 36 +++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index b944e8b47a5..7b0b30bcaef 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -569,9 +569,10 @@ function project_admin_prepare_head() * @param string $filterprogresscalc filter text * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' * @param array $arrayfields Array with displayed coloumn information + * @param array $arrayofselected Array with selected fields * @return int Nb of tasks shown */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array()) +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array()) { global $user, $langs, $conf, $db, $hookmanager; global $projectstatic, $taskstatic, $extrafields; @@ -910,6 +911,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Tick to drag and drop print ''; + // Action column + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; + + print ''; + print "\n"; if (!$showlineingray) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 951406b4275..c619b25a37b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -183,6 +183,14 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + $parameters = array('id'=>$id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -413,6 +421,7 @@ $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); +$arrayofselected = is_array($toselect) ? $toselect : array(); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); @@ -544,6 +553,17 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + $arrayofmassactions = array( + 'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), + ); + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); + } + if (in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); + } + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + // Project card $linkback = ''.$langs->trans("BackToList").''; @@ -842,7 +862,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss'=>'reposition marginleftonly')); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'generic', 0, '', '', 0, 1); - print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask'); + print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'projecttask', '', '', '', $massactionbutton); + + $objecttmp = new Task($db); + $trackid = 'task'.$taskstatic->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). @@ -877,6 +901,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; } + // Show the massaction checkboxes only when this page is not opend from the Extended POS + if ($massactionbutton && $contextpage != 'poslist') { + $selectedfields = $form->showCheckAddButtons('checkforselect', 1); + } + print '
'; print ''; @@ -987,6 +1016,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + print ''; + // Action column print ''; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1062,7 +1094,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (count($tasksarray) > 0) { // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; - $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); + $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected); } else { $colspan = 10; if ($object->usage_bill_time) { From ccf40855d8f61981d2a083c98de38a6e07cc4464 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 14:04:54 +0200 Subject: [PATCH 04/17] Removed "Clone" option from massactions list (work in progress) --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c619b25a37b..c891179617d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -554,7 +554,7 @@ if ($id > 0 || !empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $arrayofmassactions = array( - 'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), + //'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), ); if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); From 6b6cfb13395bb6e5d706691c02f17e425b3073f7 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 16:57:22 +0200 Subject: [PATCH 05/17] Add mass action to clone selected tasks to another project --- htdocs/core/actions_massactions.inc.php | 60 +++++++++++++++++++ htdocs/core/class/html.form.class.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 12 ++++ htdocs/langs/en_US/main.lang | 3 + htdocs/langs/en_US/projects.lang | 3 +- htdocs/projet/class/project.class.php | 80 +++++++++++++++++++++++++ htdocs/projet/tasks.php | 7 ++- 7 files changed, 162 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ec2ecabcf0d..40ecab72a60 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1707,6 +1707,66 @@ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday } } +//if (!$error && $massaction == 'clonetasks' && $user->rights->projet->creer) { +if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $confirm == 'yes'))) { + $num = 0; + + dol_include_once('/projet/class/task.class.php'); + + $origin_task = new Task($db); + $clone_task = new Task($db); + + foreach (GETPOST('selected') as $task) { + $origin_task->fetch($task, $ref = '', $loadparentdata = 0); + + $defaultref = ''; + $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) { + require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue(0, $clone_task); + } + + if (!$error) { + $clone_task->fk_project = GETPOST('projectid', 'int'); + $clone_task->ref = $defaultref; + $clone_task->label = $origin_task->label; + $clone_task->description = $origin_task->description; + $clone_task->planned_workload = $origin_task->planned_workload; + $clone_task->fk_task_parent = $origin_task->fk_task_parent; + $clone_task->date_c = dol_now(); + $clone_task->date_start = $origin_task->date_start; + $clone_task->date_end = $origin_task->date_end; + $clone_task->progress = $origin_task->progress; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost(null, $clone_task); + + $taskid = $clone_task->create($user); + + if ($taskid > 0) { + $result = $clone_task->add_contact(GETPOST("userid", 'int'), 'TASKEXECUTIVE', 'internal'); + $num++; + } else { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("projects"); + setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings'); + $duplicate_code_error = true; + } else { + setEventMessages($clone_task->error, $clone_task->errors, 'errors'); + } + $action = 'list'; + $error++; + } + } + } + + if (!$error) { + setEventMessage($langs->trans('NumberOfTasksCloned', $num)); + header("Refresh: 1;URL=".DOL_URL_ROOT.'/projet/tasks.php?id=' . GETPOST('projectid', 'int')); + } +} + $parameters['toselect'] = (empty($toselect) ? array() : $toselect); $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9e26170f214..6df62ded8bd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7286,7 +7286,7 @@ class Form $out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss); } - if (empty($nooutput)) print $out; + if (!empty($nooutput)) print $out; else return $out; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 5124a1dce35..e0293210cf6 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -40,6 +40,18 @@ if ($massaction == 'predelete') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); } +if ($massaction == 'preclonetasks') { + $selected = ''; + foreach (GETPOST('toselect') as $tmpselected) { + $selected .= '&selected[]=' . $tmpselected; + } + + $formquestion = array( + array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects('', 'projectid', '', '', '', '', '', '', '', 1, 1)), + ); + print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected . '', $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); +} + if ($massaction == 'preaffecttag' && isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categ = new Categorie($db); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 87b4f8f3036..47a11b949aa 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -897,6 +897,9 @@ MassFilesArea=Area for files built by mass actions ShowTempMassFilesArea=Show area of files built by mass actions ConfirmMassDeletion=Bulk Delete confirmation ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record(s)? +ConfirmMassClone=Bulk clone confirmation +ConfirmMassCloneQuestion=Select project to clone to +ConfirmMassCloneToOneProject=Clone to project %s RelatedObjects=Related Objects ClassifyBilled=Classify billed ClassifyUnbilled=Classify unbilled diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2407d4b2d86..43eecc60b7b 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -258,6 +258,7 @@ RecordsClosed=%s project(s) closed SendProjectRef=Information project %s ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to define employee hourly rate to have time spent valorized NewTaskRefSuggested=Task ref already used, a new task ref is required +NumberOfTasksCloned=%s task(s) cloned TimeSpentInvoiced=Time spent billed TimeSpentForIntervention=Time spent TimeSpentForInvoice=Time spent @@ -297,4 +298,4 @@ EnablePublicLeadForm=Enable the public form for contact NewLeadbyWeb=Your message or request has been recorded. We will answer or contact your soon. NewLeadForm=New contact form LeadFromPublicForm=Online lead from public form -ExportAccountingReportButtonLabel=Get report \ No newline at end of file +ExportAccountingReportButtonLabel=Get report diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9c8b4ebee26..90057832c23 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,6 +747,86 @@ class Project extends CommonObject } } + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records = array(); + + $sql = 'SELECT '; + $sql .= $this->getFieldList('t'); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { + $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; + } else { + $sql .= ' WHERE 1 = 1'; + } + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key == 't.rowid') { + $sqlwhere[] = $key.'='.$value; + } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } elseif ($key == 'customsql') { + $sqlwhere[] = $value; + } elseif (strpos($value, '%') === false) { + $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; + } else { + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' '.$this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < ($limit ? min($limit, $num) : $num)) { + $obj = $this->db->fetch_object($resql); + + $record = new self($this->db); + $record->setVarsFromFetchObj($obj); + + $records[$record->id] = $record; + + $i++; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); + + return -1; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of elements for type, linked to a project diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c891179617d..1fdf9939447 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -553,9 +553,10 @@ if ($id > 0 || !empty($ref)) { // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - $arrayofmassactions = array( - //'clone'=>img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"), - ); + $arrayofmassactions = array(); + if ($user->rights->projet->creer) { + $arrayofmassactions['preclonetasks'] = img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone"); + } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } From f0f66327b938927b0d255f4ed28a1f79fa83adc5 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 17:47:01 +0200 Subject: [PATCH 06/17] Fix syntax error --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 90057832c23..7f0da4a6c98 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -792,7 +792,7 @@ class Project extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode("'.$filtermode.'", $sqlwhere).')'; } if (!empty($sortfield)) { From 5770d01c75af41c097e7fed679e844a44074b45b Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 17:57:43 +0200 Subject: [PATCH 07/17] Fix syntax error --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7f0da4a6c98..7ab69e070a3 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -792,7 +792,7 @@ class Project extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode("'.$filtermode.'", $sqlwhere).')'; + $sql .= ' AND ('.implode('"'.$filtermode.'"', $sqlwhere).')'; } if (!empty($sortfield)) { From 52ec95d7bff99e25342d2d26a484a2b3fccad402 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Wed, 7 Dec 2022 18:08:10 +0200 Subject: [PATCH 08/17] Removed unnecessary fetchAll() method from project class --- htdocs/projet/class/project.class.php | 80 --------------------------- 1 file changed, 80 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7ab69e070a3..9c8b4ebee26 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,86 +747,6 @@ class Project extends CommonObject } } - /** - * Load list of objects in memory from the database. - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) - * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') - { - global $conf; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $records = array(); - - $sql = 'SELECT '; - $sql .= $this->getFieldList('t'); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { - $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; - } else { - $sql .= ' WHERE 1 = 1'; - } - // Manage filter - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key.'='.$value; - } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { - $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } elseif ($key == 'customsql') { - $sqlwhere[] = $value; - } elseif (strpos($value, '%') === false) { - $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; - } else { - $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode('"'.$filtermode.'"', $sqlwhere).')'; - } - - if (!empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if (!empty($limit)) { - $sql .= ' '.$this->db->plimit($limit, $offset); - } - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { - $obj = $this->db->fetch_object($resql); - - $record = new self($this->db); - $record->setVarsFromFetchObj($obj); - - $records[$record->id] = $record; - - $i++; - } - $this->db->free($resql); - - return $records; - } else { - $this->errors[] = 'Error '.$this->db->lasterror(); - dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); - - return -1; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of elements for type, linked to a project From ae3b9970dd60791dd86a53774aeafc5004145e5e Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Sat, 17 Dec 2022 18:02:42 +0200 Subject: [PATCH 09/17] fix html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6df62ded8bd..9e26170f214 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7286,7 +7286,7 @@ class Form $out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss); } - if (!empty($nooutput)) print $out; + if (empty($nooutput)) print $out; else return $out; } From cc6f42f926c1af929f9670a699a448ba52fbdf39 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:34:45 -0500 Subject: [PATCH 10/17] Add new constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT Add constant default public note --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5fb464a6e8e..7b58f93d7b8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1928,7 +1928,7 @@ if ($action == 'create') { print ''; print ''; 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'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + // show kanban result + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } + } else { + // Show here line of result + $j = 0; + 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 (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 (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + //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, ''); + } 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 - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - - print ''."\n"; + print ''."\n"; + } $i++; } diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index bc45f3b417d..01bebc35f5d 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -469,4 +469,36 @@ class CashControl extends CommonObject return $result; } + + /** + * 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); + //var_dump($this->fields['rowid']);exit; + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1, 1) : $this->ref).''; + if (property_exists($this, 'posmodule')) { + $return .= '
'.substr($langs->trans("Module/Application"), 0, 12).' : '.$this->posmodule.''; + } + if (property_exists($this, 'year_close')) { + $return .= '
'.$langs->trans("Year").' : '.$this->year_close.''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } From 59a541ab8e43c413dbb5e6a0e6bc0eb42cfd0dfa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 13 Jan 2023 10:33:48 +0100 Subject: [PATCH 14/17] NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse#23543 --- .../install/mysql/migration/17.0.0-18.0.0.sql | 36 +++++++++++++++++++ .../mysql/tables/llx_product_stock.key.sql | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 htdocs/install/mysql/migration/17.0.0-18.0.0.sql diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql new file mode 100644 index 00000000000..4e68aebfdc8 --- /dev/null +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -0,0 +1,36 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 16.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table; +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex; +-- To make pk to be auto increment (mysql): +-- -- VMYSQL4.3 ALTER TABLE llx_table ADD PRIMARY KEY(rowid); +-- -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: +-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); + + +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); diff --git a/htdocs/install/mysql/tables/llx_product_stock.key.sql b/htdocs/install/mysql/tables/llx_product_stock.key.sql index 358a0c74f19..b07719a5478 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.key.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.key.sql @@ -20,5 +20,7 @@ ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_product (fk_product); ALTER TABLE llx_product_stock ADD INDEX idx_product_stock_fk_entrepot (fk_entrepot); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); ALTER TABLE llx_product_stock ADD UNIQUE INDEX uk_product_stock (fk_product,fk_entrepot); From 147e3ff945a31a5e04dab6a085fb4aa32f0a7605 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:13:52 +0100 Subject: [PATCH 15/17] kanban for list of holidays --- htdocs/holiday/class/holiday.class.php | 37 ++++ htdocs/holiday/list.php | 284 ++++++++++++++----------- htdocs/theme/eldy/info-box.inc.php | 5 + 3 files changed, 200 insertions(+), 126 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9b3f0a1ce16..e8f56659de9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2419,4 +2419,41 @@ class Holiday 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; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'fk_user') && !empty($this->id)) { + $return .= '| '.$this->fk_user.''; + $return .= ''; + } + if (property_exists($this, 'fk_type')) { + $return .= '
'.$langs->trans("Type").' : '; + $return .= ''.$langs->trans($this->getTypes(1, -1)[$this->fk_type]['code']).''; + } + 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/holiday/list.php b/htdocs/holiday/list.php index 564fb8a2a96..b16fbaf8c16 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -52,6 +52,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'holidaylist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); // for switch mode view result $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -394,6 +395,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); } @@ -476,6 +480,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + if ($id > 0) { print ''; } @@ -519,7 +525,11 @@ if ($resql) { } else { $title = $langs->trans("ListeCP"); - $newcardbutton = dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->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('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); } @@ -787,7 +797,8 @@ if ($resql) { $holidaystatic->id = $obj->rowid; $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $db->jdate($obj->date_debut); + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; // User $userstatic->id = $obj->fk_user; @@ -815,139 +826,160 @@ if ($resql) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print '
'; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + if ($i == (min($num, $limit) - 1)) { + print ''; + print ''; } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // 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['cp.date_create']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; } - print ''; - } - if (!$i) { - $totalarray['nbfield']++; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); + $labeltypeleavetoshow = empty($typeleaves[$obj->fk_type]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type) : $labeltypeleavetoshow; - print ''."\n"; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + // 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['cp.date_create']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index f35516ad58e..5c010e21e26 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -492,6 +492,11 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { max-width: 350px; } +/**for make a checkbox in the right of the box in mode kanban */ +.fright { + float:right; +} + @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; From 782594ba5622e46dc8092ec79661440d3e77b2a1 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:27:19 +0100 Subject: [PATCH 16/17] fix problem style --- htdocs/compta/cashcontrol/cashcontrol_list.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index b4c20a824ba..a1e5dae0c91 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -344,9 +344,6 @@ $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } -if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); -} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -405,6 +402,7 @@ print ''; print ''; $permforcashfence = 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')); @@ -564,8 +562,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print '
 '; $searchpicto = $form->showFilterButtons(); @@ -1055,6 +1086,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null)); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null))); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); From 5be0bf17368233de9f858600ce174ef2751afcf1 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:17:19 -0500 Subject: [PATCH 11/17] FIX line brak public note default --- htdocs/comm/propal/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7b58f93d7b8..39632e14e64 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2023 Lenin Rivas * * 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 @@ -1928,7 +1929,7 @@ if ($action == 'create') { print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null))); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); From 75d177f03a8161a70cb64a19682837078434c1b9 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:23:16 -0500 Subject: [PATCH 12/17] New param $type getDefaultCreateValueFor New param $type in fucntion getDefaultCreateValueFor --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 48e5124f213..5b6dac99a4b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -16,6 +16,7 @@ * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021 Grégory Blémand + * Copyright (C) 2023 Lenin Rivas * * 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 @@ -5738,15 +5739,16 @@ abstract class CommonObject * * @param string $fieldname Name of field * @param string $alternatevalue Alternate value to use + * @param string $type Type of data * @return string|string[] Default value (can be an array if the GETPOST return an array) **/ - public function getDefaultCreateValueFor($fieldname, $alternatevalue = null) + public function getDefaultCreateValueFor($fieldname, $alternatevalue = null, $type = 'alphanohtml') { global $conf, $_POST; // If param here has been posted, we use this value first. if (GETPOSTISSET($fieldname)) { - return GETPOST($fieldname, 'alphanohtml', 3); + return GETPOST($fieldname, $type, 3); } if (isset($alternatevalue)) { From 1b81cce3bb0a1886bfa820d4944cdd62547677a5 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 20:46:49 +0100 Subject: [PATCH 13/17] kanban mode for list of cashcontrol --- .../compta/cashcontrol/cashcontrol_list.php | 157 ++++++++++-------- .../cashcontrol/class/cashcontrol.class.php | 32 ++++ 2 files changed, 124 insertions(+), 65 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 7d433282367..b4c20a824ba 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -41,7 +41,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'cashcontrol'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') - +$mode = GETPOST('mode', 'alpha'); // for mode view result $id = GETPOST('id', 'int'); // Load variable for pagination @@ -344,6 +344,9 @@ $param = ''; if (!empty($mode)) { $param .= '&mode='.urlencode($mode); } +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -399,10 +402,13 @@ print ''; print ''; print ''; print ''; +print ''; $permforcashfence = 1; - -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence); +$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_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -552,81 +558,102 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - $j = 0; - print '
'; + print '
'; } + // Output Kanban + //var_dump($obj->posmodule);exit; + $object->posmodule = $obj->posmodule; + $object->cash = $obj->cash; + $object->opening = $obj->opening; + $object->year_close = $obj->year_close; + $object->cheque = $obj->cheque; - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + + print $object->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($object->id, $arrayofselected)) { - $selected = 1; + // 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 + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + + $holidaystatic->fk_type = $holidaystatic->getTypes(1, -1)[$obj->fk_type]['rowid']; + $holidaystatic->fk_user = $userstatic->getNomUrl(1); + // Output Kanban + if ($massactionbutton || $massaction) { $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { + if (in_array($object->id, $arrayofselected)) { $selected = 1; } - print ''; + print $holidaystatic->getKanbanView(''); } - print '
'; - print $holidaystatic->getNomUrl(1, 1); - print '
'.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).''; - print $labeltypeleavetoshow; - print ''; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; - print $nbopenedday; - //print ' '.$langs->trans('DurationDays'); - print ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; - 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 '
'; + 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 $holidaystatic->getNomUrl(1, 1); + print ''.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).'
'; + print $labeltypeleavetoshow; + print ''; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); + print ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; + 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 '
'; } - // Output Kanban - //var_dump($obj->posmodule);exit; + $object->posmodule = $obj->posmodule; $object->cash = $obj->cash; $object->opening = $obj->opening; From fcd82c93f2dd2a5e69577048fdf48f48da4ca941 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 16:58:55 +0100 Subject: [PATCH 17/17] fix total days for both view --- htdocs/holiday/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b16fbaf8c16..cef7375a4b6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -826,6 +826,9 @@ if ($resql) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + if ($mode == 'kanban') { if ($i == 0) { print '
';