';
// Ref
- print "| ".$langs->trans("Ref").' | ';
- print $form->showrefnav($cha,'id');
+ print ' |
| '.$langs->trans("Ref").' | ';
+ print $form->showrefnav($object,'id');
print " |
";
// Label
if ($action == 'edit')
{
print '| '.$langs->trans("Label").' | ';
- print '';
+ print '';
print ' |
';
}
else
{
- print '| '.$langs->trans("Label").' | '.$cha->lib.' |
';
+ print '| '.$langs->trans("Label").' | '.$object->lib.' |
';
}
// Type
- print "| ".$langs->trans("Type")." | ".$cha->type_libelle." | ".$langs->trans("Payments")." |
";
+ print "| ".$langs->trans("Type")." | ".$object->type_libelle." | ".$langs->trans("Payments")." |
";
// Period end date
print "| ".$langs->trans("PeriodEndDate")." | ";
print "";
if ($action == 'edit')
{
- print $form->select_date($cha->periode, 'period', 0, 0, 0, 'charge', 1);
+ print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1);
}
else
{
- print dol_print_date($cha->periode,"day");
+ print dol_print_date($object->periode,"day");
}
print " | ";
@@ -321,7 +321,7 @@ if ($chid > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
- $sql.= " WHERE p.fk_charge = ".$chid;
+ $sql.= " WHERE p.fk_charge = ".$id;
$sql.= " AND p.fk_charge = cs.rowid";
$sql.= " AND cs.entity = ".$conf->entity;
$sql.= " AND p.fk_typepaiement = c.id";
@@ -353,12 +353,12 @@ if ($chid > 0)
$i++;
}
- if ($cha->paye == 0)
+ if ($object->paye == 0)
{
print "
| ".$langs->trans("AlreadyPaid")." : | ".price($totalpaye)." | ".$langs->trans("Currency".$conf->currency)." |
\n";
- print "| ".$langs->trans("AmountExpected")." : | ".price($cha->amount)." | ".$langs->trans("Currency".$conf->currency)." |
\n";
+ print "| ".$langs->trans("AmountExpected")." : | ".price($object->amount)." | ".$langs->trans("Currency".$conf->currency)." |
\n";
- $resteapayer = $cha->amount - $totalpaye;
+ $resteapayer = $object->amount - $totalpaye;
print "| ".$langs->trans("RemainderToPay")." : | ";
print "".price($resteapayer)." | ".$langs->trans("Currency".$conf->currency)." |
\n";
@@ -378,18 +378,18 @@ if ($chid > 0)
if ($action == 'edit')
{
print '| '.$langs->trans("DateDue")." | ";
- print $form->select_date($cha->date_ech, 'ech', 0, 0, 0, 'charge', 1);
+ print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
print " |
";
}
else {
- print "| ".$langs->trans("DateDue")." | ".dol_print_date($cha->date_ech,'day')." |
";
+ print "| ".$langs->trans("DateDue")." | ".dol_print_date($object->date_ech,'day')." |
";
}
// Amount
- print '| '.$langs->trans("AmountTTC").' | '.price($cha->amount).' |
';
+ print '| '.$langs->trans("AmountTTC").' | '.price($object->amount).' |
';
// Status
- print '| '.$langs->trans("Status").' | '.$cha->getLibStatut(4).' |
';
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' |
';
print '| |
';
@@ -419,25 +419,25 @@ if ($chid > 0)
// Edit
if ($user->rights->tax->charges->creer)
{
- print "id&action=edit\">".$langs->trans("Modify")."";
+ print "id&action=edit\">".$langs->trans("Modify")."";
}
// Emettre paiement
- if ($cha->paye == 0 && ((price2num($cha->amount) < 0 && round($resteapayer) < 0) || (price2num($cha->amount) > 0 && round($resteapayer) > 0)) && $user->rights->tax->charges->creer)
+ if ($object->paye == 0 && ((price2num($object->amount) < 0 && round($resteapayer) < 0) || (price2num($object->amount) > 0 && round($resteapayer) > 0)) && $user->rights->tax->charges->creer)
{
- print "id&action=create\">".$langs->trans("DoPayment")."";
+ print "id&action=create\">".$langs->trans("DoPayment")."";
}
// Classify 'paid'
- if ($cha->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer)
+ if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer)
{
- print "id&action=paid\">".$langs->trans("ClassifyPaid")."";
+ print "id&action=paid\">".$langs->trans("ClassifyPaid")."";
}
// Delete
if ($user->rights->tax->charges->supprimer)
{
- print "id&action=delete\">".$langs->trans("Delete")."";
+ print "id&action=delete\">".$langs->trans("Delete")."";
}
print "";
@@ -446,11 +446,12 @@ if ($chid > 0)
else
{
/* Charge non trouv� */
- dol_print_error('',$cha->error);
+ dol_print_error('',$object->error);
}
}
-$db->close();
llxFooter();
+
+$db->close();
?>
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index 4cb092ea93e..4e2a6b0be0a 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -50,7 +50,9 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
-if ($page == -1) { $page = 0; }
+if ($page == -1) {
+ $page = 0;
+}
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -71,15 +73,15 @@ $modulepart='tax';
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
- if (create_exdir($upload_dir) >= 0)
- {
- $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
- if (is_numeric($resupload) && $resupload > 0)
- {
- if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
- {
+ if (create_exdir($upload_dir) >= 0)
+ {
+ $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
+ if (is_numeric($resupload) && $resupload > 0)
+ {
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
@@ -87,26 +89,26 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Create mini thumbs for company (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
- }
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
- }
- else
- {
- $langs->load("errors");
- if ($resupload < 0) // Unknown error
- {
- $mesg = ''.$langs->trans("ErrorFileNotUploaded").'
';
- }
- else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
- {
- $mesg = ''.$langs->trans("ErrorFileIsInfectedWithAVirus").'
';
- }
- else // Known error
- {
- $mesg = ''.$langs->trans($resupload).'
';
- }
- }
- }
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ }
+ else
+ {
+ $langs->load("errors");
+ if ($resupload < 0) // Unknown error
+ {
+ $mesg = ''.$langs->trans("ErrorFileNotUploaded").'
';
+ }
+ else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
+ {
+ $mesg = ''.$langs->trans("ErrorFileIsInfectedWithAVirus").'
';
+ }
+ else // Known error
+ {
+ $mesg = ''.$langs->trans($resupload).'
';
+ }
+ }
+ }
}
@@ -121,36 +123,84 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
if ($object->id)
{
- if ( $error_msg )
- {
- echo ''.$error_msg.'
';
- }
+ if ( $error_msg )
+ {
+ echo ''.$error_msg.'
';
+ }
- if ($action == 'delete')
- {
- $file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
- $result=dol_delete_file($file);
- //if ($result >= 0) $mesg=$langs->trans("FileWasRemoced");
- }
+ if ($action == 'delete')
+ {
+ $file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $result=dol_delete_file($file);
+ //if ($result >= 0) $mesg=$langs->trans("FileWasRemoced");
+ }
- $head=tax_prepare_head($object, $user);
+ $head=tax_prepare_head($object, $user);
- dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
+ dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
- // Construit liste des fichiers
- $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
- $totalsize=0;
- foreach($filearray as $key => $file)
- {
- $totalsize+=$file['size'];
- }
+ // Construit liste des fichiers
+ $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+ $totalsize=0;
+ foreach($filearray as $key => $file)
+ {
+ $totalsize+=$file['size'];
+ }
print '';
- // Ref
- print '| '.$langs->trans("Ref").' | '.$object->ref.' |
';
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print $form->showrefnav($object,'id');
+ print " |
";
+
+ // Label
+ if ($action == 'edit')
+ {
+ print '| '.$langs->trans("Label").' | ';
+ print '';
+ print ' |
';
+ }
+ else
+ {
+ print '| '.$langs->trans("Label").' | '.$object->lib.' |
';
+ }
+
+ // Type
+ print "| ".$langs->trans("Type")." | ".$object->type_libelle." |
";
+
+ // Period end date
+ print "| ".$langs->trans("PeriodEndDate")." | ";
+ print "";
+ if ($action == 'edit')
+ {
+ print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1);
+ }
+ else
+ {
+ print dol_print_date($object->periode,"day");
+ }
+ print " | ";
+ print "
";
+
+ // Due date
+ if ($action == 'edit')
+ {
+ print '| '.$langs->trans("DateDue")." | ";
+ print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1);
+ print " |
";
+ }
+ else {
+ print "| ".$langs->trans("DateDue")." | ".dol_print_date($object->date_ech,'day')." |
";
+ }
+
+ // Amount
+ print '| '.$langs->trans("AmountTTC").' | '.price($object->amount).' |
';
+
+ // Status
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' |
';
print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' |
';
@@ -161,17 +211,17 @@ if ($object->id)
// Affiche formulaire upload
$formfile=new FormFile($db);
- $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id,'',0,0,$user->rights->tax->charges->creer);
+ $formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id,'',0,0,$user->rights->tax->charges->creer);
- // List of document
- //$param='&id='.$object->id;
- $formfile->list_of_documents($filearray,$object,'tax',$param);
+ // List of document
+ //$param='&id='.$object->id;
+ $formfile->list_of_documents($filearray,$object,'tax',$param);
}
else
{
- print $langs->trans("UnkownError");
+ print $langs->trans("UnkownError");
}