diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php
index 45762ed95bb..da1b0a35bdf 100644
--- a/htdocs/compta/payment_sc/card.php
+++ b/htdocs/compta/payment_sc/card.php
@@ -44,10 +44,10 @@ if ($user->societe_id) $socid=$user->societe_id;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
-$paiement = new PaymentSocialContribution($db);
-if ($id > 0)
+$object = new PaymentSocialContribution($db);
+if ($id > 0)
{
- $result=$paiement->fetch($id);
+ $result=$object->fetch($id);
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
}
@@ -61,7 +61,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
{
$db->begin();
- $result = $paiement->delete($user);
+ $result = $object->delete($user);
if ($result > 0)
{
$db->commit();
@@ -70,7 +70,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
}
else
{
- setEventMessages($paiement->error, $paiement->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
@@ -80,8 +80,8 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
{
$db->begin();
- $result=$paiement->valide();
-
+ $result=$object->valide();
+
if ($result > 0)
{
$db->commit();
@@ -103,12 +103,12 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
}
}
- header('Location: card.php?id='.$paiement->id);
+ header('Location: card.php?id='.$object->id);
exit;
}
else
{
- setEventMessages($paiement->error, $paiement->errors, 'errors');
+ setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
@@ -137,15 +137,15 @@ $h++;
*/
-dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, 'payment');
+dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), -1, 'payment');
/*
* Deletion confirmation of payment
*/
if ($action == 'delete')
{
- print $form->formconfirm('card.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
-
+ print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
+
}
/*
@@ -154,41 +154,50 @@ if ($action == 'delete')
if ($action == 'valide')
{
$facid = $_GET['facid'];
- print $form->formconfirm('card.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
-
+ print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
+
}
+//$linkback = '' . $langs->trans("BackToList") . '';
+$linkback = '';
+
+dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
+
+
+print '
';
+print '
';
+
print '
';
// Ref
-print '| '.$langs->trans('Ref').' | ';
+/*print '
| '.$langs->trans('Ref').' | ';
print '';
-print $form->showrefnav($paiement,'id','',1,'rowid','id');
-print ' |
';
+print $form->showrefnav($object,'id','',1,'rowid','id');
+print '';*/
// Date
-print '| '.$langs->trans('Date').' | '.dol_print_date($paiement->datep,'day').' |
';
+print '| '.$langs->trans('Date').' | '.dol_print_date($object->datep,'day').' |
';
// Mode
-print '| '.$langs->trans('Mode').' | '.$langs->trans("PaymentType".$paiement->type_code).' |
';
+print '| '.$langs->trans('Mode').' | '.$langs->trans("PaymentType".$object->type_code).' |
';
// Numero
-print '| '.$langs->trans('Numero').' | '.$paiement->num_paiement.' |
';
+print '| '.$langs->trans('Numero').' | '.$object->num_paiement.' |
';
// Montant
-print '| '.$langs->trans('Amount').' | '.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' |
';
+print '| '.$langs->trans('Amount').' | '.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' |
';
// Note
-print '| '.$langs->trans('Note').' | '.nl2br($paiement->note).' |
';
+print '| '.$langs->trans('Note').' | '.nl2br($object->note).' |
';
// Bank account
if (! empty($conf->banque->enabled))
{
- if ($paiement->bank_account)
+ if ($object->bank_account)
{
$bankline=new AccountLine($db);
- $bankline->fetch($paiement->bank_line);
+ $bankline->fetch($object->bank_line);
print '';
print '| '.$langs->trans('BankTransactionLine').' | ';
@@ -201,6 +210,10 @@ if (! empty($conf->banque->enabled))
print '
';
+print '
';
+
+dol_fiche_end();
+
/*
* List of social contributions payed
@@ -211,7 +224,7 @@ $sql = 'SELECT f.rowid as scid, f.libelle, f.paye, f.amount as sc_amount, pf.amo
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementcharge as pf,'.MAIN_DB_PREFIX.'chargesociales as f, '.MAIN_DB_PREFIX.'c_chargesociales as pc';
$sql.= ' WHERE pf.fk_charge = f.rowid AND f.fk_type = pc.id';
$sql.= ' AND f.entity = '.$conf->entity;
-$sql.= ' AND pf.rowid = '.$paiement->id;
+$sql.= ' AND pf.rowid = '.$object->id;
dol_syslog("compta/payment_sc/card.php", LOG_DEBUG);
$resql=$db->query($sql);
@@ -239,7 +252,7 @@ if ($resql)
{
$objp = $db->fetch_object($resql);
-
+
print '';
// Ref
print '| ';
@@ -268,7 +281,7 @@ if ($resql)
$i++;
}
}
-
+
print "\n";
$db->free($resql);
@@ -278,7 +291,6 @@ else
dol_print_error($db);
}
-dol_fiche_end();
/*
@@ -289,7 +301,7 @@ print ' ';
/*
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
+ if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{
@@ -299,7 +311,7 @@ if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
}
*/
-if ($_GET['action'] == '')
+if ($action == '')
{
if ($user->rights->tax->charges->supprimer)
{
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index 6c7cda1f07e..0036c61fef9 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -33,6 +33,7 @@ class PaymentSocialContribution extends CommonObject
{
public $element='paiementcharge'; //!< Id that identify managed objects
public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored
+ public $picto = 'payment';
var $fk_charge;
var $datec='';
@@ -613,6 +614,68 @@ class PaymentSocialContribution extends CommonObject
}
}
+
+ /**
+ * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
+ *
+ * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @return string Libelle
+ */
+ function getLibStatut($mode=0)
+ {
+ return $this->LibStatut($this->statut,$mode);
+ }
+
+ /**
+ * Renvoi le libelle d'un statut donne
+ *
+ * @param int $status Statut
+ * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @return string Libelle du statut
+ */
+ function LibStatut($status,$mode=0)
+ {
+ global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
+
+ $langs->load('compta');
+ /*if ($mode == 0)
+ {
+ if ($status == 0) return $langs->trans('ToValidate');
+ if ($status == 1) return $langs->trans('Validated');
+ }
+ if ($mode == 1)
+ {
+ if ($status == 0) return $langs->trans('ToValidate');
+ if ($status == 1) return $langs->trans('Validated');
+ }
+ if ($mode == 2)
+ {
+ if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
+ if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
+ }
+ if ($mode == 3)
+ {
+ if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
+ if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
+ }
+ if ($mode == 4)
+ {
+ if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
+ if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
+ }
+ if ($mode == 5)
+ {
+ if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
+ if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
+ }
+ if ($mode == 6)
+ {
+ if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
+ if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
+ }*/
+ return '';
+ }
+
/**
* Return clicable name (with picto eventually)
*
|