Fix phpcs
This commit is contained in:
parent
d56890de17
commit
59f205596e
@ -158,8 +158,7 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if ($totalamount != 0)
|
if ($totalamount != 0) {
|
||||||
{
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,";
|
||||||
$sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)";
|
$sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)";
|
||||||
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
|
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
|
||||||
@ -169,21 +168,17 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql .= " 0)";
|
$sql .= " 0)";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
||||||
|
|
||||||
// Insere tableau des montants / factures
|
// Insere tableau des montants / factures
|
||||||
foreach ($this->amounts as $key => $amount)
|
foreach ($this->amounts as $key => $amount) {
|
||||||
{
|
|
||||||
$contribid = $key;
|
$contribid = $key;
|
||||||
if (is_numeric($amount) && $amount <> 0)
|
if (is_numeric($amount) && $amount <> 0) {
|
||||||
{
|
|
||||||
$amount = price2num($amount);
|
$amount = price2num($amount);
|
||||||
|
|
||||||
// If we want to closed payed invoices
|
// If we want to closed payed invoices
|
||||||
if ($closepaidcontrib)
|
if ($closepaidcontrib) {
|
||||||
{
|
|
||||||
$contrib = new Salary($this->db);
|
$contrib = new Salary($this->db);
|
||||||
$contrib->fetch($contribid);
|
$contrib->fetch($contribid);
|
||||||
$paiement = $contrib->getSommePaiement();
|
$paiement = $contrib->getSommePaiement();
|
||||||
@ -193,8 +188,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$deposits = 0;
|
$deposits = 0;
|
||||||
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
|
$alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
|
||||||
$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.");
|
||||||
@ -210,14 +204,12 @@ class PaymentSalary extends CommonObject
|
|||||||
$result = $this->call_trigger('PAYMENTSALARY_CREATE', $user);
|
$result = $this->call_trigger('PAYMENTSALARY_CREATE', $user);
|
||||||
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();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@ -255,10 +247,8 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
if ($this->db->num_rows($resql)) {
|
||||||
if ($this->db->num_rows($resql))
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
@ -286,8 +276,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -318,14 +307,11 @@ 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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||||
|
|
||||||
$sql .= " fk_salary=".(isset($this->fk_salary) ? $this->fk_salary : "null").",";
|
$sql .= " fk_salary=".(isset($this->fk_salary) ? $this->fk_salary : "null").",";
|
||||||
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||||
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||||
@ -337,8 +323,6 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
|
$sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").",";
|
||||||
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").",";
|
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").",";
|
||||||
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
|
$sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null")."";
|
||||||
|
|
||||||
|
|
||||||
$sql .= " WHERE rowid=".$this->id;
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -348,17 +332,14 @@ class PaymentSalary extends CommonObject
|
|||||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ($this->errors as $errmsg) {
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -381,8 +362,7 @@ 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();
|
||||||
@ -392,8 +372,7 @@ class PaymentSalary extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||||
$sql .= " WHERE rowid=".$this->id;
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
@ -403,17 +382,14 @@ class PaymentSalary extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ($this->errors as $errmsg) {
|
||||||
foreach ($this->errors as $errmsg)
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1 * $error;
|
return -1 * $error;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -449,8 +425,7 @@ class PaymentSalary extends CommonObject
|
|||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
|
|
||||||
// Other options
|
// Other options
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -458,12 +433,10 @@ class PaymentSalary extends CommonObject
|
|||||||
unset($object->context['createfromclone']);
|
unset($object->context['createfromclone']);
|
||||||
|
|
||||||
// End
|
// End
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $object->id;
|
return $object->id;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -517,8 +490,7 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$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);
|
||||||
@ -543,11 +515,9 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
@ -555,11 +525,9 @@ class PaymentSalary extends CommonObject
|
|||||||
// 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);
|
||||||
}
|
}
|
||||||
@ -567,28 +535,23 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,11 +571,9 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->error = $this->db->error();
|
$this->error = $this->db->error();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -702,15 +663,16 @@ class PaymentSalary extends CommonObject
|
|||||||
if (!empty($this->label)) {
|
if (!empty($this->label)) {
|
||||||
$labeltoshow = $this->label;
|
$labeltoshow = $this->label;
|
||||||
$reg = array();
|
$reg = array();
|
||||||
if (preg_match('/^\((.*)\)$/i', $this->label, $reg))
|
if (preg_match('/^\((.*)\)$/i', $this->label, $reg)) {
|
||||||
{
|
|
||||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||||
if ($reg[1] == 'paiement') $reg[1] = 'Payment';
|
if ($reg[1] == 'paiement') $reg[1] = 'Payment';
|
||||||
$labeltoshow = $langs->trans($reg[1]);
|
$labeltoshow = $langs->trans($reg[1]);
|
||||||
}
|
}
|
||||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
|
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
|
||||||
}
|
}
|
||||||
if ($this->datep) $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
|
if ($this->datep) {
|
||||||
|
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($this->id)) {
|
if (!empty($this->id)) {
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$link = '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
|||||||
@ -45,8 +45,7 @@ if ($user->socid) $socid = $user->socid;
|
|||||||
//$result = restrictedArea($user, 'facture', $id,'');
|
//$result = restrictedArea($user, 'facture', $id,'');
|
||||||
|
|
||||||
$object = new PaymentSalary($db);
|
$object = new PaymentSalary($db);
|
||||||
if ($id > 0)
|
if ($id > 0) {
|
||||||
{
|
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if (!$result) dol_print_error($db, 'Failed to get payment id '.$id);
|
if (!$result) dol_print_error($db, 'Failed to get payment id '.$id);
|
||||||
}
|
}
|
||||||
@ -57,23 +56,21 @@ if ($id > 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Delete payment
|
// Delete payment
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries->delete)
|
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->salaries->delete) {
|
||||||
{
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$result = $object->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0) {
|
||||||
{
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
header("Location: ".DOL_URL_ROOT."/salaries/payments.php");
|
header("Location: ".DOL_URL_ROOT."/salaries/payments.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -86,6 +83,8 @@ $form = new Form($db);
|
|||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
|
|
||||||
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$id;
|
$head[$h][0] = DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$id;
|
||||||
$head[$h][1] = $langs->trans("SalaryPayment");
|
$head[$h][1] = $langs->trans("SalaryPayment");
|
||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
@ -102,8 +101,7 @@ dol_fiche_head($head, $hselected, $langs->trans("SalaryPayment"), -1, 'payment')
|
|||||||
/*
|
/*
|
||||||
* Deletion confirmation of payment
|
* Deletion confirmation of payment
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete') {
|
||||||
{
|
|
||||||
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeleteSalary"), $langs->trans("ConfirmDeleteSalaryPayment"), 'confirm_delete', '', 0, 2);
|
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeleteSalary"), $langs->trans("ConfirmDeleteSalaryPayment"), 'confirm_delete', '', 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,10 +150,8 @@ print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->
|
|||||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($object->note).'</td></tr>';
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
if (!empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled)) {
|
||||||
{
|
if ($object->bank_account) {
|
||||||
if ($object->bank_account)
|
|
||||||
{
|
|
||||||
$bankline = new AccountLine($db);
|
$bankline = new AccountLine($db);
|
||||||
$bankline->fetch($object->bank_line);
|
$bankline->fetch($object->bank_line);
|
||||||
|
|
||||||
@ -188,13 +184,15 @@ $sql .= ' AND ps.rowid = '.$object->id;
|
|||||||
|
|
||||||
dol_syslog("payment_salary/card.php", LOG_DEBUG);
|
dol_syslog("payment_salary/card.php", LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$total = 0;
|
$total = 0;
|
||||||
print '<br><table class="noborder centpercent">';
|
print '<br>';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Salary').'</td>';
|
print '<td>'.$langs->trans('Salary').'</td>';
|
||||||
print '<td>'.$langs->trans('Type').'</td>';
|
print '<td>'.$langs->trans('Type').'</td>';
|
||||||
@ -204,10 +202,8 @@ if ($resql)
|
|||||||
print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0) {
|
||||||
{
|
while ($i < $num) {
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -230,8 +226,8 @@ if ($resql)
|
|||||||
// Amount payed
|
// Amount payed
|
||||||
print '<td class="right">'.price($objp->amount).'</td>';
|
print '<td class="right">'.price($objp->amount).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
|
if ($objp->paye == 1) {
|
||||||
{
|
// If at least one invoice is paid, disable delete
|
||||||
$disable_delete = 1;
|
$disable_delete = 1;
|
||||||
}
|
}
|
||||||
$total = $total + $objp->amount;
|
$total = $total + $objp->amount;
|
||||||
@ -239,43 +235,27 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons Actions
|
* Button actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
/*
|
if ($action == '') {
|
||||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
if ($user->rights->salaries->delete) {
|
||||||
{
|
if (!$disable_delete) {
|
||||||
if ($user->socid == 0 && $object->statut == 0 && $_GET['action'] == '')
|
|
||||||
{
|
|
||||||
if ($user->rights->facture->paiement)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="card.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == '')
|
|
||||||
{
|
|
||||||
if ($user->rights->salaries->delete)
|
|
||||||
{
|
|
||||||
if (!$disable_delete)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentSalaryPaid")).'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentSalaryPaid")).'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user