Add right supplier_invoice

This commit is contained in:
Alexandre SPANGARO 2021-04-12 07:37:34 +02:00
parent 2a1a22763d
commit 87cc1b2601
17 changed files with 69 additions and 45 deletions

View File

@ -1038,7 +1038,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) { if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) {
$langs->load("bills"); $langs->load("bills");
$newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create'); $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {

View File

@ -44,9 +44,17 @@ if ($module == 'propal') {
} elseif ($module == 'fichinter') { } elseif ($module == 'fichinter') {
$permission = $user->rights->ficheinter->creer; $permission = $user->rights->ficheinter->creer;
} elseif ($module == 'order_supplier') { } elseif ($module == 'order_supplier') {
$permission = $user->rights->fournisseur->commande->creer; if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
} elseif ($module == 'invoice_supplier') { $permission = $user->rights->fournisseur->commande->creer;
$permission = $user->rights->fournisseur->facture->creer; } else {
$permission = $user->rights->supplier_order->creer;
}
} elseif ($module == 'invoice_supplier' && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
} else {
$permission = $user->rights->supplier_invoice->creer;
}
} elseif ($module == 'project') { } elseif ($module == 'project') {
$permission = $user->rights->projet->creer; $permission = $user->rights->projet->creer;
} elseif ($module == 'action') { } elseif ($module == 'action') {

View File

@ -162,10 +162,18 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$permok = !empty($user->rights->$keyforperm->creer) || !empty($user->rights->$keyforperm->create) || !empty($user->rights->$keyforperm->write); $permok = !empty($user->rights->$keyforperm->creer) || !empty($user->rights->$keyforperm->create) || !empty($user->rights->$keyforperm->write);
} }
if ($object->element == 'order_supplier') { if ($object->element == 'order_supplier') {
$permok = $user->rights->fournisseur->commande->creer; if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permok = $user->rights->fournisseur->commande->creer;
} else {
$permok = $user->rights->supplier_order->creer;
}
} }
if ($object->element == 'invoice_supplier') { if ($object->element == 'invoice_supplier') {
$permok = $user->rights->fournisseur->facture->creer; if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permok = $user->rights->fournisseur->facture->creer;
} else {
$permok = $user->rights->supplier_invoice->creer;
}
} }
if ($object->element == 'shipping') { if ($object->element == 'shipping') {
$permok = $user->rights->expedition->creer; $permok = $user->rights->expedition->creer;

View File

@ -70,9 +70,17 @@ if ($module == 'propal') {
} elseif ($module == 'project_task') { } elseif ($module == 'project_task') {
$permission = $user->rights->projet->creer; $permission = $user->rights->projet->creer;
} elseif ($module == 'invoice_supplier') { } elseif ($module == 'invoice_supplier') {
$permission = $user->rights->fournisseur->facture->creer; if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
} else {
$permission = $user->rights->supplier_invoice->creer;
}
} elseif ($module == 'order_supplier') { } elseif ($module == 'order_supplier') {
$permission = $user->rights->fournisseur->commande->creer; if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->commande->creer;
} else {
$permission = $user->rights->supplier_order->creer;
}
} elseif ($module == 'societe') { } elseif ($module == 'societe') {
$permission = $user->rights->societe->creer; $permission = $user->rights->societe->creer;
} elseif ($module == 'contact') { } elseif ($module == 'contact') {

View File

@ -841,7 +841,7 @@ if ($object->id > 0) {
} }
} }
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
if (!empty($orders2invoice) && $orders2invoice > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) {
if ($object->status == 1) { if ($object->status == 1) {
// Company is open // Company is open
@ -854,7 +854,7 @@ if ($object->id > 0) {
} }
} }
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
$langs->load("bills"); $langs->load("bills");
if ($object->status == 1) { if ($object->status == 1) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';

View File

@ -2465,7 +2465,7 @@ if ($action == 'create') {
//if (! empty($conf->facture->enabled)) //if (! empty($conf->facture->enabled))
//{ //{
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
} }
} }
@ -2477,7 +2477,7 @@ if ($action == 'create') {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
} else { } else {
if (!empty($object->linkedObjectsIds['invoice_supplier'])) { if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
} }
} else { } else {

View File

@ -459,7 +459,7 @@ if (empty($reshook)) {
// Fac builddoc // Fac builddoc
$donotredirect = 1; $donotredirect = 1;
$upload_dir = $conf->fournisseur->facture->dir_output; $upload_dir = $conf->fournisseur->facture->dir_output;
$permissiontoadd = $user->rights->fournisseur->facture->creer; $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
//include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; //include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
@ -880,7 +880,7 @@ if ($resql) {
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
); );
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
$arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier"); $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
} }
if ($user->rights->fournisseur->commande->supprimer) { if ($user->rights->fournisseur->commande->supprimer) {

View File

@ -111,9 +111,9 @@ $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft);
// Common permissions // Common permissions
$usercanread = $user->rights->fournisseur->facture->lire; $usercanread = ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire);
$usercancreate = $user->rights->fournisseur->facture->creer; $usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
$usercandelete = $user->rights->fournisseur->facture->supprimer; $usercandelete = ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer);
// Advanced permissions // Advanced permissions
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate)));
@ -395,7 +395,7 @@ if (empty($reshook)) {
} }
if ($action == 'settransportmode' && $user->rights->fournisseur->facture->creer) { if ($action == 'settransportmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
// transport mode // transport mode
$result = $object->setTransportMode(GETPOST('transport_mode_id', 'int')); $result = $object->setTransportMode(GETPOST('transport_mode_id', 'int'));
} elseif ($action == 'setlabel' && $usercancreate) { } elseif ($action == 'setlabel' && $usercancreate) {
@ -2894,7 +2894,7 @@ if ($action == 'create') {
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('IntracommReportTransportMode'); print $langs->trans('IntracommReportTransportMode');
print '</td>'; print '</td>';
if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) { if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';

View File

@ -53,7 +53,7 @@ $object = new FactureFournisseur($db);
* Ajout d'un nouveau contact * Ajout d'un nouveau contact
*/ */
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) { if ($action == 'addcontact' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
if ($result > 0 && $id > 0) { if ($result > 0 && $id > 0) {
@ -73,14 +73,14 @@ if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} elseif ($action == 'swapstatut' && $user->rights->fournisseur->facture->creer) { } elseif ($action == 'swapstatut' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
// bascule du statut d'un contact // bascule du statut d'un contact
if ($object->fetch($id)) { if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int')); $result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} elseif ($action == 'deletecontact' && $user->rights->fournisseur->facture->creer) { } elseif ($action == 'deletecontact' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
// Efface un contact // Efface un contact
$object->fetch($id); $object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int')); $result = $object->delete_contact(GETPOST("lineid", 'int'));

View File

@ -251,8 +251,8 @@ if ($object->id > 0) {
$modulepart = 'facture_fournisseur'; $modulepart = 'facture_fournisseur';
$permission = $user->rights->fournisseur->facture->creer; $permission = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
$permtoedit = $user->rights->fournisseur->facture->creer; $permtoedit = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
$param = '&facid='.$object->id; $param = '&facid='.$object->id;
$defaulttpldir = '/core/tpl'; $defaulttpldir = '/core/tpl';

View File

@ -274,9 +274,9 @@ if (empty($reshook)) {
// Mass actions // Mass actions
$objectclass = 'FactureFournisseur'; $objectclass = 'FactureFournisseur';
$objectlabel = 'SupplierInvoices'; $objectlabel = 'SupplierInvoices';
$permissiontoread = $user->rights->fournisseur->facture->lire; $permissiontoread = ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire);
$permissiontoadd = $user->rights->fournisseur->facture->creer; $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
$permissiontodelete = $user->rights->fournisseur->facture->supprimer; $permissiontodelete = ($user->rights->fournisseur->facture->supprimer || $user->rights->supplier_invoice->supprimer);
$uploaddir = $conf->fournisseur->facture->dir_output; $uploaddir = $conf->fournisseur->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@ -878,7 +878,7 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->fournisseur->facture->creer); $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer));
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";

View File

@ -48,7 +48,7 @@ $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db); $object = new FactureFournisseur($db);
$object->fetch($id, $ref); $object->fetch($id, $ref);
$permissionnote = $user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer); // Used by the include of actions_setnotes.inc.php
/* /*
@ -58,7 +58,7 @@ $permissionnote = $user->rights->fournisseur->facture->creer; // Used by the inc
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
// Set label // Set label
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer) { if ($action == 'setlabel' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
$object->label = $_POST['label']; $object->label = $_POST['label'];
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) { if ($result < 0) {

View File

@ -62,7 +62,7 @@ if ($socid && $socid != $object->thirdparty->id) {
* Actions * Actions
*/ */
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer) { if ($action == 'setnote' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
$db->begin(); $db->begin();
$object->fetch($id); $object->fetch($id);
@ -92,7 +92,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
} }
if ($action == 'confirm_validate' && $confirm == 'yes' && if ($action == 'confirm_validate' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->facture->creer)) ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && (!empty($user->rights->fournisseur->facture->creer) || !empty($user->rights->supplier_invoice->creer)))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate))) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
) { ) {
$db->begin(); $db->begin();
@ -182,9 +182,9 @@ if ($result > 0) {
print '</td></tr>';*/ print '</td></tr>';*/
// Date of payment // Date of payment
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>'; print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)).'</td>';
print '<td>'; print '<td>';
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
@ -241,9 +241,9 @@ if ($result > 0) {
} }
// Note // Note
print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td>'; print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note, $object, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)).'</td>';
print '<td>'; print '<td>';
print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea'); print $form->editfieldval("Note", 'note', $object->note, $object, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), 'textarea');
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -336,7 +336,7 @@ if ($result > 0) {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
if ($user->socid == 0 && $object->statut == 0 && $action == '') { if ($user->socid == 0 && $object->statut == 0 && $action == '') {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->facture->creer)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && (!empty($user->rights->fournisseur->facture->creer) || !empty($user->rights->supplier_invoice->creer)))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate))) { || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate))) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Valid').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Valid').'</a>';
} }
@ -363,8 +363,8 @@ if ($result > 0) {
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
$filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref); $filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
$genallowed = $user->rights->fournisseur->facture->lire; $genallowed = ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire);
$delallowed = $user->rights->fournisseur->facture->creer; $delallowed = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
$modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF) ? '' : $conf->global->SUPPLIER_PAYMENT_ADDON_PDF)); $modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF) ? '' : $conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
print $formfile->showdocuments('supplier_payment', $ref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $societe->default_lang); print $formfile->showdocuments('supplier_payment', $ref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $societe->default_lang);

View File

@ -1274,7 +1274,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
$langs->load("suppliers"); $langs->load("suppliers");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierOrder").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierOrder").'</a>';
} }
if (!empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->creer) { if (!empty($conf->supplier_invoice->enabled) && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
$langs->load("suppliers"); $langs->load("suppliers");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierInvoice").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierInvoice").'</a>';
} }

View File

@ -437,8 +437,8 @@ $listofreferent = array(
'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
'lang'=>'suppliers', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierInvoice', 'buttonnew'=>'AddSupplierInvoice',
'testnew'=>$user->rights->fournisseur->facture->creer, 'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer),
'test'=>$conf->supplier_invoice->enabled && $user->rights->fournisseur->facture->lire), 'test'=>$conf->supplier_invoice->enabled && ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire),
'contract'=>array( 'contract'=>array(
'name'=>"Contracts", 'name'=>"Contracts",
'title'=>"ListContractAssociatedProject", 'title'=>"ListContractAssociatedProject",

View File

@ -1983,7 +1983,7 @@ if ($action == 'create') {
// Create bill // Create bill
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) { if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut == Reception::STATUS_VALIDATED || $object->statut == Reception::STATUS_CLOSED)) {
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
// TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) // TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION))
// If we do that, we must also make this option official. // If we do that, we must also make this option official.
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';

View File

@ -384,7 +384,7 @@ if (empty($reshook)) {
// Fac builddoc // Fac builddoc
$donotredirect = 1; $donotredirect = 1;
$upload_dir = $conf->fournisseur->facture->dir_output; $upload_dir = $conf->fournisseur->facture->dir_output;
$permissiontoadd = $user->rights->fournisseur->facture->creer; $permissiontoadd = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
@ -596,7 +596,7 @@ $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"), // 'presend'=>$langs->trans("SendByMail"),
); );
if ($user->rights->fournisseur->facture->creer) { if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
$arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier"); $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
} }
if ($massaction == 'createbills') { if ($massaction == 'createbills') {