Fix phpcs

This commit is contained in:
Laurent Destailleur 2021-03-04 19:20:16 +01:00
parent 525d643915
commit c044b43b66
6 changed files with 614 additions and 676 deletions

View File

@ -1,4 +1,6 @@
#!/bin/sh #!/bin/sh
# To install this precommit file: TODO
# To run the fix manually: cd ~/git/dolibarr; phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true fileordir
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"` PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php` STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`

View File

@ -451,7 +451,7 @@ if ($action == 'create') {
print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">'; print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">';
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (!empty($conf->projet->enabled)) { if (!empty($conf->projet->enabled)) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
@ -643,7 +643,6 @@ if ($id) {
print '<tr><td>'.$langs->trans("DateStartPeriod")."</td><td>"; print '<tr><td>'.$langs->trans("DateStartPeriod")."</td><td>";
print $form->selectDate($object->datesp, 'datesp', 0, 0, 0, 'datesp', 1); print $form->selectDate($object->datesp, 'datesp', 0, 0, 0, 'datesp', 1);
print "</td></tr>"; print "</td></tr>";
} else { } else {
print "<tr>"; print "<tr>";
print '<td>' . $langs->trans("DateStartPeriod") . '</td><td>'; print '<td>' . $langs->trans("DateStartPeriod") . '</td><td>';
@ -651,7 +650,6 @@ if ($id) {
print '</td></tr>'; print '</td></tr>';
} }
if ($action == 'edit') { if ($action == 'edit') {
print '<tr><td>'.$langs->trans("DateEndPeriod")."</td><td>"; print '<tr><td>'.$langs->trans("DateEndPeriod")."</td><td>";
print $form->selectDate($object->dateep, 'dateep', 0, 0, 0, 'dateep', 1); print $form->selectDate($object->dateep, 'dateep', 0, 0, 0, 'dateep', 1);
@ -801,8 +799,7 @@ if ($id) {
$totalpaye += $objp->amount; $totalpaye += $objp->amount;
$i++; $i++;
} }
} } else {
else {
print '<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans("None").'</span></td>'; print '<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '<td></td><td></td><td></td><td></td>'; print '<td></td><td></td><td></td><td></td>';
print '</tr>'; print '</tr>';
@ -821,8 +818,7 @@ if ($id) {
print '</div>'; print '</div>';
$db->free($resql); $db->free($resql);
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }

View File

@ -49,8 +49,8 @@ class PaymentSalary extends CommonObject
public $picto = 'payment'; public $picto = 'payment';
/** /**
* @var int ID * @var int ID
*/ */
public $fk_salary; public $fk_salary;
public $datec = ''; public $datec = '';
@ -63,12 +63,12 @@ class PaymentSalary extends CommonObject
*/ */
public $total; public $total;
public $amount; // Total amount of payment public $amount; // Total amount of payment
public $amounts = array(); // Array of amounts public $amounts = array(); // Array of amounts
/** /**
* @var int ID * @var int ID
*/ */
public $fk_typepayment; public $fk_typepayment;
/** /**
@ -83,18 +83,18 @@ class PaymentSalary extends CommonObject
public $num_payment; public $num_payment;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_bank; public $fk_bank;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_user_author; public $fk_user_author;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_user_modif; public $fk_user_modif;
/** /**
@ -109,8 +109,8 @@ class PaymentSalary extends CommonObject
/** /**
* Create payment of salary into database. * Create payment of salary into database.
* Use this->amounts to have list of lines for the payment * Use this->amounts to have list of lines for the payment
* *
* @param User $user User making payment * @param User $user User making payment
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more * @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
* @return int <0 if KO, id of payment if OK * @return int <0 if KO, id of payment if OK
@ -121,13 +121,12 @@ class PaymentSalary extends CommonObject
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);
// Validate parametres // Validate parametres
if (!$this->datepaye) if (!$this->datepaye) {
{
$this->error = 'ErrorBadValueForParameterCreatePaymentSalary'; $this->error = 'ErrorBadValueForParameterCreatePaymentSalary';
return -1; return -1;
} }
@ -143,17 +142,16 @@ class PaymentSalary extends CommonObject
if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author;
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;
$totalamount = 0; $totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch foreach ($this->amounts as $key => $value) { // How payment is dispatch
{ $newvalue = price2num($value, 'MT');
$newvalue = price2num($value, 'MT'); $this->amounts[$key] = $newvalue;
$this->amounts[$key] = $newvalue; $totalamount += $newvalue;
$totalamount += $newvalue; }
} $totalamount = price2num($totalamount);
$totalamount = price2num($totalamount);
// Check parameters // Check parameters
if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null if ($totalamount == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
$this->db->begin(); $this->db->begin();
@ -190,13 +188,11 @@ class PaymentSalary extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) { if ($remaintopay == 0) {
$result = $contrib->set_paid($user); $result = $contrib->set_paid($user);
} } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
} }
} }
} }
} } else {
else {
$error++; $error++;
} }
} }
@ -205,9 +201,9 @@ class PaymentSalary extends CommonObject
if ($result < 0) $error++; if ($result < 0) $error++;
if ($totalamount != 0 && !$error) { if ($totalamount != 0 && !$error) {
$this->amount = $totalamount; $this->amount = $totalamount;
$this->total = $totalamount; // deprecated $this->total = $totalamount; // deprecated
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->error();
@ -362,15 +358,15 @@ class PaymentSalary extends CommonObject
$this->db->begin(); $this->db->begin();
if ($this->bank_line > 0) { if ($this->bank_line > 0) {
$accline = new AccountLine($this->db); $accline = new AccountLine($this->db);
$accline->fetch($this->bank_line); $accline->fetch($this->bank_line);
$result = $accline->delete(); $result = $accline->delete();
if ($result < 0) { if ($result < 0) {
$this->errors[] = $accline->error; $this->errors[] = $accline->error;
$error++; $error++;
} }
} }
if (!$error) { if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
@ -444,11 +440,11 @@ class PaymentSalary extends CommonObject
/** /**
* Initialise an instance with random values. * Initialise an instance with random values.
* Used to build previews or test instances. * Used to build previews or test instances.
* id must be 0 if object instance is a specimen. * id must be 0 if object instance is a specimen.
* *
* @return void * @return void
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
@ -469,92 +465,92 @@ class PaymentSalary extends CommonObject
} }
/** /**
* Add record into bank for payment with links between this bank record and invoices of payment. * Add record into bank for payment with links between this bank record and invoices of payment.
* All payment properties must have been set first like after a call to create(). * All payment properties must have been set first like after a call to create().
* *
* @param User $user Object of user making payment * @param User $user Object of user making payment
* @param string $mode 'payment_sc' * @param string $mode 'payment_sc'
* @param string $label Label to use in bank record * @param string $label Label to use in bank record
* @param int $accountid Id of bank account to do link with * @param int $accountid Id of bank account to do link with
* @param string $emetteur_nom Name of transmitter * @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank * @param string $emetteur_banque Name of bank
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
{ {
global $conf; global $conf;
// Clean data // Clean data
$this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement); $this->num_payment = trim($this->num_payment ? $this->num_payment : $this->num_paiement);
$error = 0; $error = 0;
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$acc = new Account($this->db); $acc = new Account($this->db);
$acc->fetch($accountid); $acc->fetch($accountid);
$total = $this->amount; $total = $this->amount;
// Insert payment into llx_bank // Insert payment into llx_bank
$bank_line_id = $acc->addline( $bank_line_id = $acc->addline(
$this->datepaye, $this->datepaye,
$this->paiementtype, // Payment mode id or code ("CHQ or VIR for example") $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
$label, $label,
-$total, -$total,
$this->num_payment, $this->num_payment,
'', '',
$user, $user,
$emetteur_nom, $emetteur_nom,
$emetteur_banque, $emetteur_banque,
'', '',
$this->datev $this->datev
); );
// Mise a jour fk_bank dans llx_paiement. // Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire // On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0) { if ($bank_line_id > 0) {
$result = $this->update_fk_bank($bank_line_id); $result = $this->update_fk_bank($bank_line_id);
if ($result <= 0) { if ($result <= 0) {
$error++; $error++;
dol_print_error($this->db); dol_print_error($this->db);
} }
// Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
$url = ''; $url = '';
if ($mode == 'payment_salary') $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='; if ($mode == 'payment_salary') $url = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id=';
if ($url) { if ($url) {
$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
if ($result <= 0) { if ($result <= 0) {
$error++; $error++;
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment) // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
$linkaddedforthirdparty = array(); $linkaddedforthirdparty = array();
foreach ($this->amounts as $key => $value) { foreach ($this->amounts as $key => $value) {
if ($mode == 'payment_salary') { if ($mode == 'payment_salary') {
$salary = new Salary($this->db); $salary = new Salary($this->db);
$salary->fetch($key); $salary->fetch($key);
$result = $acc->add_url_line($bank_line_id, $salary->id, DOL_URL_ROOT.'/salaries/card.php?id=', '('.$salary->label.')', 'salary'); $result = $acc->add_url_line($bank_line_id, $salary->id, DOL_URL_ROOT.'/salaries/card.php?id=', '('.$salary->label.')', 'salary');
if ($result <= 0) dol_print_error($this->db); if ($result <= 0) dol_print_error($this->db);
} }
} }
} else { } else {
$this->error = $acc->error; $this->error = $acc->error;
$error++; $error++;
} }
} }
if (!$error) { if (!$error) {
return 1; return 1;
} else { } else {
return -1; return -1;
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -84,7 +84,7 @@ class SalariesStats extends Stats
$sql = "SELECT YEAR(datep) as dm, count(*)"; $sql = "SELECT YEAR(datep) as dm, count(*)";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
$sql .= " GROUP BY dm DESC"; $sql .= " GROUP BY dm DESC";
//$sql .= " WHERE ".$this->where; //$sql .= " WHERE ".$this->where;
return $this->_getNbByYear($sql); return $this->_getNbByYear($sql);
} }
@ -102,7 +102,7 @@ class SalariesStats extends Stats
$sql = "SELECT MONTH(datep) as dm, count(*)"; $sql = "SELECT MONTH(datep) as dm, count(*)";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
$sql .= " WHERE YEAR(datep) = ".$year; $sql .= " WHERE YEAR(datep) = ".$year;
//$sql .= " AND ".$this->where; //$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');

File diff suppressed because it is too large Load Diff

View File

@ -77,12 +77,10 @@ $search_account = GETPOST('search_account', 'int');
$filtre = GETPOST("filtre", 'restricthtml'); $filtre = GETPOST("filtre", 'restricthtml');
if (!GETPOST('search_type_id', 'int')) if (!GETPOST('search_type_id', 'int')) {
{
$newfiltre = str_replace('filtre=', '', $filtre); $newfiltre = str_replace('filtre=', '', $filtre);
$filterarray = explode('-', $newfiltre); $filterarray = explode('-', $newfiltre);
foreach ($filterarray as $val) foreach ($filterarray as $val) {
{
$part = explode(':', $val); $part = explode(':', $val);
if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1]; if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1];
} }
@ -100,15 +98,13 @@ $result = restrictedArea($user, 'salaries', '', '', '');
// Initialize array of search criterias // Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha'); $search_all = GETPOST("search_all", 'alpha');
$search = array(); $search = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
} }
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array(); $fieldstosearchall = array();
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
} }
@ -128,14 +124,12 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook)) {
{
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// 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_ref = ""; $search_ref = "";
$search_user = ""; $search_user = "";
$search_label = ""; $search_label = "";
@ -146,8 +140,7 @@ if (empty($reshook))
$search_type_id = ""; $search_type_id = "";
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
{
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
} }
@ -158,8 +151,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
// Validate records // Validate records
if (!$error && $massaction == 'buildsepa' && $permissiontoadd) if (!$error && $massaction == 'buildsepa' && $permissiontoadd) {
{
$objecttmp = new $objectclass($db); $objecttmp = new $objectclass($db);
// TODO // TODO
@ -213,26 +205,22 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql); $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
{
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
{
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} else { } else {
if ($limit) $sql .= $db->plimit($limit + 1, $offset); if ($limit) $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -323,8 +311,7 @@ print '<td class="liste_titre left">';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16); $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
print '</td>'; print '</td>';
// Account // Account
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1); $form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>'; print '</td>';
@ -371,10 +358,8 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine = 0; $needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
{ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
} }
} }
@ -384,8 +369,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
$i = 0; $i = 0;
$total = 0; $total = 0;
$totalarray = array(); $totalarray = array();
while ($i < ($limit ? min($num, $limit) : $num)) while ($i < ($limit ? min($num, $limit) : $num)) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen if (empty($obj)) break; // Should not happen
@ -432,18 +416,15 @@ while ($i < ($limit ? min($num, $limit) : $num))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
// Account // Account
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled)) {
{
print '<td>'; print '<td>';
if ($obj->fk_bank > 0) if ($obj->fk_bank > 0) {
{
//$accountstatic->fetch($obj->fk_bank); //$accountstatic->fetch($obj->fk_bank);
$accountstatic->id = $obj->bid; $accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref; $accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber; $accountstatic->number = $obj->bnumber;
if (!empty($conf->accounting->enabled)) if (!empty($conf->accounting->enabled)) {
{
$accountstatic->account_number = $obj->account_number; $accountstatic->account_number = $obj->account_number;
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
@ -472,8 +453,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0; $selected = 0;
if (in_array($object->id, $arrayofselected)) $selected = 1; if (in_array($object->id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
@ -491,8 +471,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found // If no record found
if ($num == 0) if ($num == 0) {
{
$colspan = 1; $colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';