From 91fc78ac9cd9b94140119821ef71540c955fd224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Apr 2021 16:02:52 +0200 Subject: [PATCH 01/20] FIX #17192 - With tz < 0, event is show in bad day on calendar views Conflicts: htdocs/comm/action/index.php --- htdocs/comm/action/index.php | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9bb22d533f6..4f3c8ec7fd4 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -321,15 +321,13 @@ if ($action == 'show_day') $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; - // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'tzuserrel'); $lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel'); } //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day; //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day; -//print dol_print_date($firstdaytoshow,'day'); -//print dol_print_date($lastdaytoshow,'day'); +//print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour'); /*$title = $langs->trans("DoneAndToDoActions"); if ($status == 'done') $title = $langs->trans("DoneActions"); @@ -679,6 +677,7 @@ if ($resql) $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin $event->datef = $db->jdate($obj->datep2); + //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); //var_dump($obj->datep); //var_dump($event->datep); @@ -727,14 +726,15 @@ if ($resql) $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); - //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich //var_dump($annee.'-'.$mois.'-'.$jour); // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); do { - //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'
'; + //if ($event->id==408) + //print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'
'; $eventarray[$daykey][] = $event; $j++; @@ -751,6 +751,7 @@ if ($resql) } else { dol_print_error($db); } +//var_dump($eventarray); // Complete $eventarray with birthdates if ($showbirthday) @@ -825,15 +826,12 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user) $sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) - if ($action == 'show_day') - { + if ($action == 'show_day') { // Request only leaves for the current selected day - $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; - } elseif ($action == 'show_week') - { + $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time + } elseif ($action == 'show_week') { // TODO: Add filter to reduce database request - } elseif ($action == 'show_month') - { + } elseif ($action == 'show_month') { // TODO: Add filter to reduce database request } @@ -1488,6 +1486,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $dateint = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day); + //print 'show_day_events day='.$day.' month='.$month.' year='.$year.' dateint='.$dateint; + print "\n"; $curtime = dol_mktime(0, 0, 0, $month, $day, $year); @@ -1538,11 +1538,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $nextindextouse = is_array($colorindexused) ?count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ... //var_dump($colorindexused); - foreach ($eventarray as $daykey => $notused) - { - $annee = dol_print_date($daykey, '%Y'); - $mois = dol_print_date($daykey, '%m'); - $jour = dol_print_date($daykey, '%d'); + foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user + $annee = dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' + $mois = dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' + $jour = dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' + + //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."
\n"; if ($day == $jour && $month == $mois && $year == $annee) { From 80995c34b55b106afecc45bd8e6b3d9f1b76602d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 12 Apr 2021 07:13:05 +0200 Subject: [PATCH 02/20] FIX Write right on document --- htdocs/compta/sociales/document.php | 2 +- htdocs/compta/tva/document.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/don/document.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index dbb01060a4d..1134eb71b74 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -160,7 +160,7 @@ if ($object->id) $modulepart = 'tax'; $permission = $user->rights->tax->charges->creer; - $permtoedit = $user->rights->fournisseur->facture->creer; + $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index e310e61fcb8..5634181cefd 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -145,7 +145,7 @@ if ($object->id) print dol_get_fiche_end(); $permission = $user->rights->tax->charges->creer; - $permtoedit = $user->rights->fournisseur->facture->creer; + $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 2065ab772e6..b79f3ddc9a0 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -168,7 +168,7 @@ if ($object->id) $permission = $user->rights->societe->contact->creer; $permtoedit = $user->rights->societe->contact->creer; $param = '&id='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 9ff1fa98ea2..a0be06f0274 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -182,7 +182,7 @@ if ($object->id) print dol_get_fiche_end(); $modulepart = 'don'; - $permission = $user->rights->don->lire; + $permission = $user->rights->don->creer; $permtoedit = $user->rights->don->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; From a7a95cff03abd6b6d61e130835cd314a8464b400 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Apr 2021 16:37:43 +0200 Subject: [PATCH 03/20] Fix payment link for renewal with a unique secure key --- htdocs/core/lib/payments.lib.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 601dad3275d..286243564f1 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -28,7 +28,6 @@ */ function payment_prepare_head(Paiement $object) { - global $langs, $conf; $h = 0; @@ -264,9 +263,9 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag $out .= ($mode ? '' : ''); } } - } elseif ($type == 'member' || $type == 'membersubscription') - { - $out = $urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); + } elseif ($type == 'member' || $type == 'membersubscription') { + $newtype = 'member'; + $out = $urltouse.'/public/payment/newpayment.php?source='.$newtype.'&ref='.($mode ? '' : ''); if ($mode == 1) $out .= 'member_ref'; if ($mode == 0) $out .= urlencode($ref); $out .= ($mode ? '' : ''); @@ -275,8 +274,8 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; else { $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); + if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$newtype."' + member_ref)"; + if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$newtype.$ref, 2); $out .= ($mode ? '' : ''); } } From 202243d8a310c7ae7ce6c939254d74f4996ebe7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 12 Apr 2021 17:19:58 +0200 Subject: [PATCH 04/20] Fix payment link for renewal with a unique secure key --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index e16355d902e..bda291b8d8a 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1336,7 +1336,7 @@ if ($source == 'contractline') } // Payment on member subscription -if ($source == 'membersubscription') +if ($source == 'member' || $source == 'membersubscription') { $found = true; $langs->load("members"); From 4b9bf40a8fb3a813b04ab74200f3daa4a85bb5fc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 12 Apr 2021 21:25:58 +0200 Subject: [PATCH 05/20] move include_once to include when it's a tpl --- htdocs/adherents/document.php | 2 +- htdocs/asset/document.php | 2 +- htdocs/bom/bom_document.php | 2 +- htdocs/comm/action/document.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/bank/account_statement_document.php | 2 +- htdocs/compta/bank/document.php | 2 +- htdocs/compta/bank/various_payment/document.php | 2 +- htdocs/compta/deplacement/document.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/sociales/document.php | 2 +- htdocs/compta/tva/document.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/don/document.php | 2 +- htdocs/expedition/document.php | 2 +- htdocs/expensereport/document.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/holiday/document.php | 2 +- htdocs/loan/document.php | 2 +- htdocs/modulebuilder/template/myobject_document.php | 2 +- htdocs/mrp/mo_document.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/stock/productlot_document.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/recruitment/recruitmentcandidature_document.php | 2 +- htdocs/recruitment/recruitmentjobposition_document.php | 2 +- htdocs/resource/document.php | 2 +- htdocs/salaries/document.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/supplier_proposal/document.php | 2 +- htdocs/ticket/document.php | 2 +- htdocs/user/document.php | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 969bf3a8906..652d62571a0 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -152,7 +152,7 @@ if ($id > 0) { $permission = $user->rights->adherent->creer; $permtoedit = $user->rights->adherent->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; print "

"; } else { dol_print_error($db); diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 32a4163dd12..dc7be10b704 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -126,7 +126,7 @@ if ($id > 0 || !empty($ref)) $permission = $user->rights->asset->write; $permtoedit = $user->rights->asset->write; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index cf752878605..9dce260370a 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -139,7 +139,7 @@ if ($object->id) //$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/'; $relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 5b4cc58bb08..7bb48bbd8ba 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -260,7 +260,7 @@ if ($object->id > 0) $modulepart = 'actions'; $permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index fbe7fdbec5c..b5bb8df308b 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -178,7 +178,7 @@ if ($object->id > 0) $permission = $user->rights->propal->creer; $permtoedit = $user->rights->propal->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index f95f61b6025..9ec4e1250f5 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -181,7 +181,7 @@ if ($id > 0 || !empty($ref)) $permission = $user->rights->commande->creer; $permtoedit = $user->rights->commande->creer; $param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity); - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index fd7c6b1d292..8c9432c6837 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -191,7 +191,7 @@ if ($id > 0 || !empty($ref)) { $param = '&id='.$object->id.'&num='.urlencode($numref); $moreparam = '&num='.urlencode($numref); ; $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/"; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index c67c0496727..f69337a169c 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -130,7 +130,7 @@ if ($id > 0 || !empty($ref)) { $permission = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 14187bf51e3..f3f87bdc7b1 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -148,7 +148,7 @@ if ($object->id) $modulepart = 'banque'; $permission = $user->rights->banque->modifier; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 86d0dd383f1..6d5f4ba9409 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -122,7 +122,7 @@ if ($object->id) $modulepart = 'deplacement'; $permission = $user->rights->deplacement->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 3922228c4fa..5144b2c0367 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -180,7 +180,7 @@ if ($id > 0 || !empty($ref)) $permission = $user->rights->facture->creer; $permtoedit = $user->rights->facture->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 1134eb71b74..87ce284f953 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -162,7 +162,7 @@ if ($object->id) $permission = $user->rights->tax->charges->creer; $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 5634181cefd..f8524dcfb3e 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -147,7 +147,7 @@ if ($object->id) $permission = $user->rights->tax->charges->creer; $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index b79f3ddc9a0..2065ab772e6 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -168,7 +168,7 @@ if ($object->id) $permission = $user->rights->societe->contact->creer; $permtoedit = $user->rights->societe->contact->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index ba15af0de19..4600f17e206 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -192,7 +192,7 @@ if ($object->id) $permission = $user->rights->contrat->creer; $permtoedit = $user->rights->contrat->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/don/document.php b/htdocs/don/document.php index a0be06f0274..203ed9da97f 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -185,7 +185,7 @@ if ($object->id) $permission = $user->rights->don->creer; $permtoedit = $user->rights->don->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index a9b19ede7c3..933763bd29a 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -175,7 +175,7 @@ if ($id > 0 || !empty($ref)) { $permission = $user->rights->expedition->creer; $permtoedit = $user->rights->expedition->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 55799b10589..bc03a300801 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -149,7 +149,7 @@ if ($object->id) $permission = $user->rights->expensereport->creer; $permtoedit = $user->rights->expensereport->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 1b9326468f4..0795072fa55 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -169,7 +169,7 @@ if ($object->id) $permission = $user->rights->ficheinter->creer; $permtoedit = $user->rights->ficheinter->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index d5a4455db06..ef37ad16241 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -176,7 +176,7 @@ if ($object->id > 0) $permission = $user->rights->fournisseur->commande->creer; $permtoedit = $user->rights->fournisseur->commande->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { header('Location: index.php'); exit; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index f366bb50c85..732c4471763 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -300,7 +300,7 @@ if ($object->id) $permission = $user->rights->holiday->write; $permtoedit = $user->rights->holiday->write; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 91bfaf1f921..8606db2622b 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -157,7 +157,7 @@ if ($object->id) $permission = $user->rights->loan->write; $permtoedit = $user->rights->loan->write; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 7399fa6fb09..64a7075348d 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -218,7 +218,7 @@ if ($object->id) //$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->id).'/'; $relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 01131b9ffa2..9db6dffd014 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -181,7 +181,7 @@ if ($object->id) //$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/'; $relativepathwithnofile = 'mo/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index f8f5322f2f8..76b54df8d35 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -237,7 +237,7 @@ if ($object->id) print dol_get_fiche_end(); $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; // Merge propal PDF document PDF files diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 2882bbf1c9f..e6b9bb927b8 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -153,7 +153,7 @@ if ($object->id) $permission = ($user->rights->produit->creer); $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index bed7f6a43e1..d2f5adcb95c 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -156,7 +156,7 @@ if ($object->id > 0) $modulepart = 'project'; $permission = ($userWrite > 0); $permtoedit = ($userWrite > 0); - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error('', 'NoRecordFound'); } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 79889e35c17..787ed4695f2 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -314,7 +314,7 @@ if ($object->id > 0) $permission = $user->rights->projet->creer; $permtoedit = $user->rights->projet->creer; $relativepathwithnofile = dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { header('Location: index.php'); exit; diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index 1c801f27fd4..ad8a48db84c 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -195,7 +195,7 @@ if ($object->id) $relativepathwithnofile = 'recruitmentcandidature/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index 3005b4cc1be..b65449358e6 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -196,7 +196,7 @@ if ($object->id) //$relativepathwithnofile='recruitmentjobposition/' . dol_sanitizeFileName($object->id).'/'; $relativepathwithnofile = 'recruitmentjobposition/'.dol_sanitizeFileName($object->ref).'/'; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 0019d6b99ed..6b1a78fd4b5 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -135,7 +135,7 @@ if ($object->id > 0) $modulepart = 'dolresource'; $permission = $user->rights->resource->write; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 6cc482f1304..b30bb9cb3d6 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -127,7 +127,7 @@ if ($object->id) $modulepart = 'salaries'; $permission = $user->rights->salaries->write; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 1d7ba3d2925..5c2436b8691 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -171,7 +171,7 @@ if ($object->id) $permission = $user->rights->societe->creer; $permtoedit = $user->rights->societe->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 0); } diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 127b45466e8..21026eb923b 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -165,7 +165,7 @@ if ($object->id > 0) $permission = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 45ee7aba268..70a57b26424 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -194,7 +194,7 @@ if ($object->id) $permtoedit = $user->rights->ticket->write; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 5440ceeb725..54aaf951ded 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -170,7 +170,7 @@ if ($object->id) $permission = $user->rights->user->user->creer; $permtoedit = $user->rights->user->user->creer; $param = '&id='.$object->id; - include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { accessforbidden('', 0, 1); } From 9ce6d841ccb28233df7a20ee9f612a3bdf1d9f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:40:16 +0200 Subject: [PATCH 06/20] Update pdf_crabe.modules.php --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 9e336863467..f92deff0c88 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -335,9 +335,12 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From fcca5d7d5cd30357a7f779478478136857b798b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:47:15 +0200 Subject: [PATCH 07/20] Update pdf_sponge.modules.php --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index cf6ec0e4711..b42858ca4c9 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -355,9 +355,12 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From ee4f846eb9a93bcf2bc1f3fa6982fecc5ddb79f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:49:03 +0200 Subject: [PATCH 08/20] Update pdf_azur.modules.php --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 856828edc00..e138fb43305 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -335,9 +335,12 @@ class pdf_azur extends ModelePDFPropales } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From 8953c0ac3a1c189153a36f0be6eeeb441b8831b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:49:30 +0200 Subject: [PATCH 09/20] Update pdf_cyan.modules.php --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index c82fb592d82..7c9f4e6fe77 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -339,9 +339,12 @@ class pdf_cyan extends ModelePDFPropales } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From cf1c4ce11fbf6a7377982ec92c5ee8b6ed9908d8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 13 Apr 2021 09:51:08 +0200 Subject: [PATCH 10/20] add missing hook --- htdocs/categories/index.php | 2 ++ htdocs/contact/document.php | 2 ++ htdocs/contact/note.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 5adc7bbb17b..164c07c7ae0 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -44,6 +44,8 @@ $nosearch = GETPOST('nosearch', 'int'); $categstatic = new Categorie($db); if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('categoryindex')); /* * View diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 2065ab772e6..ad9a0e9c0d5 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -75,6 +75,8 @@ if ($id > 0) $object->fetch($id); $upload_dir = $conf->societe->multidir_output[$object->entity].'/contact/'.dol_sanitizeFileName($object->ref); $modulepart = 'contact'; +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('contactdocument')); /* * Actions diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index ae32ef5c95e..6a6ccd5a7ee 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -44,6 +44,8 @@ if ($id > 0) $object->fetch($id); $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('contactcard')); /* * Actions From 7004747ca3b7da741d84f19d49cbf18c1b1d3491 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2021 09:46:50 +0200 Subject: [PATCH 11/20] Add more tooltips on edition of accounting account Fix setup of accountancy Conflicts: htdocs/accountancy/admin/account.php --- htdocs/accountancy/admin/account.php | 14 ++++---- htdocs/accountancy/admin/card.php | 40 +++++++++++++--------- htdocs/accountancy/admin/index.php | 51 ++++++++++++++++++++-------- htdocs/langs/en_US/accountancy.lang | 2 +- 4 files changed, 69 insertions(+), 38 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index ca5c10ec63d..caa443ba589 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -48,6 +48,9 @@ $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $chartofaccounts = GETPOST('chartofaccounts', 'int'); +$permissiontoadd = $user->rights->accounting->chartofaccount; +$permissiontodelete = $user->rights->accounting->chartofaccount; + // Security check if ($user->socid > 0) accessforbidden(); if (!$user->rights->accounting->chartofaccount) accessforbidden(); @@ -79,7 +82,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconcilable' $accounting = new AccountingAccount($db); - /* * Actions */ @@ -107,10 +109,8 @@ if (empty($reshook)) $search_array_options = array(); } if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on - || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified - { - if ($chartofaccounts > 0) - { + || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified + if ($chartofaccounts > 0 && $permissiontoadd) { // Get language code for this $chartofaccounts $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a'; $sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts; @@ -156,7 +156,7 @@ if (empty($reshook)) } } - if ($action == 'disable') { + if ($action == 'disable' && $permissiontoadd) { if ($accounting->fetch($id)) { $mode = GETPOST('mode', 'int'); $result = $accounting->accountDeactivate($id, $mode); @@ -166,7 +166,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($accounting->error, $accounting->errors, 'errors'); } - } elseif ($action == 'enable') { + } elseif ($action == 'enable' && $permissiontoadd) { if ($accounting->fetch($id)) { $mode = GETPOST('mode', 'int'); $result = $accounting->account_activate($id, $mode); diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 23ebde7e230..c44c0d4adb0 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -34,7 +34,6 @@ $error = 0; // Load translation files required by the page $langs->loadLangs(array("bills", "accountancy", "compta")); -$mesg = ''; $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $id = GETPOST('id', 'int'); @@ -141,7 +140,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) } else { $result = $object->fetch($id); - $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; + $sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); @@ -150,7 +149,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) // Clean code // To manage zero or not at the end of the accounting account - if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) { + if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) { $account_number = $account_number; } else { $account_number = clean_account($account_number); @@ -171,13 +170,12 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->labelshort = GETPOST('labelshort', 'alpha'); $result = $object->update($user); - if ($result > 0) { $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id); header("Location: " . $urltogo); exit(); } else { - $mesg = $object->error; + setEventMessages($object->error, null, 'errors'); } } } else { @@ -255,13 +253,17 @@ if ($action == 'create') { print ''; // Chart of accounts type - print ''.$langs->trans("Pcgtype").''; + print ''; + print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc")); + print ''; print ''; print ''; print ''; // Category - print ''.$langs->trans("AccountingCategory").''; + print ''; + print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); + print ''; print ''; $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1); print ''; @@ -281,8 +283,6 @@ if ($action == 'create') { $result = $object->fetch($id, $ref, 1); if ($result > 0) { - dol_htmloutput_mesg($mesg); - $head = accounting_prepare_head($object); // Edit mode @@ -317,13 +317,17 @@ if ($action == 'create') { print ''; // Chart of accounts type - print ''.$langs->trans("Pcgtype").''; + print ''; + print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc")); + print ''; print ''; print ''; print ''; // Category - print ''.$langs->trans("AccountingCategory").''; + print ''; + print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); + print ''; print ''; $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); print ''; @@ -369,13 +373,17 @@ if ($action == 'create') { print ''.$langs->trans("Accountparent").''; print ''.$accp->account_number.' - '.$accp->label.''; - // Category - print "".$langs->trans("AccountingCategory")."".$object->account_category_label.""; - - // Chart of accounts type - print ''.$langs->trans("Pcgtype").''; + // Group of accounting account + print ''; + print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc")); + print ''; print ''.$object->pcg_type.''; + // Custom group of accounting account + print ""; + print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); + print "".$object->account_category_label.""; + print ''; print ''; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 2febe354f2e..5f40022518b 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -58,10 +58,33 @@ $list_binding = array( 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER' ); +$error = 0; + + /* * Actions */ +if (in_array($action, array( + 'setBANK_DISABLE_DIRECT_INPUT', + 'setACCOUNTANCY_COMBO_FOR_AUX', + 'setACCOUNTING_MANAGE_ZERO', + 'setACCOUNTING_LIST_SORT_VENTILATION_TODO', + 'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) { + $constname = preg_replace('/^set/', '', $action); + $constvalue = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + if ($action == 'update') { $error = 0; @@ -70,7 +93,7 @@ if ($action == 'update') { foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); - + var_dump($constname); if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } @@ -271,11 +294,11 @@ print ''; print ''; print ''.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''; if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -284,11 +307,11 @@ print ''; print ''; print ''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").''; if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -297,11 +320,11 @@ print ''; print ''; print ''.$langs->trans("ACCOUNTING_MANAGE_ZERO").''; if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -337,11 +360,11 @@ print "\n"; print ''; print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").''; if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -350,11 +373,11 @@ print ''; print ''; print ''.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").''; if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -387,7 +410,7 @@ print ''; print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").''; if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning'); print ''; } else { print ''; @@ -400,7 +423,7 @@ print ''; print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").''; if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning'); print ''; } else { print ''; @@ -413,7 +436,7 @@ print ''; print ''.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").''; if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning'); print ''; } else { print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index bda6502aeed..e65eb2c3e14 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -207,7 +207,7 @@ Codejournal=Journal JournalLabel=Journal label NumPiece=Piece number TransactionNumShort=Num. transaction -AccountingCategory=Personalized groups +AccountingCategory=Custom group GroupByAccountAccounting=Group by general ledger account GroupBySubAccountAccounting=Group by subledger account AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports. From 8085f109957b1ec2e765d1cb6b5f5b7509571936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:53:51 +0200 Subject: [PATCH 12/20] Update pdf_einstein.modules.php --- .../core/modules/commande/doc/pdf_einstein.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f2f78efbaa2..43bbcdd5959 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -290,9 +290,12 @@ class pdf_einstein extends ModelePDFCommandes } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From d007e75a8e6278df6a6aeede4865d53b6315e4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 13 Apr 2021 09:55:04 +0200 Subject: [PATCH 13/20] Update pdf_eratosthene.modules.php --- .../modules/commande/doc/pdf_eratosthene.modules.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 6037714f6db..16f29f95dcb 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -338,9 +338,12 @@ class pdf_eratosthene extends ModelePDFCommandes } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) - { - $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + $pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } From d6caa057f29080ac78c879e70ff244c96e09f14a Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 13 Apr 2021 10:23:05 +0200 Subject: [PATCH 14/20] FIX: project visibility field with two option If two option of disabled visibility are add on constant, combo is not display --- htdocs/projet/card.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 7a12f797913..c72f08f8020 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -612,7 +612,18 @@ if ($action == 'create' && $user->rights->projet->creer) $array = array(); if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject"); if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject"); - print $form->selectarray('public', $array, GETPOST('public') ?GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + + if (count($array) > 0) + { + print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + } + else + { + print ''; + + if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) print $langs->trans("PrivateProject"); + else print $langs->trans("SharedProject"); + } print ''; // Date start @@ -886,7 +897,18 @@ if ($action == 'create' && $user->rights->projet->creer) $array = array(); if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject"); if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject"); - print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + + if (count($array) > 0) + { + print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + } + else + { + print ''; + + if ($object->public==0) print $langs->trans("PrivateProject"); + else print $langs->trans("SharedProject"); + } print ''; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) From 6ab0de145b49b72d765736757058d6d88f85094f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 13 Apr 2021 08:33:57 +0000 Subject: [PATCH 15/20] Fixing style errors. --- htdocs/projet/card.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c72f08f8020..38db7ec1fd6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -617,8 +617,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); } - else - { + else { print ''; if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) print $langs->trans("PrivateProject"); @@ -902,8 +901,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); } - else - { + else { print ''; if ($object->public==0) print $langs->trans("PrivateProject"); From 0839ee25cd910d3b37144f2f1a8e146a725e02b6 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 13 Apr 2021 10:44:14 +0200 Subject: [PATCH 16/20] FIX missing parameter in select for POP All options can be modified for selector in pop --- htdocs/core/class/html.form.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c5d239e5372..7f52cb099a1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4295,9 +4295,17 @@ class Form $more .= '
'.$input['label'].'
'."\n"; } elseif ($input['type'] == 'select') { + $show_empty = isset($input['select_show_empty']) ? $input['select_show_empty'] : 1; + $key_in_label = isset($input['select_key_in_label']) ? $input['select_key_in_label'] : 0; + $value_as_key = isset($input['select_value_as_key']) ? $input['select_value_as_key'] : 0; + $translate = isset($input['select_translate']) ? $input['select_translate'] : 0; + $maxlen = isset($input['select_maxlen']) ? $input['select_maxlen'] : 0; + $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0; + $sort = isset($input['select_sort']) ? $input['select_sort'] : ''; + $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; - $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); + $more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); $more .= '
'."\n"; } elseif ($input['type'] == 'checkbox') { From dbd56bc03eef6aa6d3ec50b9e321cb30945e4415 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 13 Apr 2021 11:00:28 +0200 Subject: [PATCH 17/20] FIX: mask selector fournisseur if module not activate --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0df74bc166e..3a337e3e7f3 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -676,7 +676,7 @@ if (empty($type) || $type == 'c' || $type == 'p') } if (empty($type) || $type == 'f') { - if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) + if (!empty($conf->fournisseur->enabled) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; From de73c0adb279efcdf4583c3bbfe233c6016e95c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2021 15:38:51 +0200 Subject: [PATCH 18/20] Update card.php --- htdocs/projet/card.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 38db7ec1fd6..b93f7168b9f 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -613,15 +613,16 @@ if ($action == 'create' && $user->rights->projet->creer) if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject"); if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject"); - if (count($array) > 0) - { + if (count($array) > 0) { print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); - } - else { + } else { print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) print $langs->trans("PrivateProject"); - else print $langs->trans("SharedProject"); + if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + print $langs->trans("PrivateProject"); + } else { + print $langs->trans("SharedProject"); + } } print ''; From ee07796131ae28e6f43926bb46539cfa495ca6c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2021 15:39:34 +0200 Subject: [PATCH 19/20] Update card.php --- htdocs/projet/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index b93f7168b9f..5ce32767c4c 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -898,20 +898,20 @@ if ($action == 'create' && $user->rights->projet->creer) if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) $array[0] = $langs->trans("PrivateProject"); if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) $array[1] = $langs->trans("SharedProject"); - if (count($array) > 0) - { + if (count($array) > 0) { print $form->selectarray('public', $array, $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); - } - else { + } else { print ''; - if ($object->public==0) print $langs->trans("PrivateProject"); - else print $langs->trans("SharedProject"); + if ($object->public == 0) { + print $langs->trans("PrivateProject"); + } else { + print $langs->trans("SharedProject"); + } } print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $classfortr = ($object->usage_opportunity ? '' : ' hideobject'); // Opportunity status print ''.$langs->trans("OpportunityStatus").''; From fe57ba2116152a5a785fce283a894fa8be898c5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2021 20:00:36 +0200 Subject: [PATCH 20/20] Fix phpcs --- htdocs/projet/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 5ce32767c4c..df63c805948 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -620,7 +620,7 @@ if ($action == 'create' && $user->rights->projet->creer) if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { print $langs->trans("PrivateProject"); - } else { + } else { print $langs->trans("SharedProject"); } } @@ -905,7 +905,7 @@ if ($action == 'create' && $user->rights->projet->creer) if ($object->public == 0) { print $langs->trans("PrivateProject"); - } else { + } else { print $langs->trans("SharedProject"); } }