Debug v16

This commit is contained in:
Laurent Destailleur 2022-05-10 16:19:00 +02:00
parent fea6771a7a
commit 3a5fe5063d
13 changed files with 32 additions and 26 deletions

View File

@ -85,11 +85,18 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'member') accessforbidden();
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
accessforbidden('Partnership module is not activated for members');
}
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($action == 'edit' && empty($permissiontoadd)) {
accessforbidden();
}
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) {
accessforbidden();
}

View File

@ -90,7 +90,7 @@ if (!$error && $massaction == 'confirm_presend') {
if ($objecttmp->element == 'expensereport') {
$thirdparty = new User($db);
}
if ($objecttmp->element == 'partnership' && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
if ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$thirdparty = new Adherent($db);
}
if ($objecttmp->element == 'holiday') {
@ -110,7 +110,7 @@ if (!$error && $massaction == 'confirm_presend') {
if ($objecttmp->element == 'expensereport') {
$thirdpartyid = $objecttmp->fk_user_author;
}
if ($objecttmp->element == 'partnership' && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
if ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$thirdpartyid = $objecttmp->fk_member;
}
if ($objecttmp->element == 'holiday') {
@ -264,7 +264,7 @@ if (!$error && $massaction == 'confirm_presend') {
$fuser = new User($db);
$fuser->fetch($objectobj->fk_user_author);
$sendto = $fuser->email;
} elseif ($objectobj->element == 'partnership' && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
} elseif ($objectobj->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$fadherent = new Adherent($db);
$fadherent->fetch($objectobj->fk_member);
$sendto = $fadherent->email;

View File

@ -263,7 +263,7 @@ function societe_prepare_head(Societe $object)
$h++;
}
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'thirdparty') {
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') {
if (!empty($user->rights->partnership->read)) {
$langs->load("partnership");
$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;

View File

@ -177,8 +177,7 @@ class modPartnership extends DolibarrModules
// Array to add new pages in new tabs
$this->tabs = array();
$tabtoadd = (!empty(getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR')) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') ? 'member' : 'thirdparty';
$tabtoadd = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if ($tabtoadd == 'member') {
$fk_mainmenu = "members";
} else {

View File

@ -152,7 +152,7 @@ if ($action == 'presend') {
$fuser = new User($db);
$fuser->fetch($object->fk_user_author);
$liste['thirdparty'] = $fuser->getFullName($outputlangs)." <".$fuser->email.">";
} elseif ($object->element == 'partnership' && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
} elseif ($object->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$fadherent = new Adherent($db);
$fadherent->fetch($object->fk_member);
$liste['member'] = $fadherent->getFullName($outputlangs)." <".$fadherent->email.">";

View File

@ -131,7 +131,7 @@ if ($massaction == 'presend') {
$fuser = new User($db);
$fuser->fetch($thirdpartyid);
$liste['thirdparty'] = $fuser->getFullName($langs)." &lt;".$fuser->email."&gt;";
} elseif ($objecttmp->element == 'partnership' && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
} elseif ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$fadherent = new Adherent($db);
$fadherent->fetch($objecttmp->fk_member);
$liste['member'] = $fadherent->getFullName($langs)." &lt;".$fadherent->email."&gt;";

View File

@ -124,8 +124,8 @@ print '</tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_IS_MANAGED_FOR").'</td>';
print '<td>';
print '<select class="flat minwidth100" id="select_PARTNERSHIP_IS_MANAGED_FOR" name="PARTNERSHIP_IS_MANAGED_FOR">';
print '<option value="thirdparty" '.(($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'thirdparty') ? 'selected' : '').'>'.$langs->trans("ThirdParty").'</option>';
print '<option value="member" '.(($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') ? 'selected' : '').'>'.$langs->trans("Members").'</option>';
print '<option value="thirdparty" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') ? 'selected' : '').'>'.$langs->trans("ThirdParty").'</option>';
print '<option value="member" '.((getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'member') ? 'selected' : '').'>'.$langs->trans("Members").'</option>';
print '</select>';
print ajax_combobox('select_PARTNERSHIP_IS_MANAGED_FOR');
print '</td>';
@ -133,7 +133,7 @@ print '<td><span class="opacitymedium">'.$langs->trans("partnershipforthirdparty
print '</tr>';
//if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
//if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
print '<tr class="oddeven"><td>'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").'</td>';
print '<td>';
$dnbdays = '30';

View File

@ -199,7 +199,7 @@ class Partnership extends CommonObject
$this->db = $db;
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
} else {
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150');

View File

@ -64,7 +64,7 @@ class PartnershipUtils
{
global $conf, $langs, $user;
$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if ($managedfor != 'member') {
return 0; // If option 'PARTNERSHIP_IS_MANAGED_FOR' = 'thirdparty', this cron job does nothing.
@ -219,7 +219,7 @@ class PartnershipUtils
{
global $conf, $langs, $user;
$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR');
$partnership = new Partnership($this->db);
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call

View File

@ -79,7 +79,7 @@ $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 = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();

View File

@ -74,7 +74,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';

View File

@ -204,9 +204,9 @@ if (empty($reshook) && $action == 'add') {
$partnership = new Partnership($db);
// We try to find the thirdparty or the member
if (empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) || $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'thirdparty') {
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') {
$partnership->fk_member = 0;
} elseif ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') {
} elseif (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'member') {
$partnership->fk_soc = 0;
}

View File

@ -52,7 +52,7 @@ if (!empty($user->socid)) {
$socid = $user->socid;
}
if (empty($id) && $socid && (empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) || $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'thirdparty')) {
if (empty($id) && $socid && (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty')) {
$id = $socid;
}
@ -94,8 +94,8 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of act
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') {
accessforbidden();
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') != 'thirdparty') {
accessforbidden('Partnership is not activated for thirdparties');
}
if (empty($conf->partnership->enabled)) {
accessforbidden();