From 40d67d70d2c399aec5ef3b5910aaca6ae425f05b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Feb 2022 12:33:40 +0100 Subject: [PATCH] Fix module partnership --- .../mysql/data/llx_c_partnership_type.sql | 27 +++++++++++++++++++ htdocs/langs/en_US/main.lang | 2 ++ .../partnership/class/partnership.class.php | 6 ++--- .../class/partnershiputils.class.php | 2 +- htdocs/partnership/partnership_card.php | 7 ++--- htdocs/partnership/partnership_list.php | 2 +- 6 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 htdocs/install/mysql/data/llx_c_partnership_type.sql diff --git a/htdocs/install/mysql/data/llx_c_partnership_type.sql b/htdocs/install/mysql/data/llx_c_partnership_type.sql new file mode 100644 index 00000000000..9410911b374 --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_partnership_type.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2020 florian HENRY florian.henry@scopen.fr +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- + +-- +-- Do not place a comment at the end of the line, this file is parsed when +-- from the install and all '--' are removed. +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +INSERT INTO llx_c_partnership_type (code, label, active) VALUES ('DEFAULT', 'Default', 1); + diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2d850927782..6cb069d53c3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1164,3 +1164,5 @@ NotClosedYet=Not yet closed ClearSignature=Reset signature CanceledHidden=Canceled hidden CanceledShown=Canceled shown +Terminate=Terminate +Terminated=Terminated diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 39cf2da2b2f..adc9e115aa5 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -118,7 +118,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Canceled'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,), 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,), @@ -1085,12 +1085,12 @@ class Partnership extends CommonObject $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); $this->labelStatus[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved'); $this->labelStatus[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Terminated'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); $this->labelStatusShort[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved'); $this->labelStatusShort[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Terminated'); } $statusType = 'status'.$status; diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 35b8a3b01e5..ef4f7cfdeb4 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -64,7 +64,7 @@ class PartnershipUtils { global $conf, $langs, $user; - $managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; + $managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if ($managedfor != 'member') { return 0; // If option 'PARTNERSHIP_IS_MANAGED_FOR' = 'thirdparty', this cron job does nothing. diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 6afb9c88912..bfaec42eaa4 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -79,13 +79,14 @@ $permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd & $permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; -$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; +$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if (empty($conf->partnership->enabled)) accessforbidden(); if (empty($permissiontoread)) accessforbidden(); if ($object->id > 0 && $object->fk_member > 0 && $managedfor != 'member') accessforbidden(); if ($object->id > 0 && $object->fk_soc > 0 && $managedfor != 'thirdparty') accessforbidden(); + /* * Actions */ @@ -581,7 +582,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Approve if ($object->status == $object::STATUS_VALIDATED) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Approved'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Approve'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Approved"), 'default', '#', '', 0); @@ -591,7 +592,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Cancel if ($permissiontoadd) { if ($object->status == $object::STATUS_APPROVED) { - print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Resiliate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); } elseif ($object->status > $object::STATUS_APPROVED) { // print ''.$langs->trans("Re-Open").''."\n"; print dolGetButtonAction($langs->trans('Re-Open'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 2703d431e1a..89394960632 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -74,7 +74,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); -$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; +$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';