Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-08-10 19:28:44 +02:00
commit 21df418468
10 changed files with 122 additions and 43 deletions

View File

@ -45,6 +45,11 @@ $arrayofparameters = array(
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
); );
// To fix when dire does not exists
dol_mkdir($conf->dav->dir_output.'/temp');
dol_mkdir($conf->dav->dir_output.'/public');
dol_mkdir($conf->dav->dir_output.'/private');
/* /*
* Actions * Actions

View File

@ -34,13 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Translations // Translations
$langs->loadLangs(array("admin", "eventorganization")); $langs->loadLangs(array("admin", "eventorganization"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
@ -70,11 +66,21 @@ $setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Access control
if (empty($user->admin)) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */
if ($cancel) {
$action ='';
}
if ((float) DOL_VERSION >= 6) { if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
} }
@ -207,7 +213,7 @@ if ($action == 'edit') {
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) { foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) { if ($val['enabled']==1) {
@ -293,7 +299,9 @@ if ($action == 'edit') {
print '</table>'; print '</table>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
@ -301,7 +309,7 @@ if ($action == 'edit') {
} else { } else {
if (!empty($arrayofparameters)) { if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) { foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) { if ($val['enabled']==1) {

View File

@ -230,6 +230,9 @@ if (!empty($conf->agenda->enabled)) {
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); $elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
} }
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
}
$parameters = array('elementList'=>$elementList); $parameters = array('elementList'=>$elementList);
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks

View File

@ -72,11 +72,13 @@ function printDropdownBookmarksList()
// Url to go on create new bookmark page // Url to go on create new bookmark page
$newbtn = ''; $newbtn = '';
if (!empty($user->rights->bookmark->creer)) { if (!empty($user->rights->bookmark->creer)) {
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url); //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url); $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$newbtn .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >'; $newbtn .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
$newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>'; $newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
} }
}
// Menu with list of bookmarks // Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
@ -105,10 +107,12 @@ function printDropdownBookmarksList()
$searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>'; $searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page // Url to go on create new bookmark page
if (!empty($user->rights->bookmark->creer)) { if (!empty($user->rights->bookmark->creer)) {
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url); $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"'; $searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>'; $searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
} }
}
$i = 0; $i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) { while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$searchForm .= '<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' rel="'.dol_escape_htmltag($obj->url).'" >'; $searchForm .= '<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' rel="'.dol_escape_htmltag($obj->url).'" >';

View File

@ -969,7 +969,7 @@ class Form
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">'; $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
} }
$out .= $labeltoshow; $out .= $labeltoshow;
$out .= '</option>'; $out .= '</option>'."\n";
} }
} }
$out .= '</select>'; $out .= '</select>';

View File

@ -21,7 +21,7 @@
-- --
-- Bank Thirdparty -- Bank Thirdparty
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,<br><br>\n\n__(FindYourSEPAMandate)__ :<br>\n__MYCOMPANY_NAME__<br>\n__MYCOMPANY_FULLADDRESS__<br><br>\n__(Sincerely)__<br>\n__USER_SIGNATURE__',null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,<br><br>\n\n__(FindYourSEPAMandate)__ :<br>\n__MYCOMPANY_NAME__<br>\n__MYCOMPANY_FULLADDRESS__<br><br>\n__(Sincerely)__<br>\n__USER_SIGNATURE__',null, 0);
-- Members -- Members
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,<br><br>\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__<br>\n<br>__ONLINE_PAYMENT_TEXT_AND_URL__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
@ -41,3 +41,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__<br /><br />__(Sincerely)__<br /><br />__MYCOMPANY_NAME__<br />__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__<br /><br />__(Sincerely)__<br /><br />__MYCOMPANY_NAME__<br />__USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
-- Partnership
INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipWillSoonBeCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipWillSoonBeCanceledTopic)__', 0, '<body>\n <p>__(Hello)__,<br><br>\n__(YourPartnershipWillSoonBeCanceledContent)__</p>\n<br />\n\n<br />\n\n __(Sincerely)__ <br />\n __[MAIN_INFO_SOCIETE_NOM]__ <br />\n </body>\n');
INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '<body>\n <p>__(Hello)__,<br><br>\n__(YourPartnershipCanceledContent)__</p>\n<br />\n\n<br />\n\n __(Sincerely)__ <br />\n __[MAIN_INFO_SOCIETE_NOM]__ <br />\n </body>\n');
INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '<body>\n <p>__(Hello)__,<br><br>\n__(YourPartnershipRefusedContent)__</p>\n<br />\n\n<br />\n\n __(Sincerely)__ <br />\n __[MAIN_INFO_SOCIETE_NOM]__ <br />\n </body>\n');
INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '<body>\n <p>__(Hello)__,<br><br>\n__(YourPartnershipAcceptedContent)__</p>\n<br />\n\n<br />\n\n __(Sincerely)__ <br />\n __[MAIN_INFO_SOCIETE_NOM]__ <br />\n </body>\n');

View File

@ -2134,6 +2134,7 @@ AskThisIDToYourBank=Contact your bank to get this ID
AdvancedModeOnly=Permision available in Advanced permission mode only AdvancedModeOnly=Permision available in Advanced permission mode only
ConfFileIsReadableOrWritableByAnyUsers=The conf file is readable or writable by any users. Give permission to web server user and group only. ConfFileIsReadableOrWritableByAnyUsers=The conf file is readable or writable by any users. Give permission to web server user and group only.
MailToSendEventOrganization=Event Organization MailToSendEventOrganization=Event Organization
MailToPartnership=Partnership
AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form
YouShouldDisablePHPFunctions=You should disable PHP functions YouShouldDisablePHPFunctions=You should disable PHP functions
IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands in custom code, you shoud disable PHP functions IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands in custom code, you shoud disable PHP functions

View File

@ -65,8 +65,9 @@ class Partnership extends CommonObject
const STATUS_DRAFT = 0; const STATUS_DRAFT = 0;
const STATUS_ACCEPTED = 1; const STATUS_VALIDATED = 1; // Validate (no more draft)
const STATUS_REFUSED = 2; const STATUS_ACCEPTED = 2; // Approved
const STATUS_REFUSED = 3; // Refused
const STATUS_CANCELED = 9; const STATUS_CANCELED = 9;
@ -590,7 +591,7 @@ class Partnership extends CommonObject
$error = 0; $error = 0;
// Protection // Protection
if ($this->status == self::STATUS_ACCEPTED) { if ($this->status == self::STATUS_VALIDATED) {
dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
return 0; return 0;
} }
@ -619,7 +620,7 @@ class Partnership extends CommonObject
// Validate // Validate
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_ACCEPTED; $sql .= " status = ".self::STATUS_VALIDATED;
if (!empty($this->fields['date_validation'])) { if (!empty($this->fields['date_validation'])) {
$sql .= ", date_validation = '".$this->db->idate($now)."'"; $sql .= ", date_validation = '".$this->db->idate($now)."'";
} }
@ -686,7 +687,7 @@ class Partnership extends CommonObject
// Set new ref and current status // Set new ref and current status
if (!$error) { if (!$error) {
$this->ref = $num; $this->ref = $num;
$this->status = self::STATUS_ACCEPTED; $this->status = self::STATUS_VALIDATED;
} }
if (!$error) { if (!$error) {
@ -1064,17 +1065,24 @@ class Partnership extends CommonObject
global $langs; global $langs;
//$langs->load("partnership"); //$langs->load("partnership");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
$this->labelStatus[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatus[self::STATUS_ACCEPTED] = $langs->trans('Accepted');
$this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused'); $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Validated');
$this->labelStatusShort[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatusShort[self::STATUS_ACCEPTED] = $langs->trans('Accepted');
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('Refused'); $this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('Refused');
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled'); $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled');
} }
$statusType = 'status'.$status; $statusType = 'status'.$status;
//if ($status == self::STATUS_ACCEPTED) $statusType = 'status1'; if ($status == self::STATUS_ACCEPTED) {
$statusType = 'status4';
}
if ($status == self::STATUS_REFUSED) {
$statusType = 'status9';
}
if ($status == self::STATUS_CANCELED) { if ($status == self::STATUS_CANCELED) {
$statusType = 'status6'; $statusType = 'status6';
} }

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 NextGestion <contact@nextgestion.com> * Copyright (C) 2021 NextGestion <contact@nextgestion.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -120,7 +120,39 @@ if (empty($reshook)) {
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
// Action accept object // Action accept object
if ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) { if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
$result = $object->validate($user);
if ($result >= 0) {
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
if (method_exists($object, 'generateDocument')) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $object->fetch($id); // Reload to get new records
$model = $object->model_pdf;
$retgen = $object->generateDocument($model, $outputlangs, 0, 0, 0);
if ($retgen < 0) {
setEventMessages($object->error, $object->errors, 'warnings');
}
}
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) {
$result = $object->accept($user); $result = $object->accept($user);
if ($result >= 0) { if ($result >= 0) {
// Define output language // Define output language
@ -143,7 +175,7 @@ if (empty($reshook)) {
$model = $object->model_pdf; $model = $object->model_pdf;
$retgen = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $retgen = $object->generateDocument($model, $outputlangs, 0, 0, 0);
if ($retgen < 0) { if ($retgen < 0) {
setEventMessages($object->error, $object->errors, 'warnings'); setEventMessages($object->error, $object->errors, 'warnings');
} }
@ -339,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1);
} }
// Refuse confirmatio // Refuse confirmation
if ($action == 'refuse') { if ($action == 'refuse') {
//Form to close proposal (signed or not) //Form to close proposal (signed or not)
$formquestion = array( $formquestion = array(
@ -533,23 +565,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
} }
if ($object->status == $object::STATUS_DRAFT) {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
// Back to draft // Back to draft
if ($object->status != $object::STATUS_DRAFT) { if ($object->status != $object::STATUS_DRAFT) {
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
} }
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate
// Accept
if ($object->status == $object::STATUS_DRAFT) { if ($object->status == $object::STATUS_DRAFT) {
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
} else { } else {
$langs->load("errors"); $langs->load("errors");
print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);
} }
} }
// 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);
} else {
$langs->load("errors");
print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Approved"), 'default', '#', '', 0);
}
}
// Cancel // Cancel
if ($permissiontoadd) { if ($permissiontoadd) {
if ($object->status == $object::STATUS_ACCEPTED) { if ($object->status == $object::STATUS_ACCEPTED) {
@ -562,7 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Refuse // Refuse
if ($permissiontoadd) { if ($permissiontoadd) {
if ($object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { if ($object->status != $object::STATUS_DRAFT && $object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) {
print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd); print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd);
} }
} }

View File

@ -226,9 +226,9 @@ if ($rss) {
// Find the subdirectory name as the reference // Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed']; $accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name $fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name
if ($hashp) { if ($hashp) {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed $accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = ''; $sqlprotectagainstexternals = '';