Merge branch 'develop' into AddApiUrl
This commit is contained in:
commit
5525cfcab2
120 changed files with 541 additions and 342 deletions
|
|
@ -24,8 +24,8 @@ filter = web-dolibarr-rulesbruteforce
|
|||
logpath = /mypath/documents/documents/dolibarr.log
|
||||
action = %(action_mw)s
|
||||
bantime = 86400 ; 1 day
|
||||
findtime = 3600 ; 1 hour
|
||||
maxretry = 10
|
||||
findtime = 14400 ; 4 hours
|
||||
maxretry = 20
|
||||
|
||||
|
||||
[web-dol-limitpublic]
|
||||
|
|
|
|||
|
|
@ -375,10 +375,12 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
|
||||
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
|
||||
$moreforfilter .= '</div>';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
|
||||
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
|
|
@ -395,6 +397,14 @@ if ($action != 'export_csv') {
|
|||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -404,13 +414,18 @@ if ($action != 'export_csv') {
|
|||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
// TODO : Retrieve the type of third party: Customer / Supplier / Employee
|
||||
//if ($type == 'sub') {
|
||||
|
|
@ -428,7 +443,9 @@ if ($action != 'export_csv') {
|
|||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$total_debit = 0;
|
||||
|
|
@ -532,6 +549,14 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
if ($type == 'sub') {
|
||||
print '<td>'.$line->subledger_account.' <span class="opacitymedium">('.$line->subledger_label.')</span></td>';
|
||||
|
|
@ -581,9 +606,14 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Records the sub-total
|
||||
|
|
@ -593,7 +623,12 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
|
||||
if (!empty($show_subgroup)) {
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
print '<tr class="liste_total">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
|
@ -604,11 +639,19 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
print '<tr class="liste_total">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">'.price(price2num($total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
|
@ -619,7 +662,10 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
|
|
|||
|
|
@ -720,7 +720,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
|||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array();
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
|
||||
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
|
||||
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
|
||||
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ if (empty($reshook)) {
|
|||
$param = '&type='.$type.$param;
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||
//if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
|
||||
// $delmonth = GETPOST('delmonth', 'int');
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// if ($delyear == -1) {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
|
|
@ -446,7 +446,7 @@ if ($result) {
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
if (!$cancel) {
|
||||
if ($codeventil < 0) {
|
||||
$codeventil = 0;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_date_end = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$msg = '';
|
||||
|
||||
if (!empty($mesCasesCochees)) {
|
||||
|
|
|
|||
|
|
@ -109,14 +109,14 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva
|
|||
$sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
|
||||
} else {
|
||||
$sql .= " s.code_compta as code_compta,";
|
||||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " ppe.accountancy_code_buy,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy,";
|
||||
|
|
@ -124,20 +124,20 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
|||
$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
|
|
@ -146,8 +146,8 @@ if ($date_start && $date_end) {
|
|||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
|
|
@ -177,10 +177,10 @@ if ($result) {
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
$rcctva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT : 'NotDefined';
|
||||
$rcdtva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT : 'NotDefined';
|
||||
$cptfour = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined');
|
||||
$cpttva = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined');
|
||||
$rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
|
||||
$rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
|
||||
$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -193,9 +193,9 @@ if ($result) {
|
|||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'NotDefined');
|
||||
} else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', 'NotDefined');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ if ($result) {
|
|||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_counterpart_tva_npr = (!empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||
$compta_counterpart_tva_npr = getDolGlobalString('ACCOUNTING_COUNTERPART_VAT_NPR', 'NotDefined');
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
|
||||
|
|
@ -241,7 +241,7 @@ if ($result) {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if (($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
|
||||
if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
|
||||
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
|
||||
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
|
||||
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
|
||||
|
|
@ -340,7 +340,7 @@ if ($action == 'writebookkeeping') {
|
|||
$invoicestatic = new FactureFournisseur($db);
|
||||
$accountingaccountsupplier = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
$accountingaccountsupplier->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
|
@ -404,7 +404,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
|
||||
$bookkeeping->label_compte = $accountingaccountsupplier->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
|
||||
|
|
@ -462,7 +462,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
|
@ -523,7 +523,7 @@ if ($action == 'writebookkeeping') {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
@ -704,7 +704,7 @@ $form = new Form($db);
|
|||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
|
|
@ -752,7 +752,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
|
|
@ -796,7 +796,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
@ -871,7 +871,7 @@ if (empty($action) || $action == 'view') {
|
|||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
|
@ -886,7 +886,8 @@ if (empty($action) || $action == 'view') {
|
|||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
// Button to write into Ledger
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']);
|
||||
if ($acctSupplierNotConfigured) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
|
|
@ -894,10 +895,10 @@ if (empty($action) || $action == 'view') {
|
|||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
if ($acctSupplierNotConfigured) {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
|
|
@ -1023,7 +1024,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
|
||||
} else {
|
||||
|
|
@ -1067,7 +1068,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
|
|
@ -1097,7 +1098,7 @@ if (empty($action) || $action == 'view') {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
|||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
|
||||
} else {
|
||||
|
|
@ -117,26 +117,26 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
|||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
$sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " ppe.accountancy_code_sell";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
|
||||
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { // Non common setup
|
||||
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
|
||||
|
|
@ -146,8 +146,8 @@ if ($date_start && $date_end) {
|
|||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
|
|
@ -177,8 +177,8 @@ if ($result) {
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$cptcli = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined');
|
||||
$cpttva = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT', 'NotDefined');
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
|
|
@ -190,9 +190,9 @@ if ($result) {
|
|||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'NotDefined');
|
||||
} else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'NotDefined');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ if ($result) {
|
|||
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
|
||||
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
|
||||
$total_ttc = $obj->total_ttc * $situation_ratio;
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
|
||||
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
|
||||
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
|
||||
$total_ttc -= $retained_warranty;
|
||||
|
|
@ -315,11 +315,11 @@ if ($action == 'writebookkeeping') {
|
|||
$invoicestatic = new Facture($db);
|
||||
$accountingaccountcustomer = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
$accountingaccountcustomer->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), true);
|
||||
|
||||
$accountingaccountcustomerwarranty = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true);
|
||||
$accountingaccountcustomerwarranty->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'), true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
|
@ -381,7 +381,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
|
||||
|
|
@ -430,7 +430,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomer->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
|
||||
|
|
@ -488,7 +488,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
|
@ -657,7 +657,7 @@ $form = new Form($db);
|
|||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
|
|
@ -704,7 +704,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
|
||||
|
|
@ -723,7 +723,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
|
|
@ -800,7 +800,7 @@ if (empty($action) || $action == 'view') {
|
|||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
|
@ -815,7 +815,8 @@ if (empty($action) || $action == 'view') {
|
|||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
// Button to write into Ledger
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
$acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']);
|
||||
if ($acctCustomerNotConfigured) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
|
|
@ -823,10 +824,10 @@ if (empty($action) || $action == 'view') {
|
|||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
if ($acctCustomerNotConfigured) {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
|
|
@ -950,7 +951,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
} else {
|
||||
|
|
@ -980,7 +981,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
} else {
|
||||
|
|
@ -1024,7 +1025,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
if (!$cancel) {
|
||||
if ($codeventil < 0) {
|
||||
$codeventil = 0;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".$db->prefix()."facture_fourn_det as fd";
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$msg = '';
|
||||
|
||||
if (!empty($mesCasesCochees)) {
|
||||
|
|
@ -453,7 +453,7 @@ if ($result) {
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,7 @@ class AdherentType extends CommonObject
|
|||
|
||||
//$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
|
||||
if ($user->rights->adherent->configurer) {
|
||||
if ($user->hasRight('adherent', 'configurer')) {
|
||||
$return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.urlencode($this->ref).'">'.img_edit().'</a></span>';
|
||||
} else {
|
||||
$return .= '<span class="right"> </span>';
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ if ($reshook < 0) {
|
|||
}
|
||||
|
||||
// Create third party from a member
|
||||
if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
|
||||
if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) {
|
||||
if ($result > 0) {
|
||||
// Creation of thirdparty
|
||||
$company = new Societe($db);
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
|||
} else {
|
||||
print '<tr class="oddeven">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($user->rights->adherent->configurer) {
|
||||
if ($user->hasRight('adherent', 'configurer')) {
|
||||
print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
}
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
|||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($user->rights->adherent->configurer) {
|
||||
if ($user->hasRight('adherent', 'configurer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ class Documents extends DolibarrApi
|
|||
throw new RestException(404, 'Purchase order not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->fournisseur->dir_output."/commande/".dol_sanitizeFileName($object->ref);
|
||||
} elseif ($modulepart == 'shipment' || $modulepart == 'expedition') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ if (empty($action) && empty($id) && empty($ref)) {
|
|||
// Load object
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'delete')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $permissiontoadd; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
|
|
|||
|
|
@ -121,9 +121,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
|||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete)));
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
|
||||
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'delete')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete)));
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('asset')) {
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
|
||||
}
|
||||
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
|
||||
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
|
||||
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
$tmpobject = new Product($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'product';
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) {
|
||||
} elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) {
|
||||
$tmpobject = new Societe($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'supplier';
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) {
|
||||
} elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) {
|
||||
$tmpobject = new Societe($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'customer';
|
||||
|
|
@ -125,7 +125,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
$tmpobject = new Adherent($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'member';
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
|
||||
} elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$tmpobject = new Contact($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
|
|
@ -140,7 +140,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
$tmpobject = new Project($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'project';
|
||||
} elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) {
|
||||
} elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$tmpobject = new User($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
|
|
@ -174,13 +174,13 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
|||
|
||||
if ($elemid && $action == 'addintocategory' &&
|
||||
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
|
||||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
|
||||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) ||
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
)) {
|
||||
if ($type == Categorie::TYPE_PRODUCT) {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month')
|
|||
|
||||
$result = restrictedArea($user, 'agenda', $object, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create);
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -215,7 +215,7 @@ if (empty($reshook) && (GETPOST('addassignedtouser') || GETPOST('updateassignedt
|
|||
|
||||
// Link to a project
|
||||
if (empty($reshook) && $action == 'classin' && ($user->hasRight('agenda', 'allactions', 'create') ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))) {
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')))) {
|
||||
//$object->fetch($id);
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
|
@ -970,7 +970,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
|
|||
$object->fetch_userassigned();
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
if ($user->rights->agenda->myactions->delete
|
||||
if ($user->hasRight('agenda', 'myactions', 'delete')
|
||||
|| $user->rights->agenda->allactions->delete) {
|
||||
$result = $object->delete();
|
||||
|
||||
|
|
@ -1089,7 +1089,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
|
|||
|
||||
// Actions to delete doc
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$permissiontoadd = ($user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read));
|
||||
$permissiontoadd = ($user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'read')));
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
|
@ -2478,21 +2478,21 @@ if ($id > 0) {
|
|||
if (empty($reshook)) {
|
||||
if ($action != 'edit') {
|
||||
if ($user->hasRight('agenda', 'allactions', 'create') ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->hasRight('agenda', 'allactions', 'create') ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=clone&object='.$object->element.'&id='.$object->id.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->agenda->allactions->delete ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) {
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'delete'))) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Delete").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -2179,7 +2179,7 @@ class ActionComm extends CommonObject
|
|||
|
||||
if ($exportholiday == 1) {
|
||||
$langs->load("holiday");
|
||||
$title = $langs->trans("Holidays");
|
||||
$title = $langs->transnoentities("Holidays");
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.email, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ class AgendaEvents extends DolibarrApi
|
|||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('agenda', 'myactions', 'delete')) {
|
||||
throw new RestException(401, "Insufficient rights to delete your Agenda Event");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ if ($user->socid && $socid) {
|
|||
$result = restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create);
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
|
||||
$permissiontoadd = $usercancreate;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1875,7 +1875,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||
}
|
||||
} else {
|
||||
if ($user->hasRight('agenda', 'allactions', 'create') ||
|
||||
(($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) {
|
||||
(($event->authorid == $user->id || $event->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'))) {
|
||||
$cssclass .= " movable cursormove";
|
||||
} else {
|
||||
$cssclass .= " unmovable";
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ if ($user->socid && $socid) {
|
|||
$result = restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create);
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ $arrayofmassactions = array(
|
|||
if ($user->rights->agenda->allactions->delete) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->agenda->myactions->create) {
|
||||
if (isModEnabled('category') && $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setpricelevel' && $user->rights->societe->creer) {
|
||||
if ($action == 'setpricelevel' && $user->hasRight('societe', 'creer')) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($id);
|
||||
$soc->setPriceLevel(GETPOST("price_level"), $user);
|
||||
|
|
|
|||
|
|
@ -2800,7 +2800,7 @@ if ($action == 'create') {
|
|||
print '<td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
|||
|
||||
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permissiontocreate) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
//if ($user->hasRight('facture', 'creer'))
|
||||
|
||||
$amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha');
|
||||
$amount_ttc_1 = price2num($amount_ttc_1);
|
||||
|
|
@ -159,7 +159,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $permi
|
|||
|
||||
if ($action == 'setremise' && $permissiontocreate) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
//if ($user->hasRight('facture', 'creer'))
|
||||
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), '', 2);
|
||||
$desc = GETPOST('desc', 'alpha');
|
||||
|
|
@ -199,7 +199,7 @@ if ($action == 'setremise' && $permissiontocreate) {
|
|||
|
||||
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $permissiontocreate) {
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
//if ($user->hasRight('facture', 'creer'))
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
|
|
|||
|
|
@ -2742,7 +2742,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount TTC
|
||||
print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -2089,7 +2089,7 @@ if ($resql) {
|
|||
|
||||
// If module invoices enabled and user with invoice creation permissions
|
||||
if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$companystatic->id.'&search_billed=0&autoselectall=1">';
|
||||
print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').'</a>';
|
||||
|
|
|
|||
|
|
@ -1601,7 +1601,7 @@ if ($resql) {
|
|||
|
||||
// If module invoices enabled and user with invoice creation permissions
|
||||
if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
|
||||
print ' <a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$companystatic->id.'&search_billed=0&autoselectall=1">';
|
||||
print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').'</a>';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -34,7 +34,7 @@ class PaymentVarious extends CommonObject
|
|||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element = 'variouspayment';
|
||||
public $element = 'payment_various';
|
||||
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
|
|
@ -184,8 +184,6 @@ class PaymentVarious extends CommonObject
|
|||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_various';
|
||||
$this->table_element = 'payment_various';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1229,7 +1229,7 @@ if ($action == 'create') {
|
|||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
|
|
@ -1684,7 +1684,7 @@ if ($action == 'create') {
|
|||
),
|
||||
);
|
||||
if (empty($object->suspended)) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
} else {
|
||||
|
|
@ -1699,7 +1699,7 @@ if ($action == 'create') {
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
if (empty($object->suspended)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4801,7 +4801,6 @@ if ($action == 'create') {
|
|||
if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && $object->type == $object::TYPE_CREDIT_NOTE) {
|
||||
$sign = -1; // We invert sign for output
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
// Amount HT
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
|
|
@ -4849,7 +4848,7 @@ if ($action == 'create') {
|
|||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount TTC
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -237,9 +237,15 @@ class Facture extends CommonInvoice
|
|||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
* @var FactureLigne
|
||||
*/
|
||||
public $line;
|
||||
public $extraparams = array();
|
||||
|
||||
/**
|
||||
* @var int ID facture rec
|
||||
*/
|
||||
public $fac_rec;
|
||||
|
||||
public $date_pointoftax;
|
||||
|
|
@ -4434,7 +4440,7 @@ class Facture extends CommonInvoice
|
|||
$remise = 0;
|
||||
}
|
||||
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
$remise = price2num($remise, 2);
|
||||
|
||||
$error = 0;
|
||||
|
|
@ -4498,7 +4504,7 @@ class Facture extends CommonInvoice
|
|||
$remise = 0;
|
||||
}
|
||||
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -6008,6 +6014,9 @@ class FactureLigne extends CommonInvoiceLine
|
|||
*/
|
||||
public $table_element = 'facturedet';
|
||||
|
||||
/**
|
||||
* @var FactureLigne
|
||||
*/
|
||||
public $oldline;
|
||||
|
||||
//! From llx_facturedet
|
||||
|
|
@ -6065,6 +6074,16 @@ class FactureLigne extends CommonInvoiceLine
|
|||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db handler d'acces base de donnee
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load invoice line from database
|
||||
*
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ while ($i < $imaxinloop) {
|
|||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center">';
|
||||
if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) {
|
||||
if ($user->hasRight('facture', 'creer') && empty($invoicerectmp->suspended)) {
|
||||
if ($invoicerectmp->isMaxNbGenReached()) {
|
||||
print $langs->trans("MaxNumberOfGenerationReached");
|
||||
} elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
|
||||
|
|
@ -1044,7 +1044,7 @@ while ($i < $imaxinloop) {
|
|||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowrap center tdoverflowmax125">';
|
||||
if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) {
|
||||
if ($user->hasRight('facture', 'creer') && empty($invoicerectmp->suspended)) {
|
||||
if ($invoicerectmp->isMaxNbGenReached()) {
|
||||
print $langs->trans("MaxNumberOfGenerationReached");
|
||||
} elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
|||
<td class="linkedcol-ref" align="center"></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td>
|
||||
<td class="linkedcol-amount right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
if ($user->hasRight('facture', 'lire')) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ print '<div class="tabsAction">';
|
|||
|
||||
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
|
||||
if ($user->socid == 0 && $object->statut == 0 && $action == '') {
|
||||
if ($user->rights->facture->paiement) {
|
||||
if ($user->hasRight('facture', 'paiement')) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=valide&token='.newToken().'">'.$langs->trans('Valid').'</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,8 +246,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
|||
{
|
||||
if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
if ($user->rights->facture->paiement)
|
||||
{
|
||||
if ($user->hasRight('facture', 'paiement')){
|
||||
print '<a class="butAction" href="card.php?id='.GETPOST('id', 'int').'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,8 +287,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
|||
{
|
||||
if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
if ($user->rights->facture->paiement)
|
||||
{
|
||||
if ($user->hasRight('facture', 'paiement')) {
|
||||
print '<a class="butAction" href="card.php?id='.GETPOST('id', 'int').'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
|||
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
} else {
|
||||
// Confirm delete contact
|
||||
if ($action == 'delete' && $user->rights->societe->contact->supprimer) {
|
||||
if ($action == 'delete' && $user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ if (empty($user->socid)) {
|
|||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
|
||||
if (!$this->control->tpl['user_id'] && $user->hasRight('user', 'user', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Creation utilisateur depuis contact
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) {
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) {
|
||||
// Recuperation contact actuel
|
||||
$result = $object->fetch($id);
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->contact->supprimer) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
$result = $object->fetch($id);
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
|
|
@ -1390,7 +1390,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->contact->creer) {
|
||||
if ($action != 'editlevel' && $user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -1491,7 +1491,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
print $dolibarr_user->getLoginUrl(-1);
|
||||
} else {
|
||||
//print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
|
||||
if (!$object->user_id && $user->rights->user->user->creer) {
|
||||
if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) {
|
||||
print '<a class="aaa" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user&token='.newToken().'">'.img_picto($langs->trans("CreateDolibarrLogin"), 'add', 'class="pictofixedwidth"').$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
}
|
||||
|
|
@ -1527,11 +1527,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
}
|
||||
|
||||
// Activer
|
||||
if ($object->statut == 0 && $user->rights->societe->contact->creer) {
|
||||
if ($object->statut == 0 && $user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Reactivate").'</a>';
|
||||
}
|
||||
// Desactiver
|
||||
if ($object->statut == 1 && $user->rights->societe->contact->creer) {
|
||||
if ($object->statut == 1 && $user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("DisableUser").'</a>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -847,7 +847,7 @@ $arrayofmassactions = array(
|
|||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->societe->creer) {
|
||||
if (isModEnabled('category') && $user->hasRight('societe', 'creer')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ $errors = array();
|
|||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact->creer) {
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'contact', 'creer')) {
|
||||
$ret = $object->fetch($id);
|
||||
|
||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||
|
|
|
|||
|
|
@ -2150,7 +2150,7 @@ if ($action == 'create') {
|
|||
|
||||
if (isModEnabled('facture') && $object->statut > 0) {
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
|
||||
} else {
|
||||
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
||||
|
|
|
|||
|
|
@ -692,7 +692,7 @@ if ($user->rights->user->user->lire) {
|
|||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view categories of products
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
|
|
@ -701,7 +701,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right
|
|||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// Filter on customer categories
|
||||
if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && isModEnabled("categorie") && $user->rights->categorie->lire) {
|
||||
if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_CONTRACT_LIST) && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort');
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
|
||||
|
|
@ -974,7 +974,7 @@ while ($i < $imaxinloop) {
|
|||
$socstatic->name_alias = $obj->name_alias;
|
||||
$socstatic->email = $obj->email;
|
||||
$socstatic->status = $obj->company_status;
|
||||
$socstatic->logo = $obj->logo;
|
||||
$socstatic->logo = $obj->company_logo;
|
||||
$socstatic->country_id = $obj->country_id;
|
||||
$socstatic->country_code = '';
|
||||
$socstatic->country = '';
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class box_contacts extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max));
|
||||
|
||||
if ($user->hasRight('societe', 'lire') && $user->rights->societe->contact->lire) {
|
||||
if ($user->hasRight('societe', 'lire') && $user->hasRight('societe', 'contact', 'lire')) {
|
||||
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
|
||||
|
||||
$sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail";
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class box_factures extends ModeleBoxes
|
|||
'limit'=> dol_strlen($text)
|
||||
);
|
||||
|
||||
if ($user->rights->facture->lire) {
|
||||
if ($user->hasRight('facture', 'lire')) {
|
||||
$sql = "SELECT f.rowid as facid";
|
||||
$sql .= ", f.ref, f.type, f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class box_factures_fourn extends ModeleBoxes
|
|||
'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max)
|
||||
);
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
$langs->load("bills");
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* \file htdocs/core/boxes/box_factures_fourn_imp.php
|
||||
* \ingroup fournisseur
|
||||
* \brief Fichier de gestion d'une box des factures fournisseurs impayees
|
||||
* \brief Widget to show remain to get on purchase invoices
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
|
||||
|
|
@ -72,73 +72,83 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||
global $conf, $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
//$this->max = 1000;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
$thirdpartystatic = new Fournisseur($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $max));
|
||||
$langs->load("bills");
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
$langs->load("bills");
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills", $this->max));
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
$sql .= ", f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite";
|
||||
$sql .= ", f.datef as df";
|
||||
$sql .= ", f.total_ht as total_ht";
|
||||
$sql .= ", f.tva as total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
$sql .= ", f.paye, f.fk_statut as status, f.type";
|
||||
$sql .= ", f.tms";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
if ($user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
$sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql1 .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
|
||||
$sql1 .= ", s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql1 .= ", f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite";
|
||||
$sql1 .= ", f.datef as df";
|
||||
$sql1 .= ", f.total_ht";
|
||||
$sql1 .= ", f.total_tva";
|
||||
$sql1 .= ", f.total_ttc";
|
||||
$sql1 .= ", f.paye, f.fk_statut as status, f.type";
|
||||
$sql1 .= ", f.tms";
|
||||
$sql1 .= ", SUM(pf.amount) as am";
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql2 .= ",".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= " AND f.paye = 0";
|
||||
$sql .= " AND fk_statut = 1";
|
||||
$sql2 .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql2 .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
$sql2 .= " AND f.paye = 0";
|
||||
$sql2 .= " AND fk_statut = 1";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
$sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($user->socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $user->socid);
|
||||
$sql2 .= " AND s.rowid = ".((int) $user->socid);
|
||||
}
|
||||
$sql .= " ORDER BY datelimite DESC, f.ref_supplier DESC ";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
$sql3 .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
|
||||
$sql3 .= " f.rowid, f.ref, f.ref_supplier, f.date_lim_reglement,";
|
||||
$sql3 .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.tms";
|
||||
$sql3 .= " ORDER BY datelimite DESC, f.ref_supplier DESC ";
|
||||
$sql3 .= $this->db->plimit($this->max + 1, 0);
|
||||
|
||||
$sql = $sql1.$sql2.$sql3;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$line = 0;
|
||||
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)';
|
||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)';
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
|
||||
while ($line < $num) {
|
||||
while ($line < min($num, $this->max)) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
$date = $this->db->jdate($objp->df);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->date = $date;
|
||||
$facturestatic->date_echeance = $datelimite;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->status = $objp->status;
|
||||
|
||||
$alreadypaid = $facturestatic->getSommePaiement();
|
||||
//$alreadypaid = $facturestatic->getSommePaiement();
|
||||
|
||||
$facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0;
|
||||
$facturestatic->paye = $objp->paye;
|
||||
$facturestatic->alreadypaid = $objp->am;
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
|
|
@ -149,6 +159,13 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||
$thirdpartystatic->logo = $objp->logo;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->entity = $objp->entity;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->idprof1 = $objp->idprof1;
|
||||
$thirdpartystatic->idprof2 = $objp->idprof2;
|
||||
$thirdpartystatic->idprof3 = $objp->idprof3;
|
||||
$thirdpartystatic->idprof4 = $objp->idprof4;
|
||||
$thirdpartystatic->idprof5 = $objp->idprof5;
|
||||
$thirdpartystatic->idprof6 = $objp->idprof6;
|
||||
|
||||
$late = '';
|
||||
if ($facturestatic->hasDelay()) {
|
||||
|
|
@ -161,12 +178,12 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||
'td' => 'class="nowraponall"',
|
||||
'text' => $facturestatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'asis' => 1
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $thirdpartystatic->getNomUrl(1, '', 40),
|
||||
'text' => $thirdpartystatic->getNomUrl(1, '', 44),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
|
|
@ -182,19 +199,52 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),
|
||||
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am, $objp->type),
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
if ($this->max < $num) {
|
||||
$this->info_box_contents[$line][] = array('td' => 'colspan="6"', 'text' => '...');
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'td' => 'class="center opacitymedium"',
|
||||
'text'=>$langs->trans("NoUnpaidSupplierBills"),
|
||||
);
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$totalamount = $objp->total_ht;
|
||||
|
||||
// Add the sum à the bottom of the boxes
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'tr' => 'class="liste_total_wrap"',
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => $langs->trans("Total"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right liste_total" ',
|
||||
'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
/**
|
||||
* \file htdocs/core/boxes/box_factures_imp.php
|
||||
* \ingroup factures
|
||||
* \brief Module de generation de l'affichage de la box factures impayees
|
||||
* \brief Widget to show remain to get on sale invoices
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
|
|
@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|||
|
||||
|
||||
/**
|
||||
* Class to manage the box to show last invoices
|
||||
* Class to manage the box to show not paid sales invoices
|
||||
*/
|
||||
class box_factures_imp extends ModeleBoxes
|
||||
{
|
||||
|
|
@ -61,7 +61,7 @@ class box_factures_imp extends ModeleBoxes
|
|||
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = empty($user->rights->facture->lire);
|
||||
$this->hidden = !($user->hasRight('facture', 'lire'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -75,6 +75,7 @@ class box_factures_imp extends ModeleBoxes
|
|||
global $conf, $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
//$this->max = 1000;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
|
@ -84,66 +85,66 @@ class box_factures_imp extends ModeleBoxes
|
|||
|
||||
$langs->load("bills");
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $max));
|
||||
$textHead = $langs->trans("BoxTitleOldestUnpaidCustomerBills");
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills", $this->max), 'limit'=> dol_strlen($textHead));
|
||||
|
||||
if ($user->rights->facture->lire) {
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
|
||||
$sql .= ", s.code_client, s.client";
|
||||
if ($user->hasRight('facture', 'lire')) {
|
||||
$sql1 = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.code_client, s.client";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= ", spe.accountancy_code_customer as code_compta";
|
||||
$sql1 .= ", spe.accountancy_code_customer as code_compta";
|
||||
} else {
|
||||
$sql .= ", s.code_compta";
|
||||
$sql1 .= ", s.code_compta";
|
||||
}
|
||||
$sql .= ", s.logo, s.email, s.entity";
|
||||
$sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= ", f.ref, f.date_lim_reglement as datelimite";
|
||||
$sql .= ", f.type";
|
||||
$sql .= ", f.datef as date";
|
||||
$sql .= ", f.total_ht";
|
||||
$sql .= ", f.total_tva";
|
||||
$sql .= ", f.total_ttc";
|
||||
$sql .= ", f.paye, f.fk_statut as status, f.rowid as facid";
|
||||
$sql .= ", sum(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql1 .= ", s.logo, s.email, s.entity";
|
||||
$sql1 .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql1 .= ", f.ref, f.date_lim_reglement as datelimite";
|
||||
$sql1 .= ", f.type";
|
||||
$sql1 .= ", f.datef as date";
|
||||
$sql1 .= ", f.total_ht";
|
||||
$sql1 .= ", f.total_tva";
|
||||
$sql1 .= ", f.total_ttc";
|
||||
$sql1 .= ", f.paye, f.fk_statut as status, f.rowid as facid";
|
||||
$sql1 .= ", SUM(pf.amount) as am";
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND f.paye = 0";
|
||||
$sql .= " AND fk_statut = 1";
|
||||
$sql2 .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
|
||||
$sql2 .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql2 .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql2 .= " AND f.paye = 0";
|
||||
$sql2 .= " AND fk_statut = 1";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
$sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($user->socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $user->socid);
|
||||
$sql2 .= " AND s.rowid = ".((int) $user->socid);
|
||||
}
|
||||
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
|
||||
$sql3 .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
$sql3 .= " spe.accountancy_code_customer as code_compta,";
|
||||
} else {
|
||||
$sql .= " s.code_compta,";
|
||||
$sql3 .= " s.code_compta,";
|
||||
}
|
||||
$sql .= " f.ref, f.date_lim_reglement,";
|
||||
$sql .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
||||
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
|
||||
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
$sql3 .= " f.rowid, f.ref, f.date_lim_reglement,";
|
||||
$sql3 .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut";
|
||||
$sql3 .= " ORDER BY datelimite ASC, f.ref ASC ";
|
||||
$sql3 .= $this->db->plimit($this->max + 1, 0);
|
||||
|
||||
$sql = $sql1.$sql2.$sql3;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$now = dol_now();
|
||||
|
||||
$line = 0;
|
||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)';
|
||||
|
||||
while ($line < $num) {
|
||||
while ($line < min($num, $this->max)) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$datelimite = $this->db->jdate($objp->datelimite);
|
||||
|
|
@ -158,7 +159,9 @@ class box_factures_imp extends ModeleBoxes
|
|||
$facturestatic->status = $objp->status;
|
||||
$facturestatic->date = $this->db->jdate($objp->date);
|
||||
$facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite);
|
||||
$facturestatic->alreadypaid = $objp->paye;
|
||||
|
||||
$facturestatic->paye = $objp->paye;
|
||||
$facturestatic->alreadypaid = $objp->am;
|
||||
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
|
|
@ -212,14 +215,47 @@ class box_factures_imp extends ModeleBoxes
|
|||
|
||||
$line++;
|
||||
}
|
||||
if ($this->max < $num) {
|
||||
$this->info_box_contents[$line][] = array('td' => 'colspan="6"', 'text' => '...');
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center opacitymedium"',
|
||||
'text'=>$langs->trans("NoUnpaidCustomerBills")
|
||||
'td' => 'class="center opacitymedium"',
|
||||
'text'=>$langs->trans("NoUnpaidCustomerBills")
|
||||
);
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(f.total_ht) as total_ht ".$sql2;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$totalamount = $objp->total_ht;
|
||||
|
||||
// Add the sum à the bottom of the boxes
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'tr' => 'class="liste_total_wrap"',
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => $langs->trans("Total"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right liste_total" ',
|
||||
'text' => price($totalamount, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||
$prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
}
|
||||
|
||||
if ($user->rights->facture->lire) {
|
||||
if ($user->hasRight('facture', 'lire')) {
|
||||
$mesg = '';
|
||||
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
|
|||
if ($user->socid) $socid = $user->socid;
|
||||
if (empty($user->rights->societe->client->voir) || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->facture->lire) {
|
||||
if ($user->hasRight('facture', 'lire')) {
|
||||
$mesg = '';
|
||||
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||
$prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
}
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class box_members_by_tags extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").($numberyears ? ' ('.($year - $numberyears).' - '.$year.')' : ''));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$stats = new AdherentStats($this->db, $user->socid, $user->id);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class box_members_by_type extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType").($numberyears ? ' ('.($year-$numberyears).' - '.$year.')' : ''));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
$stats = new AdherentStats($this->db, $user->socid, $user->id);
|
||||
// Show array
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class box_members_last_modified extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.datec, a.tms as datem, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("LastSubscriptionsModified", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.gender, a.email, a.photo, a.morphy,";
|
||||
$sql .= " a.datefin as date_end_subscription,";
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
|||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersSubscriptionsByYear", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
$num = 0;
|
||||
$line = 0;
|
||||
// List of subscription by year
|
||||
|
|
|
|||
|
|
@ -1336,7 +1336,7 @@ class Form
|
|||
// mode 1
|
||||
$urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . join(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : '');
|
||||
|
||||
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
|
||||
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
|
||||
if (empty($hidelabel)) {
|
||||
print $langs->trans("RefOrLabel") . ' : ';
|
||||
} elseif ($hidelabel > 1) {
|
||||
|
|
@ -7946,7 +7946,7 @@ class Form
|
|||
$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdesc) . '&filter=' . urlencode($filter) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
|
||||
// Activate the auto complete using ajax call.
|
||||
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
||||
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
|
||||
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
|
||||
$out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />';
|
||||
} else {
|
||||
// Immediate load of table record.
|
||||
|
|
|
|||
|
|
@ -138,16 +138,16 @@ class FormAccounting extends Form
|
|||
/**
|
||||
* Return list of journals with label by nature
|
||||
*
|
||||
* @param array $selectedIds Preselected journal code array
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code
|
||||
* @param int $select_out Set value returned by select. 0=rowid (default), 1=code
|
||||
* @param string $morecss More css non HTML object
|
||||
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
||||
* @param int $disabledajaxcombo Disable ajax combo box.
|
||||
* @return string String with HTML select
|
||||
* @param array $selectedIds Preselected journal code array
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code
|
||||
* @param int $select_out Set value returned by select. 0=rowid (default), 1=code
|
||||
* @param string $morecss More css non HTML object
|
||||
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
||||
* @param int $disabledajaxcombo Disable ajax combo box.
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ if (empty($conf->dol_no_mouse_hover)) {
|
|||
print '
|
||||
jQuery(".classfortooltiponclicktext").dialog({
|
||||
closeOnEscape: true, classes: { "ui-dialog": "highlight" },
|
||||
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).',
|
||||
maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max((empty($_SESSION['dol_screenwidth']) ? 0 : $_SESSION['dol_screenwidth']) - 20, 320) : 700).',
|
||||
modal: true,
|
||||
autoOpen: false
|
||||
}).css("z-index: 5000");
|
||||
|
|
|
|||
|
|
@ -1324,7 +1324,8 @@ $(document).on('select2:open', (e) => {
|
|||
console.log("Execute the focus (click on combo or use space when on component");
|
||||
const target = $(e.target);
|
||||
if (target && target.length) {
|
||||
const id = target[0].id || target[0].name;
|
||||
let id = target[0].id || target[0].name;
|
||||
if (id.substr(-2) == "[]") id = id.substr(0,id.length-2);
|
||||
document.querySelector('input[aria-controls*='+id+']').focus();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3298,7 +3298,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
|||
$htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.dol_escape_htmltag($langs->trans("Chat").' '.$value).'">';
|
||||
$htmllink .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
|
||||
$htmllink .= '</a>';
|
||||
if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) {
|
||||
if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
$addlink = 'AC_SKYPE';
|
||||
$link = '';
|
||||
if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) {
|
||||
|
|
@ -3634,7 +3634,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
|
|||
}
|
||||
}
|
||||
|
||||
//if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create)
|
||||
//if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create'))
|
||||
if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
|
||||
$type = 'AC_TEL';
|
||||
$link = '';
|
||||
|
|
@ -5254,7 +5254,7 @@ function dol_print_error_email($prefixcode, $errormessage = '', $errormessages =
|
|||
$now = dol_now();
|
||||
|
||||
print '<br><div class="center login_main_message"><div class="'.$morecss.'">';
|
||||
print $langs->trans("ErrorContactEMail", $email, $prefixcode.dol_print_date($now, '%Y%m%d%H%M%S'));
|
||||
print $langs->trans("ErrorContactEMail", $email, $prefixcode.'-'.dol_print_date($now, '%Y%m%d%H%M%S'));
|
||||
if ($errormessage) {
|
||||
print '<br><br>'.$errormessage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,13 +608,13 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
|
|||
}
|
||||
} elseif (!empty($feature2)) { // This is for permissions on 2 levels (module->object->write)
|
||||
foreach ($feature2 as $subfeature) {
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) {
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->hasRight('user', 'self', 'creer')) {
|
||||
continue; // User can edit its own card
|
||||
}
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) {
|
||||
if ($subfeature == 'user' && $user->id == $objectid && $user->hasRight('user', 'self', 'password')) {
|
||||
continue; // User can edit its own password
|
||||
}
|
||||
if ($subfeature == 'user' && $user->id != $objectid && $user->rights->user->user->password) {
|
||||
if ($subfeature == 'user' && $user->id != $objectid && $user->hasRight('user', 'user', 'password')) {
|
||||
continue; // User can edit another user's password
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function user_prepare_head(User $object)
|
|||
|
||||
$canreadperms = true;
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$canreadperms = ($user->admin || ($user->id != $object->id && $user->rights->user->user_advance->readperms) || ($user->id == $object->id && $user->rights->user->self_advance->readperms));
|
||||
$canreadperms = ($user->admin || ($user->id != $object->id && $user->hasRight('user', 'user_advance', 'readperms')) || ($user->id == $object->id && $user->hasRight('user', 'self_advance', 'readperms')));
|
||||
}
|
||||
|
||||
$h = 0;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,10 @@ if ($action == 'delete') {
|
|||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page
|
|||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
|
|
|
|||
|
|
@ -103,8 +103,14 @@ if ($state) {
|
|||
$statewithanticsrfonly = preg_replace('/^.*\-/', '', $state);
|
||||
}
|
||||
|
||||
if ($action != 'delete' && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) {
|
||||
// Add a test to check that the state parameter is provided into URL when we make the first call to ask the redirect or when we receive the callback
|
||||
// but not when callback was ok and we recall the page
|
||||
if ($action != 'delete' && !GETPOST('afteroauthloginreturn', 'int') && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) {
|
||||
dol_syslog("state or statewithscopeonly and/or requestedpermissionsarray are empty");
|
||||
setEventMessages($langs->trans('ScopeUndefined'), null, 'errors');
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
|
@ -147,6 +153,8 @@ if ($action == 'delete') {
|
|||
}
|
||||
|
||||
if (!GETPOST('code')) {
|
||||
dol_syslog("Page is called without code parameter defined");
|
||||
|
||||
// If we enter this page without 'code' parameter, it means we click on the link from login page and we want to get the redirect
|
||||
// to the OAuth provider login page.
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
|
|
@ -291,6 +299,7 @@ if (!GETPOST('code')) {
|
|||
}
|
||||
|
||||
// If you specified a hd parameter value in the request, verify that the ID token has a hd claim that matches an accepted G Suite hosted domain.
|
||||
// $userinfo['hd'] is the domain name of Gmail account.
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
|
@ -342,11 +351,12 @@ if (!GETPOST('code')) {
|
|||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT;
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
// If call back to url for a OAUTH2 login
|
||||
// If call back to this url was for a OAUTH2 login
|
||||
if ($forlogin) {
|
||||
// _SESSION['googleoauth_receivedlogin'] has been set to the key to validate the next test by function_googleoauth(), so we can make the redirect
|
||||
$backtourl .= '?actionlogin=login&afteroauthloginreturn=1'.($username ? '&username='.urlencode($username) : '').'&token='.newToken();
|
||||
if (!empty($tmparray['entity'])) {
|
||||
$backtourl .= '&entity='.$tmparray['entity'];
|
||||
|
|
|
|||
|
|
@ -134,6 +134,10 @@ if ($action == 'delete') {
|
|||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ if ($action == 'delete') {
|
|||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
|
@ -162,6 +166,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page
|
|||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
|
||||
}
|
||||
|
||||
if (empty($url)) {
|
||||
$url = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -141,6 +141,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page
|
|||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
|
|
@ -162,6 +166,10 @@ if (GETPOST('code')) { // We are coming from oauth provider page
|
|||
$url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->$keyforparamid.'&scope=read_write';
|
||||
}
|
||||
|
||||
if (empty($url)) {
|
||||
$url = DOL_URL_ROOT.'/';
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ if ($permission) {
|
|||
$nbofcontacts = $form->num;
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer) {
|
||||
if (!empty($object->socid) && $object->socid > 1 && $user->hasRight('societe', 'creer')) {
|
||||
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$selectedCompany.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
}
|
||||
print $newcardbutton;
|
||||
|
|
|
|||
|
|
@ -2593,7 +2593,7 @@ if ($action == 'create') {
|
|||
|
||||
// Create bill
|
||||
if (isModEnabled('facture') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
// TODO show button only if (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))
|
||||
// If we do that, we must also make this option official.
|
||||
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||
|
|
|
|||
|
|
@ -1660,7 +1660,7 @@ if ($action == 'create') {
|
|||
if (isModEnabled('facture') && $object->statut > Fichinter::STATUS_DRAFT) {
|
||||
$langs->load("bills");
|
||||
if ($object->statut < Fichinter::STATUS_BILLED) {
|
||||
if ($user->rights->facture->creer) {
|
||||
if ($user->hasRight('facture', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddBill").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -295,8 +295,8 @@ if (!empty($dolibarr_main_force_https)) {
|
|||
define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
|
||||
$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain:port
|
||||
if ($suburi == '/') {
|
||||
$suburi = ''; // If $suburi is /, it is now ''
|
||||
if (empty($suburi) || $suburi === '/') {
|
||||
$suburi = ''; // If $suburi is null or /, it is now ''
|
||||
}
|
||||
if (!defined('DOL_URL_ROOT')) {
|
||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ if ($object->id > 0) {
|
|||
$langs->load('bills');
|
||||
$facturestatic = new FactureFournisseur($db);
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
// TODO move to DAO class
|
||||
$sql = 'SELECT f.rowid, f.libelle as label, f.ref, f.ref_supplier, f.fk_statut, f.datef as df, f.total_ht, f.total_tva, f.total_ttc, f.paye,';
|
||||
$sql .= ' SUM(pf.amount) as am';
|
||||
|
|
|
|||
|
|
@ -2600,7 +2600,7 @@ if ($action == 'create') {
|
|||
//if (isModEnabled('facture'))
|
||||
//{
|
||||
if (isModEnabled("supplier_invoice") && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
|
|
@ -2612,7 +2612,7 @@ if ($action == 'create') {
|
|||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
} else {
|
||||
if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1184,7 +1184,7 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->rights->supplier_invoice->creer) {
|
||||
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier");
|
||||
}
|
||||
if ($permissiontodelete) {
|
||||
|
|
|
|||
|
|
@ -3346,13 +3346,13 @@ if ($action == 'create') {
|
|||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('IntracommReportTransportMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit().'</a></td>';
|
||||
if ($action != 'edittransportmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&token='.newToken().'&id='.$object->id.'">'.img_edit().'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($action == 'editmode') {
|
||||
if ($action == 'edittransportmode') {
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1);
|
||||
} else {
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none');
|
||||
|
|
|
|||
|
|
@ -873,7 +873,7 @@ if ($resql) {
|
|||
}
|
||||
// Action column
|
||||
print '<td class="center tdoverflowmax125">';
|
||||
if ($user->rights->facture->creer && empty($supplierinvoicerectmp->suspended)) {
|
||||
if ($user->hasRight('facture', 'creer') && empty($supplierinvoicerectmp->suspended)) {
|
||||
if ($supplierinvoicerectmp->isMaxNbGenReached()) {
|
||||
print $langs->trans("MaxNumberOfGenerationReached");
|
||||
} elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
|||
<td class="left"><?php echo $objectlink->ref_supplier; ?></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
|
||||
<td class="right"><?php
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
$sign = 1;
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
|
||||
$sign = -1;
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ if ($result > 0) {
|
|||
|
||||
// Delete payment
|
||||
if ($user->socid == 0 && $action == '') {
|
||||
if ($user->rights->fournisseur->facture->supprimer) {
|
||||
if ($user->hasRight('fournisseur', 'facture', 'supprimer')) {
|
||||
if ($allow_delete) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ $arrayofmassactions = array(
|
|||
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->mymodule->supprimer) {
|
||||
if ($user->hasRight('mymodule', 'supprimer')) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete'))) {
|
||||
|
|
|
|||
|
|
@ -457,3 +457,5 @@ insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALU
|
|||
insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.5', 'Απόδειξη Λιανικής Πώλησης για Λογ/σμό Τρίτων', 0);
|
||||
|
||||
ALTER TABLE llx_partnership ADD COLUMN email_partnership varchar(64) after fk_member;
|
||||
|
||||
ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_statut (statut);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_fk_product (fk_product);
|
|||
ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_ouverture_prevue (date_ouverture_prevue);
|
||||
ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_ouverture (date_ouverture);
|
||||
ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_date_fin_validite (date_fin_validite);
|
||||
ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_statut (statut);
|
||||
|
||||
ALTER TABLE llx_contratdet ADD CONSTRAINT fk_contratdet_fk_contrat FOREIGN KEY (fk_contrat) REFERENCES llx_contrat (rowid);
|
||||
ALTER TABLE llx_contratdet ADD CONSTRAINT fk_contratdet_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ if ($action == 'create') {
|
|||
print '<br>';
|
||||
print $langs->trans($object->fields['answer']['label']).'<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%');
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, true, true, ROWS_9, '100%');
|
||||
$out = $doleditor->Create(1);
|
||||
print $out;
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ if (($id || $ref) && $action == 'edit') {
|
|||
print '<br>';
|
||||
print $langs->trans($object->fields['answer']['label']).'<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%');
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, true, true, ROWS_9, '100%');
|
||||
$out = $doleditor->Create(1);
|
||||
print $out;
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
print '<br>';
|
||||
print $langs->trans($object->fields['answer']['label']).'<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, 0, true, ROWS_9, '100%', 1);
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, true, true, ROWS_9, '100%', 1);
|
||||
$out = $doleditor->Create(1);
|
||||
print $out;
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ class ActionsMyModule
|
|||
global $user;
|
||||
|
||||
if ($parameters['features'] == 'myobject') {
|
||||
if ($user->rights->mymodule->myobject->read) {
|
||||
if ($user->hasRight('mymodule', 'myobject', 'read')) {
|
||||
$this->results['result'] = 1;
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -271,18 +271,23 @@ class modMyModule extends DolibarrModules
|
|||
/*$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read objects of MyModule'; // Permission label
|
||||
$this->rights[$r][4] = 'myobject';
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->myobject->read)
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->hasRight('mymodule', 'myobject', 'read'))
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label
|
||||
$this->rights[$r][4] = 'myobject';
|
||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->myobject->write)
|
||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->hasRight('mymodule', 'myobject', 'write'))
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
||||
$this->rights[$r][4] = 'myobject';
|
||||
|
||||
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->myobject->delete)
|
||||
$r++;*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
|
||||
// Main menu entries to add
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class PartnershipType extends CommonObject
|
|||
}
|
||||
|
||||
// Example to show how to set values of fields definition dynamically
|
||||
/*if ($user->rights->mymodule->myobject->read) {
|
||||
/*if ($user->hasRight('mymodule', 'myobject', 'read')) {
|
||||
$this->fields['myfield']['visible'] = 1;
|
||||
$this->fields['myfield']['noteditable'] = 0;
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ if (empty($reshook)) {
|
|||
$action = '';
|
||||
}
|
||||
// merge products
|
||||
if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) {
|
||||
if ($action == 'confirm_merge' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) {
|
||||
$error = 0;
|
||||
$productOriginId = GETPOST('product_origin', 'int');
|
||||
$productOrigin = new Product($db);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue