Fix MAIN_USE_EXPENSE_RULE is now stable
This commit is contained in:
parent
e8e63e85f1
commit
ae6cae0313
@ -140,12 +140,10 @@ function expensereport_admin_prepare_head()
|
|||||||
$head[$h][2] = 'expensereport';
|
$head[$h][2] = 'expensereport';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE)) {
|
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
|
$head[$h][1] = $langs->trans("ExpenseReportsRules");
|
||||||
$head[$h][1] = $langs->trans("ExpenseReportsRules");
|
$head[$h][2] = 'expenserules';
|
||||||
$head[$h][2] = 'expenserules';
|
$h++;
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
|
||||||
|
|||||||
@ -2050,6 +2050,11 @@ if ($action == 'create') {
|
|||||||
// Picture
|
// Picture
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Information if theres a rule restriction
|
||||||
|
print '<td>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Ajout des boutons de modification/suppression
|
// Ajout des boutons de modification/suppression
|
||||||
if (($object->status < 2 || $object->status == 99) && $user->rights->expensereport->creer) {
|
if (($object->status < 2 || $object->status == 99) && $user->rights->expensereport->creer) {
|
||||||
print '<td class="right"></td>';
|
print '<td class="right"></td>';
|
||||||
@ -2190,6 +2195,10 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="nowrap right">';
|
||||||
|
print !empty($line->rule_warning_message) ? img_info(html_entity_decode($line->rule_warning_message)) : ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Ajout des boutons de modification/suppression
|
// Ajout des boutons de modification/suppression
|
||||||
if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) {
|
if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) {
|
||||||
print '<td class="nowrap right">';
|
print '<td class="nowrap right">';
|
||||||
@ -2209,7 +2218,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) {
|
if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) {
|
||||||
// Add line with link to add new file or attach line to an existing file
|
// Add line with link to add new file or attach line to an existing file
|
||||||
$colspan = 10;
|
$colspan = 11;
|
||||||
if (!empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
@ -2336,6 +2345,9 @@ if ($action == 'create') {
|
|||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
//print $line->fk_ecm_files;
|
//print $line->fk_ecm_files;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Information if theres a rule restriction
|
||||||
|
print '<td class="center">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
|
||||||
@ -2351,7 +2363,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) {
|
if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) {
|
||||||
$colspan = 11;
|
$colspan = 12;
|
||||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
@ -2448,6 +2460,7 @@ if ($action == 'create') {
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven nohover">';
|
print '<tr class="oddeven nohover">';
|
||||||
|
|||||||
@ -998,7 +998,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
|
$sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
|
||||||
$sql .= ' de.fk_ecm_files,';
|
$sql .= ' de.fk_ecm_files,';
|
||||||
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
|
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||||
$sql .= ' de.total_localtax1, de.total_localtax2,';
|
$sql .= ' de.total_localtax1, de.total_localtax2, de.rule_warning_message,';
|
||||||
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||||
$sql .= ' p.ref as ref_projet, p.title as title_projet';
|
$sql .= ' p.ref as ref_projet, p.title as title_projet';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
|
||||||
@ -1055,6 +1055,8 @@ class ExpenseReport extends CommonObject
|
|||||||
$deplig->projet_ref = $objp->ref_projet;
|
$deplig->projet_ref = $objp->ref_projet;
|
||||||
$deplig->projet_title = $objp->title_projet;
|
$deplig->projet_title = $objp->title_projet;
|
||||||
|
|
||||||
|
$deplig->rule_warning_message = $objp->rule_warning_message;
|
||||||
|
|
||||||
$deplig->rang = $objp->rang;
|
$deplig->rang = $objp->rang;
|
||||||
|
|
||||||
$this->lines[$i] = $deplig;
|
$this->lines[$i] = $deplig;
|
||||||
@ -1874,10 +1876,6 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
$langs->load('trips');
|
$langs->load('trips');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_USE_EXPENSE_RULE)) {
|
|
||||||
return true; // if don't use rules
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't know seller and buyer for expense reports
|
// We don't know seller and buyer for expense reports
|
||||||
if (!is_object($seller)) {
|
if (!is_object($seller)) {
|
||||||
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
|
||||||
@ -1975,7 +1973,7 @@ class ExpenseReport extends CommonObject
|
|||||||
}
|
}
|
||||||
//$buyer = new Societe($this->db);
|
//$buyer = new Societe($this->db);
|
||||||
|
|
||||||
$expenseik = new ExpenseReportIk($db);
|
$expenseik = new ExpenseReportIk($this->db);
|
||||||
$range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
|
$range = $expenseik->getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
|
||||||
|
|
||||||
if (empty($range)) {
|
if (empty($range)) {
|
||||||
@ -2603,6 +2601,8 @@ class ExpenseReportLine
|
|||||||
*/
|
*/
|
||||||
public $fk_ecm_files;
|
public $fk_ecm_files;
|
||||||
|
|
||||||
|
public $rule_warning_message;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -2624,7 +2624,7 @@ class ExpenseReportLine
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
|
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
|
||||||
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
|
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
|
||||||
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,';
|
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2, fde.rule_warning_message,';
|
||||||
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||||
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||||
@ -2670,6 +2670,8 @@ class ExpenseReportLine
|
|||||||
|
|
||||||
$this->fk_ecm_files = $objp->fk_ecm_files;
|
$this->fk_ecm_files = $objp->fk_ecm_files;
|
||||||
|
|
||||||
|
$this->rule_warning_message = $objp->rule_warning_message;
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
|
|||||||
@ -165,7 +165,7 @@ class ExpenseReportIk extends CoreObject
|
|||||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
|
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'c_exp_tax_cat c ON (r.fk_c_exp_tax_cat = c.rowid)';
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat);
|
$sql .= ' WHERE r.fk_c_exp_tax_cat = '.((int) $fk_c_exp_tax_cat);
|
||||||
$sql .= " AND entity IN(0, ".getEntity($this->element).")";
|
$sql .= " AND r.entity IN(0, ".getEntity($this->element).")";
|
||||||
if ($active) {
|
if ($active) {
|
||||||
$sql .= ' AND r.active = 1 AND c.active = 1';
|
$sql .= ' AND r.active = 1 AND c.active = 1';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user