Debug v17

This commit is contained in:
Laurent Destailleur 2023-03-01 19:28:32 +01:00
parent e26e8ac85b
commit f6271d83db
7 changed files with 85 additions and 138 deletions

View File

@ -194,6 +194,10 @@ if (!empty($triggers)) {
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
continue; continue;
} }
if ($trigger['code'] == 'ACTION_CREATE') {
// This is the trigger to add an event, enabling it will create infinite loop
continue;
}
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) { if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) {
print '<!-- '.$trigger['position'].' -->'; print '<!-- '.$trigger['position'].' -->';

View File

@ -212,7 +212,7 @@ class modPartnership extends DolibarrModules
// Dictionaries // Dictionaries
$this->dictionaries=array( $this->dictionaries=array(
'langs'=>'partnership@partnership', 'langs'=>'partnership',
// List of tables we want to see into dictonnary editor // List of tables we want to see into dictonnary editor
'tabname'=>array("c_partnership_type"), 'tabname'=>array("c_partnership_type"),
// Label of tables // Label of tables
@ -291,7 +291,7 @@ class modPartnership extends DolibarrModules
// 'leftmenu'=>'partnership', // 'leftmenu'=>'partnership',
// 'url'=>'/partnership/partnership_list.php', // 'url'=>'/partnership/partnership_list.php',
// // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'langs'=>'partnership@partnership', // 'langs'=>'partnership',
// 'position'=>1100+$r, // 'position'=>1100+$r,
// // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. // // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
// 'enabled'=>'$conf->partnership->enabled', // 'enabled'=>'$conf->partnership->enabled',
@ -349,18 +349,18 @@ class modPartnership extends DolibarrModules
$r = 1; $r = 1;
/* BEGIN MODULEBUILDER EXPORT PARTNERSHIP */ /* BEGIN MODULEBUILDER EXPORT PARTNERSHIP */
/* /*
$langs->load("partnership@partnership"); $langs->load("partnership");
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='partnership@partnership'; $this->export_icon[$r]='partnership';
// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
$keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
//unset($this->export_fields_array[$r]['t.fieldtoremove']); //unset($this->export_fields_array[$r]['t.fieldtoremove']);
//$keyforclass = 'PartnershipLine'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnershipline@partnership'; $keyforalias='tl'; //$keyforclass = 'PartnershipLine'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnershipline@partnership'; $keyforalias='tl';
//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$keyforselect='partnershipline'; $keyforaliasextra='extraline'; $keyforelement='partnershipline@partnership'; //$keyforselect='partnershipline'; $keyforaliasextra='extraline'; $keyforelement='partnershipline@partnership';
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -380,13 +380,13 @@ class modPartnership extends DolibarrModules
$r = 1; $r = 1;
/* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */ /* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */
/* /*
$langs->load("partnership@partnership"); $langs->load("partnership");
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='partnership@partnership'; $this->export_icon[$r]='partnership';
$keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
@ -417,11 +417,11 @@ class modPartnership extends DolibarrModules
// Create extrafields during init // Create extrafields during init
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
//$extrafields = new ExtraFields($this->db); //$extrafields = new ExtraFields($this->db);
//$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); //$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled');
//$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); //$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled');
//$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); //$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled');
//$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); //$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership', '$conf->partnership->enabled');
//$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); //$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled');
// Permissions // Permissions
$this->remove($options); $this->remove($options);

View File

@ -981,6 +981,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->trackid = 'sub'.$object->id; $object->trackid = 'sub'.$object->id;
} elseif (preg_match('/^MEMBER_/', $action)) { } elseif (preg_match('/^MEMBER_/', $action)) {
$object->trackid = 'mem'.$object->id; $object->trackid = 'mem'.$object->id;
} elseif (preg_match('/^PARTNERSHIP_/', $action)) {
$object->trackid = 'pship'.$object->id;
} elseif (preg_match('/^PROJECT_/', $action)) { } elseif (preg_match('/^PROJECT_/', $action)) {
$object->trackid = 'proj'.$object->id; $object->trackid = 'proj'.$object->id;
} elseif (preg_match('/^TASK_/', $action)) { } elseif (preg_match('/^TASK_/', $action)) {
@ -1079,7 +1081,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to; $actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
} }
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table // Object linked (if link is for thirdparty, contact or project, it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.
if (!in_array($elementtype, array('societe', 'contact', 'project'))) { if (!in_array($elementtype, array('societe', 'contact', 'project'))) {
$actioncomm->fk_element = $elementid; $actioncomm->fk_element = $elementid;

View File

@ -150,6 +150,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53);
-- recruitment module
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504);
@ -178,3 +180,10 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903);
-- partnership module
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006);

View File

@ -511,7 +511,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) { if (empty($reshook)) {
// Send // Send
if (empty($user->socid)) { if (empty($user->socid)) {
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&token='.newToken().'&mode=init#formmailbeforetitle');
} }
// Back to draft // Back to draft

View File

@ -1,74 +0,0 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Dorian Laurent <i.merraha@sofimedmaroc.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file partnership/admin/about.php
* \ingroup partnership
* \brief About page of module Partnership.
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/partnership.lib.php';
// Translations
$langs->loadLangs(array("errors", "admin", "partnership@partnership"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
/*
* Actions
*/
/*
* View
*/
$form = new Form($db);
$page_name = "PartnershipAbout";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = partnershipAdminPrepareHead();
print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership');
require_once DOL_DOCUMENT_ROOT.'/core/modules/modPartnership.class.php';
$tmpmodule = new modPartnership($db);
print $tmpmodule->getDescLong();
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View File

@ -39,10 +39,11 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershipcard'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
// Initialize technical objects // Initialize technical objects
$object = new Partnership($db); $object = new Partnership($db);
@ -73,20 +74,25 @@ if (empty($action) && empty($id) && empty($ref)) {
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = $user->rights->partnership->read; $permissiontoread = $user->hasRight('partnership', 'read');
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->hasRight('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 $permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
// Security check - Protection if external user // Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id); //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
if (empty($conf->partnership->enabled)) accessforbidden(); //restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
if (empty($permissiontoread)) accessforbidden(); if (!isModEnabled('partnership')) {
accessforbidden();
}
if (!$permissiontoread) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
@ -119,11 +125,11 @@ if (empty($reshook)) {
$fk_partner = ($managedfor == 'member') ? GETPOST('fk_member', 'int') : GETPOST('fk_soc', 'int'); $fk_partner = ($managedfor == 'member') ? GETPOST('fk_member', 'int') : GETPOST('fk_soc', 'int');
$obj_partner = ($managedfor == 'member') ? $object->fk_member : $object->fk_soc; $obj_partner = ($managedfor == 'member') ? $object->fk_member : $object->fk_soc;
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
// Action accept object // Action accept object
if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
$result = $object->validate($user); $result = $object->validate($user);
@ -264,6 +270,10 @@ llxHeader('', $title, $help_url);
// Part to create // Part to create
if ($action == 'create') { if ($action == 'create') {
if (empty($permissiontoadd)) {
accessforbidden('NotEnoughPermissions', 0, 1);
}
print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto); print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -333,9 +343,8 @@ if (($id || $ref) && $action == 'edit') {
// Part to show record // Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_optionals();
$head = partnershipPrepareHead($object); $head = partnershipPrepareHead($object);
print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto); print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto);
$formconfirm = ''; $formconfirm = '';
@ -405,38 +414,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
/* /*
// Ref customer // Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
}
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' '; $morehtmlref .= '<br>';
if ($permissiontoadd) { if ($permissiontoadd) {
//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> '; $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
$morehtmlref .= ' : '; if ($action != 'classify') {
if ($action == 'classify') { $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
//$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 0, 1, '', 'maxwidth300'); }
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= '<input type="hidden" name="action" value="classin">'; } else {
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">'; if (!empty($object->fk_project)) {
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $proj = new Project($db);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $proj->fetch($object->fk_project);
$morehtmlref .= '</form>'; $morehtmlref .= $proj->getNomUrl(1);
} else { if ($proj->title) {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
} }
} else { }
if (!empty($object->fk_project)) { }
$proj = new Project($db); }
$proj->fetch($object->fk_project); */
$morehtmlref .= ': '.$proj->getNomUrl();
} else {
$morehtmlref .= '';
}
}
}*/
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
if (!isset($npfilter)) { if (!isset($npfilter)) {
$npfilter = ""; $npfilter = "";
@ -632,8 +638,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$relativepath = $objref.'/'.$objref.'.pdf'; $relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->partnership->dir_output.'/'.$object->element.'/'.$objref; $filedir = $conf->partnership->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->partnership->read; // If you can read, you can build the PDF to read content $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->partnership->write; // If you can create/edit, you can remove a file on card $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('partnership:Partnership', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); print $formfile->showdocuments('partnership:Partnership', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
} }
@ -651,7 +657,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db); $formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div></div>'; print '</div></div>';
} }