Cleanup user rights on supplier proposal card
This commit is contained in:
parent
9e1c0efc5c
commit
b0ec9c1fcf
@ -96,9 +96,23 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
dol_print_error('', $object->error);
|
dol_print_error('', $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php
|
// Common permissions
|
||||||
$permissiondellink = $user->rights->supplier_proposal->creer; // Used by the include of actions_dellink.inc.php
|
$usercanread = $user->rights->supplier_proposal->lire;
|
||||||
$permissiontoedit = $user->rights->supplier_proposal->creer; // Used by the include of actions_lineupdown.inc.php
|
$usercancreate = $user->rights->supplier_proposal->creer;
|
||||||
|
$usercandelete = $user->rights->supplier_proposal->supprimer;
|
||||||
|
|
||||||
|
// Advanced permissions
|
||||||
|
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance)));
|
||||||
|
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance);
|
||||||
|
|
||||||
|
// Additional area permissions
|
||||||
|
$usercanclose = $user->rights->supplier_proposal->cloturer;
|
||||||
|
$usercancreateorder = $user->rights->fournisseur->commande->creer;
|
||||||
|
|
||||||
|
// Permissions for includes
|
||||||
|
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||||
|
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||||
|
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -152,7 +166,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete askprice
|
// Delete askprice
|
||||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->supplier_proposal->supprimer)
|
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||||
{
|
{
|
||||||
$result = $object->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -165,7 +179,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove line
|
// Remove line
|
||||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->supplier_proposal->creer)
|
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||||
{
|
{
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($lineid);
|
||||||
// reorder lines
|
// reorder lines
|
||||||
@ -189,10 +203,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' &&
|
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->creer))
|
|
||||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance)))
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@ -223,7 +234,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'setdate_livraison' && $user->rights->supplier_proposal->creer)
|
elseif ($action == 'setdate_livraison' && $usercancreate)
|
||||||
{
|
{
|
||||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -231,7 +242,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create supplier proposal
|
// Create supplier proposal
|
||||||
elseif ($action == 'add' && $user->rights->supplier_proposal->creer)
|
elseif ($action == 'add' && $usercancreate)
|
||||||
{
|
{
|
||||||
$object->socid = $socid;
|
$object->socid = $socid;
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
@ -460,7 +471,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reopen proposal
|
// Reopen proposal
|
||||||
elseif ($action == 'confirm_reopen' && $user->rights->supplier_proposal->cloturer && !GETPOST('cancel', 'alpha')) {
|
elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) {
|
||||||
// prevent browser refresh from reopening proposal several times
|
// prevent browser refresh from reopening proposal several times
|
||||||
if ($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) {
|
if ($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) {
|
||||||
$object->reopen($user, SupplierProposal::STATUS_VALIDATED);
|
$object->reopen($user, SupplierProposal::STATUS_VALIDATED);
|
||||||
@ -468,7 +479,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close proposal
|
// Close proposal
|
||||||
elseif ($action == 'close' && $user->rights->supplier_proposal->cloturer && !GETPOST('cancel', 'alpha')) {
|
elseif ($action == 'close' && $usercanclose && !GETPOST('cancel', 'alpha')) {
|
||||||
// prevent browser refresh from reopening proposal several times
|
// prevent browser refresh from reopening proposal several times
|
||||||
if ($object->statut == SupplierProposal::STATUS_SIGNED) {
|
if ($object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||||
$object->setStatut(SupplierProposal::STATUS_CLOSE);
|
$object->setStatut(SupplierProposal::STATUS_CLOSE);
|
||||||
@ -476,7 +487,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set accepted/refused
|
// Set accepted/refused
|
||||||
elseif ($action == 'setstatut' && $user->rights->supplier_proposal->cloturer && !GETPOST('cancel', 'alpha')) {
|
elseif ($action == 'setstatut' && $usercanclose && !GETPOST('cancel', 'alpha')) {
|
||||||
if (!GETPOST('statut')) {
|
if (!GETPOST('statut')) {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), null, 'errors');
|
||||||
$action = 'statut';
|
$action = 'statut';
|
||||||
@ -499,12 +510,12 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->supplier_proposal->dir_output;
|
$upload_dir = $conf->supplier_proposal->dir_output;
|
||||||
$permissiontoadd = $user->rights->supplier_proposal->creer;
|
$permissiontoadd = $usercancreate;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
// Go back to draft
|
// Go back to draft
|
||||||
if ($action == 'modif' && $user->rights->supplier_proposal->creer)
|
if ($action == 'modif' && $usercancreate)
|
||||||
{
|
{
|
||||||
$object->setDraft($user);
|
$object->setDraft($user);
|
||||||
|
|
||||||
@ -522,7 +533,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == "setabsolutediscount" && $user->rights->supplier_proposal->creer) {
|
elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||||
if ($_POST["remise_id"]) {
|
if ($_POST["remise_id"]) {
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->insert_discount($_POST["remise_id"]);
|
$result = $object->insert_discount($_POST["remise_id"]);
|
||||||
@ -534,7 +545,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a product line
|
// Add a product line
|
||||||
if ($action == 'addline' && $user->rights->supplier_proposal->creer)
|
if ($action == 'addline' && $usercancreate)
|
||||||
{
|
{
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -845,7 +856,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour d'une ligne dans la demande de prix
|
// Mise a jour d'une ligne dans la demande de prix
|
||||||
elseif ($action == 'updateline' && $user->rights->supplier_proposal->creer && GETPOST('save') == $langs->trans("Save")) {
|
elseif ($action == 'updateline' && $usercancreate && GETPOST('save') == $langs->trans("Save")) {
|
||||||
$vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0);
|
$vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0);
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
@ -1013,46 +1024,46 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'updateline' && $user->rights->supplier_proposal->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
||||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set project
|
// Set project
|
||||||
elseif ($action == 'classin' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'classin' && $usercancreate) {
|
||||||
$object->setProject(GETPOST('projectid'), 'int');
|
$object->setProject(GETPOST('projectid'), 'int');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delivery delay
|
// Delivery delay
|
||||||
elseif ($action == 'setavailability' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setavailability' && $usercancreate) {
|
||||||
$result = $object->availability($_POST['availability_id']);
|
$result = $object->availability($_POST['availability_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terms of payments
|
// Terms of payments
|
||||||
elseif ($action == 'setconditions' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setconditions' && $usercancreate) {
|
||||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'setremisepercent' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'setremiseabsolue' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment mode
|
// Payment mode
|
||||||
elseif ($action == 'setmode' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setmode' && $usercancreate) {
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
elseif ($action == 'setmulticurrencycode' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
elseif ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) {
|
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1480,8 +1491,8 @@ if ($action == 'create')
|
|||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
// Ref supplier
|
// Ref supplier
|
||||||
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
|
//$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreateorder, 'string', '', 0, 1);
|
||||||
//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
|
//$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreateorder, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
|
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
|
||||||
@ -1490,7 +1501,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||||
if ($user->rights->supplier_proposal->creer)
|
if ($usercancreate)
|
||||||
{
|
{
|
||||||
if ($action != 'classify') {
|
if ($action != 'classify') {
|
||||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||||
@ -1680,7 +1691,7 @@ if ($action == 'create')
|
|||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('BankAccount');
|
print $langs->trans('BankAccount');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editbankaccount' && $user->rights->supplier_proposal->creer)
|
if ($action != 'editbankaccount' && $usercancreate)
|
||||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
@ -1809,7 +1820,7 @@ if ($action == 'create')
|
|||||||
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector);
|
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector);
|
||||||
|
|
||||||
// Form to add new line
|
// Form to add new line
|
||||||
if ($object->statut == SupplierProposal::STATUS_DRAFT && $user->rights->supplier_proposal->creer)
|
if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate)
|
||||||
{
|
{
|
||||||
if ($action != 'editline')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
@ -1870,22 +1881,20 @@ if ($action == 'create')
|
|||||||
if ($action != 'statut' && $action != 'editline')
|
if ($action != 'statut' && $action != 'editline')
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 &&
|
if ($object->statut == SupplierProposal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 && $usercanvalidate)
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->creer))
|
{
|
||||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->supplier_proposal->validate_advance)))
|
|
||||||
) {
|
|
||||||
if (count($object->lines) > 0)
|
if (count($object->lines) > 0)
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a></div>';
|
||||||
// else print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Validate').'</a>';
|
// else print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Validate').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->creer) {
|
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $usercancreate) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReOpen
|
// ReOpen
|
||||||
if (($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) && $user->rights->supplier_proposal->cloturer) {
|
if (($object->statut == SupplierProposal::STATUS_SIGNED || $object->statut == SupplierProposal::STATUS_NOTSIGNED || $object->statut == SupplierProposal::STATUS_CLOSE) && $usercanclose) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen').'"';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen').'"';
|
||||||
print '>'.$langs->trans('ReOpen').'</a></div>';
|
print '>'.$langs->trans('ReOpen').'</a></div>';
|
||||||
}
|
}
|
||||||
@ -1893,7 +1902,7 @@ if ($action == 'create')
|
|||||||
// Send
|
// Send
|
||||||
if (empty($user->socid)) {
|
if (empty($user->socid)) {
|
||||||
if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) {
|
if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance) {
|
if ($usercansend) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
|
||||||
} else
|
} else
|
||||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
|
||||||
@ -1902,30 +1911,30 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Create an order
|
// Create an order
|
||||||
if (!empty($conf->fournisseur->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) {
|
if (!empty($conf->fournisseur->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||||
if ($user->rights->fournisseur->commande->creer) {
|
if ($usercancreateorder) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set accepted/refused
|
// Set accepted/refused
|
||||||
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $user->rights->supplier_proposal->cloturer) {
|
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $usercanclose) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
|
print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
|
||||||
print '>'.$langs->trans('SetAcceptedRefused').'</a></div>';
|
print '>'.$langs->trans('SetAcceptedRefused').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
if ($object->statut == SupplierProposal::STATUS_SIGNED && $user->rights->supplier_proposal->cloturer) {
|
if ($object->statut == SupplierProposal::STATUS_SIGNED && $usercanclose) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
|
||||||
print '>'.$langs->trans('Close').'</a></div>';
|
print '>'.$langs->trans('Close').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if ($user->rights->supplier_proposal->creer) {
|
if ($usercancreate) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if (($object->statut == SupplierProposal::STATUS_DRAFT && $user->rights->supplier_proposal->creer) || $user->rights->supplier_proposal->supprimer) {
|
if (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete) {
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete"';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete"';
|
||||||
print '>'.$langs->trans('Delete').'</a></div>';
|
print '>'.$langs->trans('Delete').'</a></div>';
|
||||||
}
|
}
|
||||||
@ -1945,8 +1954,8 @@ if ($action == 'create')
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->supplier_proposal->dir_output."/".dol_sanitizeFileName($object->ref);
|
$filedir = $conf->supplier_proposal->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
$genallowed = $user->rights->supplier_proposal->lire;
|
$genallowed = $usercanread;
|
||||||
$delallowed = $user->rights->supplier_proposal->creer;
|
$delallowed = $usercancreate;
|
||||||
|
|
||||||
print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
print $formfile->showdocuments('supplier_proposal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user