diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index e674b07026d..1734c08e5f1 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -29,7 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/tax.lib.php"); $langs->load("compta"); $langs->load("bills"); -$chid=GETPOST("id"); +$id=GETPOST("id"); $action=GETPOST("action"); // Security check @@ -53,7 +53,7 @@ $result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes') { $chargesociales = new ChargeSociales($db); - $chargesociales->fetch($chid); + $chargesociales->fetch($id); $result = $chargesociales->set_paid($user); } @@ -63,7 +63,7 @@ if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes') if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes') { $chargesociales=new ChargeSociales($db); - $chargesociales->fetch($chid); + $chargesociales->fetch($id); $result=$chargesociales->delete($user); if ($result > 0) { @@ -115,8 +115,8 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $chargesociales->periode=$dateperiod; $chargesociales->amount=$_POST["amount"]; - $chid=$chargesociales->create($user); - if ($chid > 0) + $id=$chargesociales->create($user); + if ($id > 0) { //$mesg='
'.$langs->trans("SocialContributionAdded").'
'; } @@ -243,16 +243,16 @@ if ($action == 'create') /* Mode fiche */ /* */ /* *************************************************************************** */ -if ($chid > 0) +if ($id > 0) { - $cha = new ChargeSociales($db); - $result=$cha->fetch($chid); + $object = new ChargeSociales($db); + $result=$object->fetch($id); if ($result > 0) { dol_htmloutput_mesg($mesg); - $head=tax_prepare_head($cha); + $head=tax_prepare_head($object); print dol_get_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); @@ -260,53 +260,53 @@ if ($chid > 0) if ($action == 'paid') { $text=$langs->trans('ConfirmPaySocialContribution'); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cha->id,$langs->trans('PaySocialContribution'),$text,"confirm_paid",'','',2); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans('PaySocialContribution'),$text,"confirm_paid",'','',2); } if ($action == 'delete') { $text=$langs->trans('ConfirmDeleteSocialContribution'); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete','','',2); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete','','',2); } if ($action == 'edit') { - print "
id&action=update\" method=\"post\">"; + print "id&action=update\" method=\"post\">"; print ''; } print ''; // Ref - print ""; // Label if ($action == 'edit') { print ''; } else { - print ''; + print ''; } // Type - print ""; + print ""; // Period end date print ""; 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 "\n"; - print "\n"; + print "\n"; - $resteapayer = $cha->amount - $totalpaye; + $resteapayer = $object->amount - $totalpaye; print ""; print "\n"; @@ -378,18 +378,18 @@ if ($chid > 0) if ($action == 'edit') { print '"; } else { - print ""; + print ""; } // Amount - print ''; + print ''; // Status - print ''; + print ''; 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 '
".$langs->trans("Ref").''; - print $form->showrefnav($cha,'id'); + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($object,'id'); print "
'.$langs->trans("Label").''; - print ''; + print ''; print '
'.$langs->trans("Label").''.$cha->lib.'
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$cha->type_libelle."".$langs->trans("Payments")."
".$langs->trans("Type")."".$object->type_libelle."".$langs->trans("Payments")."
".$langs->trans("PeriodEndDate").""; 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 "
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($cha->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
'.$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 "
".$langs->trans("DateDue")."".dol_print_date($cha->date_ech,'day')."
".$langs->trans("DateDue")."".dol_print_date($object->date_ech,'day')."
'.$langs->trans("AmountTTC").''.price($cha->amount).'
'.$langs->trans("AmountTTC").''.price($object->amount).'
'.$langs->trans("Status").''.$cha->getLibStatut(4).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
 
'; - // Ref - print ''; + // Ref + print '"; + + // Label + if ($action == 'edit') + { + print ''; + } + else + { + print ''; + } + + // Type + print ""; + + // Period end date + print ""; + print ""; + print ""; + + // Due date + if ($action == 'edit') + { + print '"; + } + else { + print ""; + } + + // Amount + print ''; + + // Status + print ''; print ''; print ''; @@ -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"); }
'.$langs->trans("Ref").''.$object->ref.'
'.$langs->trans("Ref").''; + print $form->showrefnav($object,'id'); + print "
'.$langs->trans("Label").''; + print ''; + print '
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."
".$langs->trans("PeriodEndDate").""; + if ($action == 'edit') + { + print $form->select_date($object->periode, 'period', 0, 0, 0, 'charge', 1); + } + else + { + print dol_print_date($object->periode,"day"); + } + print "
'.$langs->trans("DateDue").""; + print $form->select_date($object->date_ech, 'ech', 0, 0, 0, 'charge', 1); + print "
".$langs->trans("DateDue")."".dol_print_date($object->date_ech,'day')."
'.$langs->trans("AmountTTC").''.price($object->amount).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'