Merge pull request #9502 from frederic34/contractHookFormConfirm
NEW add hook formconfirm to contractcard
This commit is contained in:
commit
edb3671cf3
@ -1318,8 +1318,10 @@ else
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
|
||||
if ($result < 0) {
|
||||
dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
$nbofservices=count($object->lines);
|
||||
|
||||
@ -1334,56 +1336,54 @@ else
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
$hselected = 0;
|
||||
$hselected = 0;
|
||||
$formconfirm = '';
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract');
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract');
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression du contrat
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
|
||||
if ($action == 'delete') {
|
||||
//Confirmation de la suppression du contrat
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
|
||||
} elseif ($action == 'valid') {
|
||||
//Confirmation de la validation
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) {
|
||||
$numref = $object->getNextNumRef($object->thirdparty);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
}
|
||||
$text = $langs->trans('ConfirmValidateContract',$numref);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1);
|
||||
} elseif ($action == 'close') {
|
||||
// Confirmation de la fermeture
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
|
||||
} elseif ($action == 'activate') {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1);
|
||||
} elseif ($action == 'clone') {
|
||||
// Clone confirmation
|
||||
$formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation
|
||||
*/
|
||||
if ($action == 'valid')
|
||||
{
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV' && !empty($modCodeContract->code_auto))
|
||||
{
|
||||
$numref = $object->getNextNumRef($object->thirdparty);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numref = $object->ref;
|
||||
}
|
||||
// Call Hook formConfirm
|
||||
$parameters = array(
|
||||
'id' => $id,
|
||||
//'lineid' => $lineid,
|
||||
);
|
||||
// Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
|
||||
if (empty($reshook)) {
|
||||
$formconfirm .= $hookmanager->resPrint;
|
||||
} elseif ($reshook > 0) {
|
||||
$formconfirm = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$text=$langs->trans('ConfirmValidateContract',$numref);
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la fermeture
|
||||
*/
|
||||
if ($action == 'close')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
|
||||
|
||||
}
|
||||
if ($action == 'activate')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Contrat
|
||||
*/
|
||||
if (! empty($object->brouillon) && $user->rights->contrat->creer)
|
||||
@ -1393,12 +1393,6 @@ else
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
$formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||
}
|
||||
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
@ -1516,7 +1510,7 @@ else
|
||||
}
|
||||
|
||||
|
||||
$colorb='666666';
|
||||
$colorb = '666666';
|
||||
|
||||
$arrayothercontracts=$object->getListOfContracts('others');
|
||||
|
||||
|
||||
@ -163,27 +163,26 @@ if ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
@ -210,9 +209,12 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
if ($object->thirdparty->remise_percent) {
|
||||
print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
}
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
@ -239,9 +241,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Contacts lines
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user