From a03bb00254b979b9027092b7b0f1585d51efbb16 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 19 Jul 2019 11:26:21 +0200 Subject: [PATCH 1/7] Fix missing hook --- htdocs/compta/prelevement/card.php | 118 +++++++++++++++-------------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 60e471d712d..d6c752330fe 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -63,78 +63,86 @@ $object = new BonPrelevement($db,""); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +$hookmanager->initHooks(array('directdebitprevcard','globalcard')); /* * Actions */ -if ( $action == 'confirm_delete' ) +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $res=$object->delete($user); - if ($res > 0) - { - header("Location: index.php"); - exit; - } -} + if ( $action == 'confirm_delete' ) + { + $res=$object->delete($user); + if ($res > 0) + { + header("Location: index.php"); + exit; + } + } -// Seems to no be used and replaced with $action == 'infocredit -if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') -{ - $res=$object->set_credite(); - if ($res >= 0) - { - header("Location: card.php?id=".$id); - exit; - } -} + // Seems to no be used and replaced with $action == 'infocredit + if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes') + { + $res=$object->set_credite(); + if ($res >= 0) + { + header("Location: card.php?id=".$id); + exit; + } + } -if ($action == 'infotrans' && $user->rights->prelevement->bons->send) -{ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + if ($action == 'infotrans' && $user->rights->prelevement->bons->send) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); + $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); - /* - if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref) - { - $dir = $conf->prelevement->dir_output.'/receipts'; + /* + if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref) + { + $dir = $conf->prelevement->dir_output.'/receipts'; - if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0) - { - $object->set_infotrans($user, $dt, GETPOST('methode','alpha')); - } + if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0) + { + $object->set_infotrans($user, $dt, GETPOST('methode','alpha')); + } - header("Location: card.php?id=".$id); - exit; - } - else - { - dol_syslog("Fichier invalide",LOG_WARNING); - $mesg='BadFile'; - }*/ + header("Location: card.php?id=".$id); + exit; + } + else + { + dol_syslog("Fichier invalide",LOG_WARNING); + $mesg='BadFile'; + }*/ - $error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha')); + $error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha')); - if ($error) - { - header("Location: card.php?id=".$id."&error=$error"); - exit; - } -} + if ($error) + { + header("Location: card.php?id=".$id."&error=$error"); + exit; + } + } -// Set direct debit order to credited, create payment and close invoices -if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) -{ - $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); + // Set direct debit order to credited, create payment and close invoices + if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) + { + $dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int')); - $error = $object->set_infocredit($user, $dt); + $error = $object->set_infocredit($user, $dt); - if ($error) - { - header("Location: card.php?id=".$id."&error=$error"); - exit; - } + if ($error) + { + header("Location: card.php?id=".$id."&error=$error"); + exit; + } + } } From b100cdb9db97e20eb2b5a9a13951eb9e74c64902 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 19 Jul 2019 11:58:21 +0200 Subject: [PATCH 2/7] FIX: extrafield loading bug due to assumption that an object is a third party while it may be a contact if MAIN_USE_COMPANY_NAME_OF_CONTACT is set. --- .../expedition/doc/doc_generic_shipment_odt.modules.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 9c45c135ac3..a1be784f249 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -393,7 +393,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } } // Make substitutions into odt of thirdparty - $tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + if ($socobject->element == 'contact') { + $tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs); + } else { + $tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); + } foreach($tmparray as $key=>$value) { try { From cd7d3f1a368a4d2c84906c3ba1110961a72cdc3e Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 19 Jul 2019 15:41:44 +0200 Subject: [PATCH 3/7] FIX : search by phone pro --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 5aacbc2f16f..f786e73d17a 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -290,7 +290,7 @@ if ($search_firstname) $sql.= natural_search('p.firstname', $search if ($search_societe) $sql.= natural_search('s.nom', $search_societe); if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); -if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); +if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro); if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile); if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); From d88fec52bfd8bff0196a1d32a1ffc5f2349afd48 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 20 Jul 2019 15:07:59 +0200 Subject: [PATCH 4/7] fix warining message --- htdocs/comm/action/peruser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 9e2a7278a27..65669625398 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1189,8 +1189,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } $ids1='';$ids2=''; - if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h])); - if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h])); + if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h])); + if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h])); if ($h == $begin_h) echo ''; else echo ''; From d03d79222e9ecfd239a49566dd8695ceac5841c3 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 20 Jul 2019 15:15:48 +0200 Subject: [PATCH 5/7] fix warning php --- htdocs/comm/action/peruser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 65669625398..7dfe197033e 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1207,14 +1207,14 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color1='222222'; } - if (count($cases2[$h]) == 1) // only 1 event + if (is_array($cases2[$h]) && count($cases2[$h]) == 1) // only 1 event { $output = array_slice($cases2[$h], 0, 1); $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; } - else if (count($cases2[$h]) > 1) + else if (is_array($cases2[$h]) && count($cases2[$h]) > 1) { $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $color2='222222'; From b046bcc197a0b8d0b800c1153ace0e76de4e988f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sat, 20 Jul 2019 15:19:25 +0200 Subject: [PATCH 6/7] fix warning php --- htdocs/comm/action/peruser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 7dfe197033e..16d9f09947c 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1194,14 +1194,14 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($h == $begin_h) echo ''; else echo ''; - if (count($cases1[$h]) == 1) // only 1 event + if (is_array($cases1[$h]) && count($cases1[$h]) == 1) // only 1 event { $output = array_slice($cases1[$h], 0, 1); $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; } - else if (count($cases1[$h]) > 1) + else if (is_array($cases1[$h]) && count($cases1[$h]) > 1) { $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $color1='222222'; From 7ec8b48b180a9f7c1bb27bb6ca9c8a4c39e3175d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 21 Jul 2019 22:21:11 +0200 Subject: [PATCH 7/7] Fix lost filter in action list --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index aae2d48e9cf..10f3048c2f6 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -43,7 +43,7 @@ $action=GETPOST('action','alpha'); $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int"); $pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3); -$status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha'); +$status=(GETPOST("search_status",'alpha') != '')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha'); $type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml'); $optioncss = GETPOST('optioncss','alpha'); $year=GETPOST("year",'int');