Merge remote-tracking branch 'upstream/develop' into Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword

This commit is contained in:
Frédéric FRANCE 2020-05-23 21:45:18 +02:00
commit 67b8ab13c9
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 178 additions and 91 deletions

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -342,21 +343,25 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$clickpicto = $form->showCheckAddButtons(); $clickpicto = $form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
$facture_static = new Facture($db); $facturestatic = new Facture($db);
$product_static = new Product($db); $productstatic = new Product($db);
$accountingaccountstatic = new AccountingAccount($db);
while ($objp = $db->fetch_object($result)) { while ($objp = $db->fetch_object($result))
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label_compte.'</span>'; {
$accountingaccountstatic->account_number = $objp->account_number;
$accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$facture_static->ref = $objp->ref; $facturestatic->ref = $objp->ref;
$facture_static->id = $objp->facid; $facturestatic->id = $objp->facid;
$facture_static->type = $objp->ftype; $facturestatic->type = $objp->ftype;
$thirdpartystatic->id = $objp->socid; $thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name; $thirdpartystatic->name = $objp->name;
@ -369,10 +374,10 @@ if ($result) {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$product_static->ref = $objp->product_ref; $productstatic->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $productstatic->id = $objp->product_id;
$product_static->label = $objp->product_label; $productstatic->label = $objp->product_label;
$product_static->type = $objp->line_type; $productstatic->type = $objp->line_type;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -380,15 +385,15 @@ if ($result) {
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
// Ref Invoice // Ref Invoice
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>'; print '<td class="nowraponall">'.$facturestatic->getNomUrl(1).'</td>';
// Date invoice // Date invoice
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
// Ref Product // Ref Product
print '<td>'; print '<td>';
if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($productstatic->id > 0) print $productstatic->getNomUrl(1);
if ($product_static->id > 0 && $objp->product_label) print '<br>'; if ($productstatic->id > 0 && $objp->product_label) print '<br>';
if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>'; if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>';
print '</td>'; print '</td>';
@ -415,8 +420,9 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
print '<td>'; print '<td class="center">';
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '</td>'; print '</td>';

View File

@ -28,19 +28,22 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch")); $langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$account_parent = GETPOST('account_parent', 'int'); $account_parent = GETPOST('account_parent', 'int');
$changeaccount = GETPOST('changeaccount'); $changeaccount = GETPOST('changeaccount');
// Search Getpost // Search Getpost
$search_login = GETPOST('search_login', 'alpha');
$search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha');
@ -84,6 +87,7 @@ $formaccounting = new FormAccounting($db);
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{ {
$search_login = '';
$search_expensereport = ''; $search_expensereport = '';
$search_label = ''; $search_label = '';
$search_desc = ''; $search_desc = '';
@ -162,14 +166,21 @@ print '<script type="text/javascript">
*/ */
$sql = "SELECT er.ref, er.rowid as erid,"; $sql = "SELECT er.ref, er.rowid as erid,";
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
$sql .= " aa.label, aa.account_number,"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label"; $sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
$sql .= " , ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql .= " , ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
$sql .= " AND aa.rowid = erd.fk_code_ventilation"; $sql .= " WHERE erd.fk_code_ventilation > 0";
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
// Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) { if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport); $sql .= natural_search("er.ref", $search_expensereport);
} }
@ -218,6 +229,7 @@ if ($result) {
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport); if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
if ($search_label) $param .= "&search_label=".urlencode($search_label); if ($search_label) $param .= "&search_label=".urlencode($search_label);
if ($search_desc) $param .= "&search_desc=".urlencode($search_desc); if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
@ -250,6 +262,7 @@ if ($result) {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -265,7 +278,6 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>'; print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre right"></td>';
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -273,6 +285,7 @@ if ($result) {
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -283,27 +296,48 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre('');
$checkpicto = $form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$expensereport_static = new ExpenseReport($db); $expensereportstatic = new ExpenseReport($db);
$accountingaccountstatic = new AccountingAccount($db);
$userstatic = new User($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$codeCompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
$expensereport_static->ref = $objp->ref; $accountingaccountstatic->account_number = $objp->account_number;
$expensereport_static->id = $objp->erid; $accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$expensereportstatic->ref = $objp->ref;
$expensereportstatic->id = $objp->erid;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
// Ref Invoice // Ref Expense report
print '<td>'.$expensereport_static->getNomUrl(1).'</td>'; print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
// Date validation // Date validation
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -312,21 +346,26 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
// Fees label
print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>'; print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
// Fees description -- Can be null
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>'; print '</td>';
// Amount without taxes
print '<td class="nowrap right">'.price($objp->total_ht).'</td>'; print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
// Vat rate
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
print '<td>'.$codeCompta.'</td>'; // Accounting account affected
print '<td class="center">';
print '<td class="left"><a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';

View File

@ -28,6 +28,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch")); $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch", "hrm"));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
@ -50,6 +51,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
$mesCasesCochees = GETPOST('toselect', 'array'); $mesCasesCochees = GETPOST('toselect', 'array');
// Search Getpost // Search Getpost
$search_login = GETPOST('search_login', 'alpha');
$search_lineid = GETPOST('search_lineid', 'alpha'); $search_lineid = GETPOST('search_lineid', 'alpha');
$search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -100,6 +102,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{ {
$search_login = '';
$search_expensereport = ''; $search_expensereport = '';
$search_label = ''; $search_label = '';
$search_desc = ''; $search_desc = '';
@ -187,13 +190,18 @@ if (empty($chartaccountcode))
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,"; $sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,";
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
$sql .= " aa.rowid as aarowid"; $sql .= " aa.rowid as aarowid";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
$sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; $sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
// Add search filter like // Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) { if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport); $sql .= natural_search("er.ref", $search_expensereport);
} }
@ -243,6 +251,7 @@ if ($result) {
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_month) $param .= '&search_month='.urlencode($search_month);
@ -287,6 +296,7 @@ if ($result) {
// We add search filter // We add search filter
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -310,6 +320,7 @@ if ($result) {
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -329,6 +340,7 @@ if ($result) {
$expensereport_static = new ExpenseReport($db); $expensereport_static = new ExpenseReport($db);
$userstatic = new User($db);
$form = new Form($db); $form = new Form($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit)) {
@ -340,8 +352,24 @@ if ($result) {
$expensereport_static->ref = $objp->ref; $expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid; $expensereport_static->id = $objp->erid;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id // Line id
print '<td>'.$objp->rowid.'</td>'; print '<td>'.$objp->rowid.'</td>';
@ -368,6 +396,7 @@ if ($result) {
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>'; print '</td>';
// Amount without taxes
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print price($objp->price); print price($objp->price);
print '</td>'; print '</td>';

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -346,19 +347,23 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$thirdpartystatic = new Societe($db); $thirdpartystatic = new Societe($db);
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
$product_static = new ProductFournisseur($db); $productstatic = new ProductFournisseur($db);
$accountingaccountstatic = new AccountingAccount($db);
while ($i < min($num_lines, $limit)) { while ($i < min($num_lines, $limit))
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>'; $accountingaccountstatic->account_number = $objp->account_number;
$accountingaccountstatic->label = $objp->label_account;
$accountingaccountstatic->labelshort = $objp->labelshort_account;
$facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid; $facturefournisseur_static->id = $objp->facid;
@ -374,10 +379,10 @@ if ($result) {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$product_static->ref = $objp->product_ref; $productstatic->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $productstatic->id = $objp->product_id;
$product_static->label = $objp->product_label; $productstatic->label = $objp->product_label;
$product_static->type = $objp->line_type; $productstatic->type = $objp->line_type;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -425,8 +430,9 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
print '<td>'; print '<td class="center">';
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>'; print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';

View File

@ -97,7 +97,7 @@ if (empty($reshook))
{ {
$object->ref = GETPOST("ref"); $object->ref = GETPOST("ref");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = GETPOST("fk_parent");
$object->libelle = GETPOST("libelle"); $object->label = GETPOST("libelle");
$object->description = GETPOST("desc"); $object->description = GETPOST("desc");
$object->statut = GETPOST("statut"); $object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu"); $object->lieu = GETPOST("lieu");
@ -108,8 +108,7 @@ if (empty($reshook))
$object->phone = GETPOST("phone"); $object->phone = GETPOST("phone");
$object->fax = GETPOST("fax"); $object->fax = GETPOST("fax");
if (!empty($object->libelle)) if (!empty($object->label)) {
{
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) { if ($ret < 0) {
@ -163,7 +162,7 @@ if (empty($reshook))
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
$object->libelle = GETPOST("libelle"); $object->label = GETPOST("libelle");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = GETPOST("fk_parent");
$object->description = GETPOST("desc"); $object->description = GETPOST("desc");
$object->statut = GETPOST("statut"); $object->statut = GETPOST("statut");

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2008 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com> * Copyright (C) 2016 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -48,7 +48,11 @@ class Entrepot extends CommonObject
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'stock'; public $picto = 'stock';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/** /**
* @var string Label * @var string Label
@ -182,11 +186,10 @@ class Entrepot extends CommonObject
$error = 0; $error = 0;
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility $this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->label = trim($this->label); // Error if label not defined
if ($this->label == '') if ($this->label == '') {
{
$this->error = "ErrorFieldRequired"; $this->error = "ErrorFieldRequired";
return 0; return 0;
} }
@ -279,7 +282,8 @@ class Entrepot extends CommonObject
} }
} }
$this->label = trim($this->label); $this->label = trim(!empty($this->label) ? $this->label : $this->libelle);
$this->description = trim($this->description); $this->description = trim($this->description);
$this->lieu = trim($this->lieu); $this->lieu = trim($this->lieu);

View File

@ -41,7 +41,14 @@ class MouvementStock extends CommonObject
public $table_element = 'stock_mouvement'; public $table_element = 'stock_mouvement';
/**
* @var int ID product
*/
public $product_id; public $product_id;
/**
* @var int ID warehouse
*/
public $warehouse_id; public $warehouse_id;
public $qty; public $qty;
@ -58,7 +65,7 @@ class MouvementStock extends CommonObject
public $price; public $price;
/** /**
* @var int ID * @var int ID user author
*/ */
public $fk_user_author; public $fk_user_author;
@ -896,13 +903,13 @@ class MouvementStock extends CommonObject
} }
else else
{ {
dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock".$error, LOG_ERR); dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock", LOG_ERR);
$result = -1; $result = -1;
} }
} }
else else
{ {
dol_syslog(get_class($this)."::createBatch error invalid param dluo".$error, LOG_ERR); dol_syslog(get_class($this)."::createBatch error invalid param dluo", LOG_ERR);
$result = -1; $result = -1;
} }

View File

@ -954,7 +954,6 @@ if ($resql)
$productlot->sellby = $objp->sellby; $productlot->sellby = $objp->sellby;
$warehousestatic->id = $objp->entrepot_id; $warehousestatic->id = $objp->entrepot_id;
$warehousestatic->libelle = $objp->warehouse_ref; // deprecated
$warehousestatic->label = $objp->warehouse_ref; $warehousestatic->label = $objp->warehouse_ref;
$warehousestatic->lieu = $objp->lieu; $warehousestatic->lieu = $objp->lieu;

View File

@ -991,7 +991,6 @@ if ($resql)
$warehousestatic->id = $objp->entrepot_id; $warehousestatic->id = $objp->entrepot_id;
$warehousestatic->ref = $objp->warehouse_ref; $warehousestatic->ref = $objp->warehouse_ref;
$warehousestatic->libelle = $objp->warehouse_ref; // deprecated
$warehousestatic->label = $objp->warehouse_ref; $warehousestatic->label = $objp->warehouse_ref;
$warehousestatic->lieu = $objp->lieu; $warehousestatic->lieu = $objp->lieu;
$warehousestatic->fk_parent = $objp->fk_parent; $warehousestatic->fk_parent = $objp->fk_parent;

View File

@ -835,7 +835,6 @@ if (!$variants) {
$entrepotstatic->id = $obj->rowid; $entrepotstatic->id = $obj->rowid;
$entrepotstatic->ref = $obj->ref; $entrepotstatic->ref = $obj->ref;
$entrepotstatic->libelle = $obj->ref;
$entrepotstatic->label = $obj->ref; $entrepotstatic->label = $obj->ref;
$entrepotstatic->lieu = $obj->lieu; $entrepotstatic->lieu = $obj->lieu;
$entrepotstatic->fk_parent = $obj->fk_parent; $entrepotstatic->fk_parent = $obj->fk_parent;