Debug v14
This commit is contained in:
parent
a1bb7129da
commit
9f177a0c63
@ -57,8 +57,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
|||||||
$langs->loadLangs(array("companies","members","partnership", "other"));
|
$langs->loadLangs(array("companies","members","partnership", "other"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int');
|
||||||
$memberid = GETPOST('rowid', 'int');
|
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
@ -68,9 +67,9 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
|||||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||||
//$lineid = GETPOST('lineid', 'int');
|
//$lineid = GETPOST('lineid', 'int');
|
||||||
|
|
||||||
$member = new Adherent($db);
|
$object = new Adherent($db);
|
||||||
if ($memberid > 0) {
|
if ($id > 0) {
|
||||||
$member->fetch($memberid);
|
$object->fetch($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
@ -112,19 +111,13 @@ if (empty($conf->partnership->enabled)) accessforbidden();
|
|||||||
if (empty($permissiontoread)) accessforbidden();
|
if (empty($permissiontoread)) accessforbidden();
|
||||||
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
||||||
|
|
||||||
$partnershipid = $object->fetch(0, "", $memberid);
|
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) {
|
||||||
if (empty($action) && empty($partnershipid)) {
|
accessforbidden();
|
||||||
$action = 'create';
|
|
||||||
}
|
|
||||||
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) accessforbidden();
|
|
||||||
|
|
||||||
if (empty($memberid) && $object) {
|
|
||||||
$memberid = $object->fk_member;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'adherent', $memberid, '', '', 'socid', 'rowid', 0);
|
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -143,102 +136,7 @@ $date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GET
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($memberid > 0 ? $memberid : '__ID__');
|
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($id > 0 ? $id : '__ID__');
|
||||||
|
|
||||||
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
|
|
||||||
|
|
||||||
if ($action == 'add' && $permissiontoread) {
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$old_start_date = $object->date_partnership_start;
|
|
||||||
|
|
||||||
$object->fk_member = $memberid;
|
|
||||||
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
|
|
||||||
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
|
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
|
||||||
$object->date_creation = $now;
|
|
||||||
$object->fk_user_creat = $user->id;
|
|
||||||
$object->entity = $conf->entity;
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$result = $object->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
if ($result == -4) {
|
|
||||||
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
$action = 'create';
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
} elseif ($action == 'update' && $permissiontoread) {
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$object->oldcopy = clone $object;
|
|
||||||
|
|
||||||
$old_start_date = $object->date_partnership_start;
|
|
||||||
|
|
||||||
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
|
|
||||||
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
|
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
|
||||||
$object->fk_user_creat = $user->id;
|
|
||||||
$object->fk_user_modif = $user->id;
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$result = $object->update($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
if ($result == -4) {
|
|
||||||
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
$action = 'edit';
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
} elseif ($action == 'confirm_close' || $action == 'update_extras') {
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?rowid=".$memberid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actions when linking object each other
|
// Actions when linking object each other
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
|
||||||
@ -261,11 +159,11 @@ llxHeader('', $title);
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($memberid) {
|
if ($id > 0) {
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
$member = new Adherent($db);
|
$object = new Adherent($db);
|
||||||
$result = $member->fetch($memberid);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if (!empty($conf->notification->enabled)) {
|
if (!empty($conf->notification->enabled)) {
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
@ -273,13 +171,13 @@ if ($memberid) {
|
|||||||
|
|
||||||
$adht->fetch($object->typeid);
|
$adht->fetch($object->typeid);
|
||||||
|
|
||||||
$head = member_prepare_head($member);
|
$head = member_prepare_head($object);
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'user');
|
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'user');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($member, 'rowid', $linkback);
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
@ -288,21 +186,21 @@ if ($memberid) {
|
|||||||
|
|
||||||
// Login
|
// Login
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$member->login.' </td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||||
|
|
||||||
// Morphy
|
// Morphy
|
||||||
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$member->getmorphylib().'</td>';
|
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$member->company.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$member->getCivilityLabel().' </td>';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -310,200 +208,13 @@ if ($memberid) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
$params = '';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
} else {
|
} else {
|
||||||
dol_print_error('', 'Parameter rowid not defined');
|
dol_print_error('', 'Parameter rowid not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part to create
|
|
||||||
if ($action == 'create') {
|
|
||||||
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', '');
|
|
||||||
|
|
||||||
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="add">';
|
|
||||||
print '<input type="hidden" name="rowid" value="'.$memberid.'">';
|
|
||||||
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
|
|
||||||
|
|
||||||
if ($backtopage) {
|
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
||||||
}
|
|
||||||
if ($backtopageforcancel) {
|
|
||||||
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
|
||||||
}
|
|
||||||
|
|
||||||
print dol_get_fiche_head(array(), '');
|
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
|
||||||
|
|
||||||
print '</table>'."\n";
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center">';
|
|
||||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Validate")).'">';
|
|
||||||
print ' ';
|
|
||||||
// print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Part to edit record
|
|
||||||
if (($partnershipid || $ref) && $action == 'edit') {
|
|
||||||
print load_fiche_titre($langs->trans("Partnership"), '', '');
|
|
||||||
|
|
||||||
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="update">';
|
|
||||||
print '<input type="hidden" name="rowid" value="'.$memberid.'">';
|
|
||||||
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
|
|
||||||
if ($backtopage) {
|
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
||||||
}
|
|
||||||
if ($backtopageforcancel) {
|
|
||||||
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
|
||||||
}
|
|
||||||
|
|
||||||
print dol_get_fiche_head();
|
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
|
|
||||||
print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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'))) {
|
||||||
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), '', '');
|
|
||||||
|
|
||||||
$res = $object->fetch_optionals();
|
|
||||||
|
|
||||||
// $head = partnershipPrepareHead($object);
|
|
||||||
// print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto);
|
|
||||||
|
|
||||||
$linkback = '';
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref');
|
|
||||||
|
|
||||||
$formconfirm = '';
|
|
||||||
|
|
||||||
// Close confirmation
|
|
||||||
if ($action == 'close') {
|
|
||||||
// Create an array for form
|
|
||||||
$formquestion = array();
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1);
|
|
||||||
}
|
|
||||||
// Reopon confirmation
|
|
||||||
if ($action == 'reopen') {
|
|
||||||
// Create an array for form
|
|
||||||
$formquestion = array();
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refuse confirmatio
|
|
||||||
if ($action == 'refuse') {
|
|
||||||
//Form to close proposal (signed or not)
|
|
||||||
$formquestion = array(
|
|
||||||
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace)
|
|
||||||
);
|
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call Hook formConfirm
|
|
||||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
if (empty($reshook)) {
|
|
||||||
$formconfirm .= $hookmanager->resPrint;
|
|
||||||
} elseif ($reshook > 0) {
|
|
||||||
$formconfirm = $hookmanager->resPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print form confirm
|
|
||||||
print $formconfirm;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO Replace this card into a list of all partnerships.
|
|
||||||
|
|
||||||
|
|
||||||
// Object card
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
$linkback = '<a href="'.dol_buildpath('/partnership/partnership_list.php', 1).'?restore_lastsearch_values=1'.(!empty($memberid) ? '&rowid='.$memberid : '').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
|
||||||
print '<div class="fichehalfleft">';
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
|
||||||
print '<table class="border centpercent tableforfield">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
|
|
||||||
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
|
||||||
//unset($object->fields['fk_member']); // Hide field already shown in banner
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
|
||||||
|
|
||||||
// End of subscription date
|
|
||||||
$fadherent = new Adherent($db);
|
|
||||||
$fadherent->fetch($object->fk_member);
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
|
||||||
if ($fadherent->datefin) {
|
|
||||||
print dol_print_date($fadherent->datefin, 'day');
|
|
||||||
if ($fadherent->hasDelay()) {
|
|
||||||
print " ".img_warning($langs->trans("Late"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!$adht->subscription) {
|
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
|
||||||
if ($fadherent->statut > 0) {
|
|
||||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
|
||||||
if ($fadherent->statut > 0) {
|
|
||||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Buttons for actions
|
// Buttons for actions
|
||||||
|
|
||||||
if ($action != 'presend') {
|
if ($action != 'presend') {
|
||||||
@ -517,20 +228,65 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Show
|
// Show
|
||||||
if ($permissiontoadd) {
|
if ($permissiontoadd) {
|
||||||
print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd);
|
print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_member='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/adherents/partnership.php?id='.$object->id), '', $permissiontoadd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel
|
|
||||||
/*
|
|
||||||
if ($permissiontoadd) {
|
|
||||||
if ($object->status == $object::STATUS_ACCEPTED) {
|
|
||||||
print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
print '</div>'."\n";
|
print '</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php';
|
||||||
|
$morehtmlright = '';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, '');
|
||||||
|
|
||||||
|
$memberid = $object->id;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Replace this card with the list of all partnerships.
|
||||||
|
|
||||||
|
$object = new Partnership($db);
|
||||||
|
$partnershipid = $object->fetch(0, "", $memberid);
|
||||||
|
|
||||||
|
if ($partnershipid > 0) {
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border centpercent tableforfield">'."\n";
|
||||||
|
|
||||||
|
// Common attributes
|
||||||
|
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
|
||||||
|
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
||||||
|
//unset($object->fields['fk_member']); // Hide field already shown in banner
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
|
// End of subscription date
|
||||||
|
$fadherent = new Adherent($db);
|
||||||
|
$fadherent->fetch($object->fk_member);
|
||||||
|
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||||
|
if ($fadherent->datefin) {
|
||||||
|
print dol_print_date($fadherent->datefin, 'day');
|
||||||
|
if ($fadherent->hasDelay()) {
|
||||||
|
print " ".img_warning($langs->trans("Late"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!$adht->subscription) {
|
||||||
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
|
if ($fadherent->statut > 0) {
|
||||||
|
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
|
if ($fadherent->statut > 0) {
|
||||||
|
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||||
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0, 43, 0);
|
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0,43, 0, 25, 0);
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname = array();
|
$tabname = array();
|
||||||
@ -608,7 +608,7 @@ $tabcomplete = array(
|
|||||||
'c_prospectcontactlevel'=>array('picto'=>'company'),
|
'c_prospectcontactlevel'=>array('picto'=>'company'),
|
||||||
'c_stcommcontact'=>array('picto'=>'company'),
|
'c_stcommcontact'=>array('picto'=>'company'),
|
||||||
'c_product_nature'=>array('picto'=>'product'),
|
'c_product_nature'=>array('picto'=>'product'),
|
||||||
'c_productbatch_qcstatus'=>array('picto'=>'batch'),
|
'c_productbatch_qcstatus'=>array('picto'=>'lot'),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -212,30 +212,27 @@ class modPartnership extends DolibarrModules
|
|||||||
// 'user' to add a tab in user view
|
// 'user' to add a tab in user view
|
||||||
|
|
||||||
// Dictionaries
|
// Dictionaries
|
||||||
$this->dictionaries = array();
|
|
||||||
/* Example:
|
|
||||||
$this->dictionaries=array(
|
$this->dictionaries=array(
|
||||||
'langs'=>'partnership@partnership',
|
'langs'=>'partnership@partnership',
|
||||||
// List of tables we want to see into dictonnary editor
|
// List of tables we want to see into dictonnary editor
|
||||||
'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
|
'tabname'=>array(MAIN_DB_PREFIX."c_partnership_type"),
|
||||||
// Label of tables
|
// Label of tables
|
||||||
'tablib'=>array("Table1", "Table2", "Table3"),
|
'tablib'=>array("PartnershipType"),
|
||||||
// Request to select fields
|
// Request to select fields
|
||||||
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
|
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.$conf->entity),
|
||||||
// Sort order
|
// Sort order
|
||||||
'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
|
'tabsqlsort'=>array("label ASC"),
|
||||||
// List of fields (result of select to show dictionary)
|
// List of fields (result of select to show dictionary)
|
||||||
'tabfield'=>array("code,label", "code,label", "code,label"),
|
'tabfield'=>array("code,label"),
|
||||||
// List of fields (list of fields to edit a record)
|
// List of fields (list of fields to edit a record)
|
||||||
'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
|
'tabfieldvalue'=>array("code,label"),
|
||||||
// List of fields (list of fields for insert)
|
// List of fields (list of fields for insert)
|
||||||
'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
|
'tabfieldinsert'=>array("code,label"),
|
||||||
// Name of columns with primary key (try to always name it 'rowid')
|
// Name of columns with primary key (try to always name it 'rowid')
|
||||||
'tabrowid'=>array("rowid", "rowid", "rowid"),
|
'tabrowid'=>array("rowid"),
|
||||||
// Condition to show each dictionary
|
// Condition to show each dictionary
|
||||||
'tabcond'=>array($conf->partnership->enabled, $conf->partnership->enabled, $conf->partnership->enabled)
|
'tabcond'=>array($conf->partnership->enabled)
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
|
|
||||||
// Boxes/Widgets
|
// Boxes/Widgets
|
||||||
// Add here list of php file(s) stored in partnership/core/boxes that contains a class to show a widget.
|
// Add here list of php file(s) stored in partnership/core/boxes that contains a class to show a widget.
|
||||||
|
|||||||
@ -173,7 +173,9 @@ CREATE TABLE llx_workstation_workstation_usergroup(
|
|||||||
fk_workstation integer
|
fk_workstation integer
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|
||||||
CREATE TABLE llx_c_producbatch_qcstatus(
|
DROP TABLE llx_c_producbatch_qcstatus; -- delete table with bad name
|
||||||
|
|
||||||
|
CREATE TABLE llx_c_productbatch_qcstatus(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||||
entity integer NOT NULL DEFAULT 1,
|
entity integer NOT NULL DEFAULT 1,
|
||||||
code varchar(16) NOT NULL,
|
code varchar(16) NOT NULL,
|
||||||
@ -532,3 +534,13 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
|
create table llx_c_partnership_type
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
code varchar(32) NOT NULL,
|
||||||
|
label varchar(64) NOT NULL,
|
||||||
|
active tinyint DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
35
htdocs/install/mysql/tables/llx_c_partnership_type.sql
Normal file
35
htdocs/install/mysql/tables/llx_c_partnership_type.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- ========================================================================
|
||||||
|
-- Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- 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/>.
|
||||||
|
--
|
||||||
|
-- Defini les types de contact d'un element sert de reference pour
|
||||||
|
-- la table llx_element_contact
|
||||||
|
--
|
||||||
|
-- element est le nom de la table utilisant le type de contact.
|
||||||
|
-- i.e. contact, facture, projet, societe (sans le llx_ devant).
|
||||||
|
-- Libelle est un texte decrivant le type de contact.
|
||||||
|
-- active precise si cette valeur est 'active' ou 'archive'.
|
||||||
|
--
|
||||||
|
-- ========================================================================
|
||||||
|
|
||||||
|
create table llx_c_partnership_type
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
|
code varchar(32) NOT NULL,
|
||||||
|
label varchar(64) NOT NULL,
|
||||||
|
active tinyint DEFAULT 1 NOT NULL
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
@ -20,6 +20,7 @@ ModulePartnershipName=Partnership management
|
|||||||
PartnershipDescription=Module Partnership management
|
PartnershipDescription=Module Partnership management
|
||||||
PartnershipDescriptionLong= Module Partnership management
|
PartnershipDescriptionLong= Module Partnership management
|
||||||
|
|
||||||
|
AddPartnership=Add partnership
|
||||||
CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions
|
CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions
|
||||||
PartnershipCheckBacklink=Partnership: Check referring backlink
|
PartnershipCheckBacklink=Partnership: Check referring backlink
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ PartnershipAlreadyExist=Partnership already exist
|
|||||||
ManagePartnership=Manage partnership
|
ManagePartnership=Manage partnership
|
||||||
BacklinkNotFoundOnPartnerWebsite=Backlink not found on partner website
|
BacklinkNotFoundOnPartnerWebsite=Backlink not found on partner website
|
||||||
ConfirmClosePartnershipAsk=Are you sure you want to cancel this partnership?
|
ConfirmClosePartnershipAsk=Are you sure you want to cancel this partnership?
|
||||||
|
PartnershipType=Partnership type
|
||||||
|
|
||||||
#
|
#
|
||||||
# Template Mail
|
# Template Mail
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class Partnership extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* @var int rowid
|
* @var int rowid
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see id
|
* @see $id
|
||||||
*/
|
*/
|
||||||
public $rowid;
|
public $rowid;
|
||||||
|
|
||||||
@ -180,6 +180,7 @@ class Partnership extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
|
||||||
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
|
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
|
||||||
|
//'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnershiptype.class.php', 'label' => 'Type', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'position' => 20),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
|
||||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||||
@ -353,15 +354,16 @@ class Partnership extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id of object to load
|
* @param int $id Id of object to load
|
||||||
* @param string $ref Ref of object
|
* @param string $ref Ref of object
|
||||||
* @param int $fk_soc_or_member fk_soc or fk_member
|
* @param int $fk_soc fk_soc
|
||||||
|
* @param int $fk_member fk_member
|
||||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||||
*/
|
*/
|
||||||
public function fetch($id, $ref = null, $fk_soc_or_member = null)
|
public function fetch($id, $ref = null, $fk_member = null, $fk_soc = null)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($id) && empty($ref) && empty($fk_soc_or_member)) {
|
if (empty($id) && empty($ref) && empty($fk_member) && empty($fk_soc)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +377,7 @@ class Partnership extends CommonObject
|
|||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'partnership as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'partnership as p';
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$sql .= " WHERE p.rowid=".$id;
|
$sql .= " WHERE p.rowid=".((int) $id);
|
||||||
} else {
|
} else {
|
||||||
$sql .= " WHERE p.entity IN (0,".getEntity('partnership').")"; // Dont't use entity if you use rowid
|
$sql .= " WHERE p.entity IN (0,".getEntity('partnership').")"; // Dont't use entity if you use rowid
|
||||||
}
|
}
|
||||||
@ -384,14 +386,13 @@ class Partnership extends CommonObject
|
|||||||
$sql .= " AND p.ref='".$this->db->escape($ref)."'";
|
$sql .= " AND p.ref='".$this->db->escape($ref)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fk_soc_or_member) {
|
if ($fk_member > 0) {
|
||||||
$sql .= ' AND';
|
$sql .= ' AND p.fk_member = '.((int) $fk_member);
|
||||||
if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member')
|
|
||||||
$sql .= ' p.fk_member = ';
|
|
||||||
else $sql .= ' p.fk_soc = ';
|
|
||||||
$sql .= $fk_soc_or_member;
|
|
||||||
$sql .= ' ORDER BY p.date_partnership_end DESC';
|
|
||||||
}
|
}
|
||||||
|
if ($fk_soc > 0) {
|
||||||
|
$sql .= ' AND p.fk_soc = '.((int) $fk_soc);
|
||||||
|
}
|
||||||
|
$sql .= ' ORDER BY p.date_partnership_end DESC';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -420,8 +421,6 @@ class Partnership extends CommonObject
|
|||||||
$this->import_key = $obj->import_key;
|
$this->import_key = $obj->import_key;
|
||||||
$this->model_pdf = $obj->model_pdf;
|
$this->model_pdf = $obj->model_pdf;
|
||||||
|
|
||||||
$this->lines = array();
|
|
||||||
|
|
||||||
// Retrieve all extrafield
|
// Retrieve all extrafield
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|||||||
@ -44,41 +44,12 @@
|
|||||||
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
|
||||||
|
|
||||||
// Load Dolibarr environment
|
// Load Dolibarr environment
|
||||||
$res = 0;
|
require '../main.inc.php';
|
||||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
|
||||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
|
||||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
|
||||||
}
|
|
||||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
|
||||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
|
||||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
|
||||||
$i--; $j--;
|
|
||||||
}
|
|
||||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
|
||||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
|
||||||
}
|
|
||||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
|
||||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
|
||||||
}
|
|
||||||
// Try main.inc.php using relative path
|
|
||||||
if (!$res && file_exists("../main.inc.php")) {
|
|
||||||
$res = @include "../main.inc.php";
|
|
||||||
}
|
|
||||||
if (!$res && file_exists("../../main.inc.php")) {
|
|
||||||
$res = @include "../../main.inc.php";
|
|
||||||
}
|
|
||||||
if (!$res && file_exists("../../../main.inc.php")) {
|
|
||||||
$res = @include "../../../main.inc.php";
|
|
||||||
}
|
|
||||||
if (!$res) {
|
|
||||||
die("Include of main fails");
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
dol_include_once('/partnership/class/partnership.class.php');
|
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||||
dol_include_once('/partnership/lib/partnership.lib.php');
|
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("partnership", "other"));
|
$langs->loadLangs(array("partnership", "other"));
|
||||||
@ -164,21 +135,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;
|
||||||
|
|
||||||
if ($action == 'add' || ($action == 'update' && $obj_partner != $fk_partner)) {
|
|
||||||
$fpartnership = new Partnership($db);
|
|
||||||
|
|
||||||
$partnershipid = $fpartnership->fetch(0, "", $fk_partner);
|
|
||||||
if ($partnershipid > 0) {
|
|
||||||
setEventMessages($langs->trans('PartnershipAlreadyExist').' : '.$fpartnership->getNomUrl(0, '', 1), '', 'errors');
|
|
||||||
$action = ($action == 'add') ? 'create' : 'edit';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$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_accept' && $confirm == 'yes' && $permissiontoadd) {
|
if ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) {
|
||||||
$result = $object->accept($user);
|
$result = $object->accept($user);
|
||||||
@ -275,8 +236,6 @@ if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fiel
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*
|
|
||||||
* Put here all code to build page
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|||||||
@ -48,6 +48,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
|
||||||
@ -70,11 +71,12 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
|||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
if (!empty($user->socid)) {
|
if (!empty($user->socid)) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
|
$id = $socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$societe = new Societe($db);
|
$object = new Societe($db);
|
||||||
if ($socid > 0) {
|
if ($id > 0) {
|
||||||
$societe->fetch($socid);
|
$object->fetch($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
@ -115,18 +117,13 @@ if (empty($conf->partnership->enabled)) accessforbidden();
|
|||||||
if (empty($permissiontoread)) accessforbidden();
|
if (empty($permissiontoread)) accessforbidden();
|
||||||
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
|
||||||
|
|
||||||
$partnershipid = $object->fetch(0, "", $socid);
|
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) {
|
||||||
if (empty($action) && empty($partnershipid)) {
|
accessforbidden();
|
||||||
$action = 'create';
|
|
||||||
}
|
}
|
||||||
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) accessforbidden();
|
|
||||||
|
|
||||||
if (empty($socid) && $object) {
|
|
||||||
$socid = $object->fk_soc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
|
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -145,102 +142,7 @@ $date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GET
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?socid='.($socid > 0 ? $socid : '__ID__');
|
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||||
|
|
||||||
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
|
|
||||||
|
|
||||||
if ($action == 'add' && $permissiontoread) {
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$old_start_date = $object->date_partnership_start;
|
|
||||||
|
|
||||||
$object->fk_soc = $socid;
|
|
||||||
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
|
|
||||||
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
|
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
|
||||||
$object->date_creation = $now;
|
|
||||||
$object->fk_user_creat = $user->id;
|
|
||||||
$object->entity = $conf->entity;
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$result = $object->create($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
if ($result == -4) {
|
|
||||||
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
$action = 'create';
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
} elseif ($action == 'update' && $permissiontoread) {
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$object->oldcopy = clone $object;
|
|
||||||
|
|
||||||
$old_start_date = $object->date_partnership_start;
|
|
||||||
|
|
||||||
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
|
|
||||||
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
|
|
||||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
|
||||||
$object->fk_user_creat = $user->id;
|
|
||||||
$object->fk_user_modif = $user->id;
|
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
|
||||||
if ($ret < 0) {
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
|
||||||
$result = $object->update($user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
if ($result == -4) {
|
|
||||||
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
$db->rollback();
|
|
||||||
$action = 'edit';
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
} elseif ($action == 'confirm_close' || $action == 'update_extras') {
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actions when linking object each other
|
// Actions when linking object each other
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
|
||||||
@ -250,6 +152,7 @@ $object->fields['fk_soc']['visible'] = 0;
|
|||||||
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
|
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
|
||||||
$object->fields['note_public']['visible'] = 1;
|
$object->fields['note_public']['visible'] = 1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -262,25 +165,22 @@ llxHeader('', $title);
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($socid) {
|
if ($id > 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$societe = new Societe($db);
|
$object = new Societe($db);
|
||||||
$result = $societe->fetch($socid);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if (!empty($conf->notification->enabled)) {
|
if (!empty($conf->notification->enabled)) {
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
}
|
}
|
||||||
$head = societe_prepare_head($societe);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'company');
|
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'company');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($societe, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
@ -310,7 +210,8 @@ if ($socid) {
|
|||||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||||
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -318,178 +219,12 @@ if ($socid) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
$params = '';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
} else {
|
} else {
|
||||||
dol_print_error('', 'Parameter socid not defined');
|
dol_print_error('', 'Parameter id not defined');
|
||||||
}
|
|
||||||
|
|
||||||
// Part to create
|
|
||||||
if ($action == 'create') {
|
|
||||||
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', '');
|
|
||||||
|
|
||||||
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?socid='.$socid;
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="add">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
|
||||||
print '<input type="hidden" name="fk_soc" value="'.$socid.'">';
|
|
||||||
|
|
||||||
if ($backtopage) {
|
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
||||||
}
|
|
||||||
if ($backtopageforcancel) {
|
|
||||||
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
|
||||||
}
|
|
||||||
|
|
||||||
print dol_get_fiche_head(array(), '');
|
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
|
||||||
|
|
||||||
print '</table>'."\n";
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center">';
|
|
||||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Validate")).'">';
|
|
||||||
print ' ';
|
|
||||||
// print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Part to edit record
|
|
||||||
if (($partnershipid || $ref) && $action == 'edit') {
|
|
||||||
print load_fiche_titre($langs->trans("Partnership"), '', '');
|
|
||||||
|
|
||||||
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?socid='.$socid;
|
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="action" value="update">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
|
||||||
print '<input type="hidden" name="fk_soc" value="'.$socid.'">';
|
|
||||||
if ($backtopage) {
|
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
|
||||||
}
|
|
||||||
if ($backtopageforcancel) {
|
|
||||||
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
|
||||||
}
|
|
||||||
|
|
||||||
print dol_get_fiche_head();
|
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
|
|
||||||
print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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'))) {
|
||||||
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv("Partnership")), '', '');
|
|
||||||
|
|
||||||
$res = $object->fetch_optionals();
|
|
||||||
|
|
||||||
// $head = partnershipPrepareHead($object);
|
|
||||||
// print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto);
|
|
||||||
|
|
||||||
$linkback = '';
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref');
|
|
||||||
|
|
||||||
$formconfirm = '';
|
|
||||||
|
|
||||||
// Close confirmation
|
|
||||||
if ($action == 'close') {
|
|
||||||
// Create an array for form
|
|
||||||
$formquestion = array();
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1);
|
|
||||||
}
|
|
||||||
// Reopon confirmation
|
|
||||||
if ($action == 'reopen') {
|
|
||||||
// Create an array for form
|
|
||||||
$formquestion = array();
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refuse confirmatio
|
|
||||||
if ($action == 'refuse') {
|
|
||||||
//Form to close proposal (signed or not)
|
|
||||||
$formquestion = array(
|
|
||||||
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace)
|
|
||||||
);
|
|
||||||
|
|
||||||
// if (!empty($conf->notification->enabled)) {
|
|
||||||
// require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
|
||||||
// $notify = new Notify($db);
|
|
||||||
// $formquestion = array_merge($formquestion, array(
|
|
||||||
// array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)),
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call Hook formConfirm
|
|
||||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
if (empty($reshook)) {
|
|
||||||
$formconfirm .= $hookmanager->resPrint;
|
|
||||||
} elseif ($reshook > 0) {
|
|
||||||
$formconfirm = $hookmanager->resPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print form confirm
|
|
||||||
print $formconfirm;
|
|
||||||
|
|
||||||
|
|
||||||
// Object card
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
$linkback = '<a href="'.dol_buildpath('/partnership/partnership_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
|
||||||
print '<div class="fichehalfleft">';
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
|
||||||
print '<table class="border centpercent tableforfield">'."\n";
|
|
||||||
|
|
||||||
// Common attributes
|
|
||||||
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
|
|
||||||
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
|
||||||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
// Buttons for actions
|
// Buttons for actions
|
||||||
|
|
||||||
if ($action != 'presend') {
|
if ($action != 'presend') {
|
||||||
@ -501,26 +236,43 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
if ($object->status == $object::STATUS_DRAFT) {
|
|
||||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$socid.'&action=edit&token='.newtoken(), '', $permissiontoadd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show
|
// Show
|
||||||
if ($permissiontoadd) {
|
if ($permissiontoadd) {
|
||||||
print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd);
|
print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/societe/partnership.php?id='.$object->id), '', $permissiontoadd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel
|
|
||||||
/*
|
|
||||||
if ($permissiontoadd) {
|
|
||||||
if ($object->status == $object::STATUS_ACCEPTED) {
|
|
||||||
print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
print '</div>'."\n";
|
print '</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php';
|
||||||
|
$morehtmlright = '';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, '');
|
||||||
|
|
||||||
|
$socid = $object->id;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Replace this card with the list of all partnerships.
|
||||||
|
|
||||||
|
$object = new Partnership($db);
|
||||||
|
$partnershipid = $object->fetch(0, '', 0, $socid);
|
||||||
|
|
||||||
|
if ($partnershipid > 0) {
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border centpercent tableforfield">'."\n";
|
||||||
|
|
||||||
|
// Common attributes
|
||||||
|
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
|
||||||
|
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
||||||
|
//unset($object->fields['fk_member']); // Hide field already shown in banner
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user