diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 485b872a94f..7e6b3356a4f 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/sociales/index.php * \ingroup tax - * \brief Ecran des charges sociales + * \brief Page to list all social contributions * \version $Id$ */ @@ -130,83 +130,96 @@ if ($resql) print $mesg."
"; } - print '
'; - print ""; - - print ""; - print_liste_field_titre($langs->trans("Ref"),"index.php","id","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),"index.php","s.libelle","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),"index.php","type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PeriodEndDate"),"index.php","periode","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"index.php","s.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),"index.php","de","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"index.php","s.paye","",$param,'align="right"',$sortfield,$sortorder); - print "\n"; - - print ''; - print ''; - print ''; - // Type - print ''; - // Period end date - print ''; - print ''; - print ''; - print ''; - print "\n"; - - while ($i < min($num,$limit)) + if (empty($mysoc->pays_id) && empty($mysoc->pays_code)) { - $obj = $db->fetch_object($resql); - - $var = !$var; - print ""; - - // Ref - print ''; - - // Label - print ''; - - // Type - print ''; - - // Date end period - print ''; - - print ''; - - // Due date - print ''; - - print ''; - - print ''; - $i++; + print '
'; + $langs->load("errors"); + $countrynotdefined=$langs->trans("ErrorSetACountryFirst"); + print $countrynotdefined; + print '
'; } + else + { - print '
  '; - $html->select_type_socialcontrib($typeid,'typeid',1,16,0); - print '   '; - print ''; - print '
'; - $chargesociale_static->id=$obj->id; - $chargesociale_static->lib=$obj->id; - $chargesociale_static->ref=$obj->id; - print $chargesociale_static->getNomUrl(1,'20'); - print ''.dol_trunc($obj->libelle,42).''.dol_trunc($obj->type_lib,16).''; - if ($obj->periode) - { - print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').''; - } - else - { - print ' '; - } - print ''.price($obj->amount).''.dol_print_date($db->jdate($obj->de), 'day').''.$chargesociale_static->LibStatut($obj->paye,5).'
'; + print ''; - print '
'; + print ""; + + print ""; + print_liste_field_titre($langs->trans("Ref"),"index.php","id","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),"index.php","s.libelle","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),"index.php","type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PeriodEndDate"),"index.php","periode","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),"index.php","s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDue"),"index.php","de","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),"index.php","s.paye","",$param,'align="right"',$sortfield,$sortorder); + print "\n"; + + print ''; + print ''; + print ''; + // Type + print ''; + // Period end date + print ''; + print ''; + print ''; + print ''; + print "\n"; + + while ($i < min($num,$limit)) + { + $obj = $db->fetch_object($resql); + + $var = !$var; + print ""; + + // Ref + print ''; + + // Label + print ''; + + // Type + print ''; + + // Date end period + print ''; + + print ''; + + // Due date + print ''; + + print ''; + + print ''; + $i++; + } + + print '
  '; + $html->select_type_socialcontrib($typeid,'typeid',1,16,0); + print '   '; + print ''; + print '
'; + $chargesociale_static->id=$obj->id; + $chargesociale_static->lib=$obj->id; + $chargesociale_static->ref=$obj->id; + print $chargesociale_static->getNomUrl(1,'20'); + print ''.dol_trunc($obj->libelle,42).''.dol_trunc($obj->type_lib,16).''; + if ($obj->periode) + { + print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').''; + } + else + { + print ' '; + } + print ''.price($obj->amount).''.dol_print_date($db->jdate($obj->de), 'day').''.$chargesociale_static->LibStatut($obj->paye,5).'
'; + + print ''; + } } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c9af72c865f..60eaae45c08 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -345,7 +345,7 @@ class Form /** * \brief Return list of social contributions. - * \remarks Use mysoc->pays_id or mysoc->pays_code + * \remarks Use mysoc->pays_id or mysoc->pays_code so they must be defined. * \param selected Preselected type * \param htmlname Name of field in form * \param useempty Set to 1 if we want an empty value @@ -356,7 +356,11 @@ class Form { global $db,$langs,$user,$mysoc; - if (empty($mysoc->pays_id) && empty($mysoc->pays_code)) dol_print_error('','ErrorBadParameter'); + if (empty($mysoc->pays_id) && empty($mysoc->pays_code)) + { + dol_print_error('','Call to select_type_socialcontrib with mysoc country not yet defined'); + exit; + } if (! empty($mysoc->pays_id)) {