diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0f38181e284..7454f61f6de 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -134,12 +134,17 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) { // Delete social contribution if ($action == 'confirm_delete' && $confirm == 'yes') { $object->fetch($id); - $result = $object->delete($user); - if ($result > 0) { - header("Location: list.php"); - exit; + $totalpaye = $object->getSommePaiement(); + if (empty($totalpaye)) { + $result = $object->delete($user); + if ($result > 0) { + header("Location: list.php"); + exit; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } } else { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($langs->trans('DisabledBecausePayments'), null, 'errors'); } } @@ -771,8 +776,10 @@ if ($id > 0) { } // Delete - if ($user->rights->tax->charges->supprimer) { + if ($user->rights->tax->charges->supprimer && empty($totalpaye)) { print '
'; + } else { + print ''; } print ""; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 94ede5d7a4d..e3dbb9b735d 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -589,7 +589,7 @@ class Salary extends CommonObject */ public function info($id) { - $sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author'; + $sql = 'SELECT ps.rowid, ps.datec, ps.tms, ps.fk_user_author, ps.fk_user_modif'; $sql .= ' FROM '.MAIN_DB_PREFIX.'salary as ps'; $sql .= ' WHERE ps.rowid = '.((int) $id); @@ -605,7 +605,14 @@ class Salary extends CommonObject $cuser->fetch($obj->fk_user_author); $this->user_creation = $cuser; } + + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); } else { diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index ae711719585..5f05c1d98b7 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -195,7 +195,6 @@ if ($resql) { print '| '.$langs->trans('Salary').' | '; - print ''.$langs->trans('Type').' | '; print ''.$langs->trans('Label').' | '; print ''.$langs->trans('ExpectedToPay').' | '; print ''.$langs->trans('Status').' | '; @@ -212,11 +211,6 @@ if ($resql) { $salary->fetch($objp->scid); print $salary->getNomUrl(1); print "\n"; - // Type - print ''; - print $salary->type_label; - /*print $salary->type;*/ - print " | \n"; // Label print ''.$objp->label.' | '; // Expected to pay