--- /tmp/dsg/dolibarr/htdocs/compta/sociales/github_card.php
+++ /tmp/dsg/dolibarr/htdocs/compta/sociales/client_card.php
@@ -27,11 +27,11 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->projet->enabled))
+{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@@ -124,10 +124,13 @@
{
$object->fetch($id);
$result = $object->delete($user);
- if ($result > 0) {
+ if ($result > 0)
+ {
header("Location: list.php");
exit;
- } else {
+ }
+ else
+ {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -136,39 +139,47 @@
// Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer)
{
- $amount = price2num(GETPOST('amount'), 'MT');
+ $amount = price2num(GETPOST('amount'));
if (!$dateech)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$action = 'create';
- } elseif (!$dateperiod)
+ }
+ elseif (!$dateperiod)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
$action = 'create';
- } elseif (!$actioncode > 0)
+ }
+ elseif (!$actioncode > 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
$action = 'create';
- } elseif (empty($amount))
+ }
+ elseif (empty($amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
- } elseif (!is_numeric($amount)) {
+ }
+ elseif (!is_numeric($amount))
+ {
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
- } else {
+ }
+ else
+ {
$object->type = $actioncode;
$object->label = GETPOST('label', 'alpha');
$object->date_ech = $dateech;
- $object->periode = $dateperiod;
- $object->amount = $amount;
- $object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int');
- $object->fk_account = (int) GETPOST('fk_account', 'int');
- $object->fk_project = (int) GETPOST('fk_project', 'int');
+ $object->periode = $dateperiod;
+ $object->amount = $amount;
+ $object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->fk_account = GETPOST('fk_account', 'int');
+ $object->fk_project = GETPOST('fk_project');
$id = $object->create($user);
- if ($id <= 0) {
+ if ($id <= 0)
+ {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
@@ -178,33 +189,39 @@
if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer)
{
- $amount = price2num(GETPOST('amount'), 'MT');
+ $amount = price2num(GETPOST('amount'));
if (!$dateech)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$action = 'edit';
- } elseif (!$dateperiod)
+ }
+ elseif (!$dateperiod)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
$action = 'edit';
- } elseif (empty($amount))
+ }
+ elseif (empty($amount))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'edit';
- } elseif (!is_numeric($amount))
+ }
+ elseif (!is_numeric($amount))
{
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
- } else {
+ }
+ else
+ {
$result = $object->fetch($id);
$object->date_ech = $dateech;
- $object->periode = $dateperiod;
- $object->amount = $amount;
+ $object->periode = $dateperiod;
+ $object->amount = price2num($amount);
$result = $object->update($user);
- if ($result <= 0) {
+ if ($result <= 0)
+ {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -228,14 +245,16 @@
if (GETPOST('clone_label', 'alphanohtml')) {
$object->label = GETPOST('clone_label', 'alphanohtml');
- } else {
+ }
+ else {
$object->label = $langs->trans("CopyOf").' '.$object->label;
}
if (GETPOST('clone_for_next_month', 'int')) {
$object->periode = dol_time_plus_duree($object->periode, 1, 'm');
$object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
- } else {
+ }
+ else {
$newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int'));
$newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int'));
if ($newdateperiod) $object->periode = $newdateperiod;
@@ -252,14 +271,18 @@
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
- } else {
+ }
+ else
+ {
$id = $originalId;
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
}
- } else {
+ }
+ else
+ {
$db->rollback();
dol_print_error($db, $object->error);
}
@@ -292,7 +315,7 @@
print ' ';
print ' ';
- print dol_get_fiche_head();
+ dol_fiche_head();
print '
';
@@ -301,7 +324,7 @@
print '';
print $langs->trans("Label");
print ' ';
- print ' ';
+ print ' ';
print '';
print '';
@@ -320,7 +343,7 @@
print $langs->trans("Date");
print '';
print '';
- print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1, 1);
+ print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1);
print ' ';
print " \n";
@@ -366,18 +389,18 @@
if (!empty($conf->banque->enabled))
{
print ''.$langs->trans('BankAccount').' ';
- $form->select_comptes($fk_account, 'fk_account', 0, '', 2);
+ $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print ' ';
}
print '
';
- print dol_get_fiche_end();
+ dol_fiche_end();
print '';
print ' ';
print ' ';
- print ' ';
+ print ' ';
print '
';
print '';
@@ -408,7 +431,9 @@
if (!empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX))
{
$formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
- } else {
+ }
+ else
+ {
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
}
@@ -436,7 +461,7 @@
print ' ';
}
- print dol_get_fiche_head($head, 'card', $langs->trans("SocialContribution"), -1, 'bill');
+ dol_fiche_head($head, 'card', $langs->trans("SocialContribution"), -1, 'bill');
$morehtmlref = '';
// Ref customer
@@ -477,8 +502,6 @@
}
$morehtmlref .= '
';
- $morehtmlright = '';
-
$linkback = ''.$langs->trans("BackToList").' ';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
@@ -512,7 +535,9 @@
if ($action == 'edit')
{
print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1);
- } else {
+ }
+ else
+ {
print dol_print_date($object->periode, "day");
}
print "";
@@ -521,10 +546,11 @@
if ($action == 'edit')
{
print ''.$langs->trans("AmountTTC")." ";
- print ' ';
+ print ' ';
print " ";
- } else {
- print ''.$langs->trans("AmountTTC").' '.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).' ';
+ }
+ else {
+ print ''.$langs->trans("AmountTTC").' '.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).' ';
}
// Mode of payment
@@ -581,8 +607,8 @@
$sql .= " c.code as type_code,c.libelle as paiement_type,";
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
- $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
- $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " WHERE p.fk_charge = ".$id;
@@ -605,13 +631,11 @@
print ''.$langs->trans("RefPayment").' ';
print ''.$langs->trans("Date").' ';
print ''.$langs->trans("Type").' ';
- if (!empty($conf->banque->enabled)) {
- print ''.$langs->trans('BankAccount').' ';
- }
+ if (!empty($conf->banque->enabled)) {
+ print ''.$langs->trans('BankAccount').' ';
+ }
print ''.$langs->trans("Amount").' ';
print '';
-
- $paymentsocialcontributiontmp = new PaymentSocialContribution($db);
if ($num > 0)
{
@@ -619,14 +643,8 @@
{
$objp = $db->fetch_object($resql);
- $paymentsocialcontributiontmp->id = $objp->rowid;
- $paymentsocialcontributiontmp->ref = $objp->rowid;
- $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
-
print '';
- print $paymentsocialcontributiontmp->getNomUrl(1);
- print ' ';
-
+ print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.' ';
print ''.dol_print_date($db->jdate($objp->dp), 'day')." \n";
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
print "".$labeltype.' '.$objp->num_payment." \n";
@@ -656,7 +674,9 @@
$totalpaye += $objp->amount;
$i++;
}
- } else {
+ }
+ else
+ {
print ''.$langs->trans("None").' ';
print ' ';
print ' ';
@@ -675,7 +695,9 @@
print '';
$db->free($resql);
- } else {
+ }
+ else
+ {
dol_print_error($db);
}
@@ -685,14 +707,14 @@
print '
';
- print dol_get_fiche_end();
+ dol_fiche_end();
if ($action == 'edit')
{
print '';
- print ' ';
+ print ' ';
print ' ';
- print ' ';
+ print ' ';
print '
';
}
@@ -710,13 +732,13 @@
// Reopen
if ($object->paye && $user->rights->tax->charges->creer)
{
- print '';
+ print "";
}
// Edit
if ($object->paye == 0 && $user->rights->tax->charges->creer)
{
- print '';
+ print "";
}
// Emit payment
@@ -728,24 +750,26 @@
// Classify 'paid'
if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer)
{
- print '';
+ print "";
}
// Clone
if ($user->rights->tax->charges->creer)
{
- print '";
+ print "";
}
// Delete
if ($user->rights->tax->charges->supprimer)
{
- print '';
+ print "";
}
print "";
}
- } else {
+ }
+ else
+ {
/* Social contribution not found */
dol_print_error('', $object->error);
}
--- /tmp/dsg/dolibarr/htdocs/compta/sociales/github_document.php
+++ /tmp/dsg/dolibarr/htdocs/compta/sociales/client_document.php
@@ -35,8 +35,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (!empty($conf->projet->enabled))
{
- include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
// Load translation files required by the page
@@ -57,7 +57,7 @@
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
- $page = 0;
+ $page = 0;
}
$offset = $limit * $page;
$pageprev = $page - 1;
@@ -81,10 +81,10 @@
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
- $object->fetch($id);
- $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
- if ($result < 0)
- setEventMessages($object->error, $object->errors, 'errors');
+ $object->fetch($id);
+ $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ if ($result < 0)
+ setEventMessages($object->error, $object->errors, 'errors');
}
@@ -103,28 +103,28 @@
{
$alreadypayed = $object->getSommePaiement();
- $head = tax_prepare_head($object);
+ $head = tax_prepare_head($object);
- print dol_get_fiche_head($head, 'documents', $langs->trans("SocialContribution"), -1, 'bill');
+ dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), -1, 'bill');
$morehtmlref = '';
// Label of social contribution
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
- // Project
+ // Project
if (!empty($conf->projet->enabled))
{
- $langs->load("projects");
- $morehtmlref .= '
'.$langs->trans('Project').' : ';
- if (!empty($object->fk_project)) {
- $proj = new Project($db);
- $proj->fetch($object->fk_project);
- $morehtmlref .= '
';
- $morehtmlref .= $proj->ref;
- $morehtmlref .= ' ';
- } else {
- $morehtmlref .= '';
- }
+ $langs->load("projects");
+ $morehtmlref .= '
'.$langs->trans('Project').' : ';
+ if (!empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref .= '
';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= ' ';
+ } else {
+ $morehtmlref .= '';
+ }
}
$morehtmlref .= '
';
@@ -137,34 +137,36 @@
print '';
print '
';
- // Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
- $totalsize = 0;
- foreach ($filearray as $key => $file)
- {
- $totalsize += $file['size'];
- }
+ // Build file list
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
+ {
+ $totalsize += $file['size'];
+ }
- print '
';
+ print '';
- print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
- print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.dol_print_size($totalsize, 1, 1).' ';
- print '
';
+ print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
+ print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.dol_print_size($totalsize, 1, 1).' ';
+ print '
';
- print '
';
+ print '';
- print '
';
+ print '
';
- print dol_get_fiche_end();
+ dol_fiche_end();
- $modulepart = 'tax';
- $permission = $user->rights->tax->charges->creer;
- $permtoedit = $user->rights->fournisseur->facture->creer;
- $param = '&id='.$object->id;
- include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
-} else {
- print $langs->trans("ErrorUnknown");
+ $modulepart = 'tax';
+ $permission = $user->rights->tax->charges->creer;
+ $permtoedit = $user->rights->fournisseur->facture->creer;
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+}
+else
+{
+ print $langs->trans("ErrorUnknown");
}
// End of page
--- /tmp/dsg/dolibarr/htdocs/compta/sociales/github_info.php
+++ /tmp/dsg/dolibarr/htdocs/compta/sociales/client_info.php
@@ -75,7 +75,7 @@
$head = tax_prepare_head($object);
-print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill');
+dol_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill');
$morehtmlref = '';
// Label of social contribution
--- /tmp/dsg/dolibarr/htdocs/compta/sociales/github_list.php
+++ /tmp/dsg/dolibarr/htdocs/compta/sociales/client_list.php
@@ -4,8 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin
* Copyright (C) 2016 Frédéric France
* Copyright (C) 2020 Pierre Ardoin
- * Copyright (C) 2020 Tobias Sekan
-
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@@ -21,18 +20,12 @@
*/
/**
- * \file htdocs/compta/sociales/list.php
- * \ingroup tax
- * \brief Page to list all social contributions
+ * \file htdocs/compta/sociales/list.php
+ * \ingroup tax
+ * \brief Page to list all social contributions
*/
require '../../main.inc.php';
-
-// Security check
-$socid = isset($_GET["socid"]) ? $_GET["socid"] : '';
-if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'tax', '', '', 'charges');
-
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@@ -42,32 +35,36 @@
// Load translation files required by the page
$langs->loadLangs(array('compta', 'banks', 'bills'));
-$action = GETPOST('action', 'aZ09');
-$massaction = GETPOST('massaction', 'alpha');
-$confirm = GETPOST('confirm', 'alpha');
-$optioncss = GETPOST('optioncss', 'alpha');
-$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
-
-$search_ref = GETPOST('search_ref', 'int');
+$action = GETPOST('action', 'alpha');
+$massaction = GETPOST('massaction', 'alpha');
+$show_files = GETPOST('show_files', 'int');
+$confirm = GETPOST('confirm', 'alpha');
+$toselect = GETPOST('toselect', 'array');
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'sclist';
+
+// Security check
+$socid = isset($_GET["socid"]) ? $_GET["socid"] : '';
+if ($user->socid) $socid = $user->socid;
+$result = restrictedArea($user, 'tax', '', '', 'charges');
+
+$search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha');
-$search_amount = GETPOST('search_amount', 'alpha');
-$search_status = GETPOST('search_status', 'int');
+$search_amount = GETPOST('search_amount', 'alpha');
+$search_status = GETPOST('search_status', 'int');
$search_day_lim = GETPOST('search_day_lim', 'int');
$search_month_lim = GETPOST('search_month_lim', 'int');
$search_year_lim = GETPOST('search_year_lim', 'int');
$search_project_ref = GETPOST('search_project_ref', 'alpha');
-$search_project = GETPOST('search_project', 'alpha');
-
-$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$search_project = GETPOST('search_project', 'alpha');
+
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-
-if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-
if (!$sortfield) $sortfield = "cs.date_ech";
if (!$sortorder) $sortorder = "DESC";
@@ -83,54 +80,29 @@
$part = explode(':', $val);
if ($part[0] == 'cs.fk_type') $search_typeid = $part[1];
}
-} else {
+}
+else
+{
$search_typeid = GETPOST('search_typeid', 'int');
}
-$arrayfields = array(
- 'cs.rowid' =>array('label'=>"Ref", 'checked'=>1, 'position'=>10),
- 'cs.libelle' =>array('label'=>"Label", 'checked'=>1, 'position'=>20),
- 'cs.fk_type' =>array('label'=>"Type", 'checked'=>1, 'position'=>30),
- 'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>40, 'enable'=>(!empty($conf->projet->enabled))),
- 'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>50),
- 'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>60),
- 'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70),
- 'cs.paye' =>array('label'=>"Status", 'checked'=>1, 'position'=>80),
-);
-$arrayfields = dol_sort_array($arrayfields, 'position');
-
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('sclist'));
-$object = new ChargeSociales($db);
-
-/*
- * Actions
- */
-
-$parameters = array('socid'=>$socid);
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-
-
-if (empty($reshook)) {
- include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
-
- // All tests are required to be compatible with all browsers
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
- $search_ref = '';
- $search_label = '';
- $search_amount = '';
- $search_status = '';
- $search_typeid = '';
- $year = '';
- $search_day_lim = '';
- $search_year_lim = '';
- $search_month_lim = '';
- $search_project_ref = '';
- $search_project = '';
- $search_array_options = array();
- }
-}
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
+{
+ $search_ref = "";
+ $search_label = "";
+ $search_amount = "";
+ $search_status = '';
+ $search_typeid = "";
+ $year = "";
+ $search_day_lim = '';
+ $search_year_lim = '';
+ $search_month_lim = '';
+ $search_project_ref = '';
+ $search_project = '';
+ $toselect = '';
+ $search_array_options = array();
+}
+
/*
* View
@@ -144,8 +116,8 @@
llxHeader('', $langs->trans("SocialContributions"));
-$sql = "SELECT cs.rowid, cs.fk_type as type, ";
-$sql .= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
+$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
+$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed";
@@ -165,19 +137,19 @@
//$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year);
if ($year > 0)
{
- $sql .= " AND (";
- // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
- // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
- $sql .= " (cs.periode IS NOT NULL AND date_format(cs.periode, '%Y') = '".$db->escape($year)."') ";
- $sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')";
- $sql .= ")";
+ $sql .= " AND (";
+ // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
+ // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
+ $sql .= " (cs.periode IS NOT NULL AND date_format(cs.periode, '%Y') = '".$year."') ";
+ $sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$year."')";
+ $sql .= ")";
}
if ($filtre) {
- $filtre = str_replace(":", "=", $filtre);
- $sql .= " AND ".$filtre;
+ $filtre = str_replace(":", "=", $filtre);
+ $sql .= " AND ".$filtre;
}
if ($search_typeid) {
- $sql .= " AND cs.fk_type=".$db->escape($search_typeid);
+ $sql .= " AND cs.fk_type=".$db->escape($search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title";
@@ -187,274 +159,198 @@
$result = $db->query($sql);
if ($result)
{
- $totalnboflines = $db->num_rows($result);
+ $totalnboflines = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
-if (!$resql)
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+ $i = 0;
+
+ $param = '';
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+ if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
+ if ($search_label) $param .= '&search_label='.urlencode($search_label);
+ if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
+ if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
+ if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
+ if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
+ if ($year) $param .= '&year='.urlencode($year);
+
+ $newcardbutton = '';
+ if ($user->rights->tax->charges->creer)
+ {
+ $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
+ }
+
+ print '';
+}
+else
{
dol_print_error($db);
- llxFooter();
- $db->close();
- exit;
-}
-
-$num = $db->num_rows($resql);
-$i = 0;
-
-$param = '';
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
-if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
-if ($search_label) $param .= '&search_label='.urlencode($search_label);
-if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
-if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
-if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid);
-if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status);
-if ($year) $param .= '&year='.urlencode($year);
-
-$newcardbutton = '';
-if ($user->rights->tax->charges->creer)
-{
- $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
-}
-
-print '';
- llxFooter();
- $db->close();
-}
-
-$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
-$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
-if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
-
-print '';
-print '
'."\n";
-
-print '';
-
-// Filters: Line number (placeholder)
-if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
- print '';
- print ' ';
-}
-
-// Filter: Ref
-if (!empty($arrayfields['cs.rowid']['checked'])) {
- print '';
- print ' ';
- print ' ';
-}
-
-// Filter: Label
-if (!empty($arrayfields['cs.rowid']['checked'])) {
- print '';
- print ' ';
- print ' ';
-}
-
-// Filter: Type
-if (!empty($arrayfields['cs.fk_type']['checked'])) {
- print '';
- $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone', 1);
- print ' ';
-}
-
-// Filter: Project ref
-if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- print ' ';
- print ' ';
-}
-
-// Filter: Date (placeholder)
-if (!empty($arrayfields['cs.date_ech']['checked'])) {
- print '';
- print ' ';
-}
-
-// Filter: Period end date
-if (!empty($arrayfields['cs.periode']['checked'])) {
- print '';
- if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ' ';
- print ' ';
- $formother->select_year($search_year_lim ? $search_year_lim : -1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
- print ' ';
-}
-
-// Filter: Amount
-if (!empty($arrayfields['cs.amount']['checked'])) {
- print '';
- print ' ';
- print ' ';
-}
-
-// Filter: Status
-if (!empty($arrayfields['cs.paye']['checked'])) {
- print '';
- $liststatus = array('0'=>$langs->trans("Unpaid"), '1'=>$langs->trans("Paid"));
- print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
- print ' ';
-}
-
-// Fields from hook
-$parameters = array('arrayfields'=>$arrayfields);
-$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
-print $hookmanager->resPrint;
-
-// Filter: Buttons
-print '';
-print $form->showFilterAndCheckAddButtons(0);
-print ' ';
-
-print ' ';
-
-print '';
-if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.rowid']['checked'])) print_liste_field_titre($arrayfields['cs.rowid']['label'], $_SERVER["PHP_SELF"], "cs.rowid", '', $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.libelle']['checked'])) print_liste_field_titre($arrayfields['cs.libelle']['label'], $_SERVER["PHP_SELF"], "cs.libelle", '', $param, 'class="left"', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.fk_type']['checked'])) print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type", '', $param, 'class="left"', $sortfield, $sortorder);
-if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.date_ech']['checked'])) print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech", '', $param, 'align="center"', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.periode']['checked'])) print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, 'align="center"', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.amount']['checked'])) print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount", '', $param, 'class="right"', $sortfield, $sortorder);
-if (!empty($arrayfields['cs.paye']['checked'])) print_liste_field_titre($arrayfields['cs.paye']['label'], $_SERVER["PHP_SELF"], "cs.paye", '', $param, 'class="right"', $sortfield, $sortorder);
-
-// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
-$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
-print $hookmanager->resPrint;
-
-print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
-print ' ';
-
-$i = 0;
-$totalarray = array();
-while ($i < min($num, $limit))
-{
- $obj = $db->fetch_object($resql);
-
- $chargesociale_static->id = $obj->rowid;
- $chargesociale_static->ref = $obj->rowid;
- $chargesociale_static->label = $obj->libelle;
- $chargesociale_static->type_label = $obj->type_label;
- if (!empty($conf->projet->enabled)) {
- $projectstatic->id = $obj->project_id;
- $projectstatic->ref = $obj->project_ref;
- $projectstatic->title = $obj->project_label;
- }
-
- print '';
-
- // Line number
- if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
- print ''.(($offset * $limit) + $i).' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Ref
- if (!empty($arrayfields['cs.rowid']['checked'])) {
- print ''.$chargesociale_static->getNomUrl(1, '20').' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Label
- if (!empty($arrayfields['cs.libelle']['checked'])) {
- print ''.dol_trunc($obj->libelle, 42).' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Type
- if (!empty($arrayfields['cs.fk_type']['checked'])) {
- print ''.$obj->type_label.' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Project ref
- if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- if ($obj->project_id > 0) {
- print $projectstatic->getNomUrl(1);
- }
- print ' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Date
- if (!empty($arrayfields['cs.date_ech']['checked'])) {
- print ''.dol_print_date($db->jdate($obj->date_ech), 'day').' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Date end period
- if (!empty($arrayfields['cs.periode']['checked'])) {
- print '';
- if ($obj->periode) {
- print 'jdate($obj->periode)).'">';
- print dol_print_date($db->jdate($obj->periode), 'day');
- print ' ';
- }
- print ' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Amount
- if (!empty($arrayfields['cs.amount']['checked'])) {
- print ''.price($obj->amount).' ';
- if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield';
- $totalarray['val']['totalttcfield'] += $obj->amount;
- }
-
- // Status
- if (!empty($arrayfields['cs.paye']['checked'])) {
- print ''.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).' ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Buttons
- print ' ';
- if (!$i) $totalarray['nbfield']++;
-
- print ' ';
- $i++;
-}
-
-// Show total line
-include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
-
-print '
';
-print '
';
-print '';
+}
// End of page
llxFooter();
--- /tmp/dsg/dolibarr/htdocs/compta/sociales/github_payments.php
+++ /tmp/dsg/dolibarr/htdocs/compta/sociales/client_payments.php
@@ -1,11 +1,10 @@
- * Copyright (C) 2004-2016 Laurent Destailleur
+ * Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2005-2010 Regis Houssin
* Copyright (C) 2011-2016 Alexandre Spangaro
- * Copyright (C) 2011-2014 Juanjo Menent
+ * Copyright (C) 2011-2014 Juanjo Menent
* Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2019 Nicolas ZABOURI
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +21,7 @@
*/
/**
- * \file htdocs/compta/charges/index.php
+ * \file htdocs/compta/sociales/payments.php
* \ingroup compta
* \brief Page to list payments of special expenses
*/
@@ -33,14 +32,6 @@
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
-
-
-$hookmanager = new HookManager($db);
-
-// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
-$hookmanager->initHooks(array('specialexpensesindex'));
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));
@@ -49,8 +40,10 @@
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
+$mode = GETPOST("mode", 'alpha');
$year = GETPOST("year", 'int');
-$search_sc_type = GETPOST('search_sc_type', 'int');
+$filtre = GETPOST("filtre", 'alpha');
+if (!$year && $mode != 'sconly') { $year = date("Y", time()); }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@@ -60,26 +53,8 @@
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortfield) $sortfield = "cs.date_ech";
+if (!$sortfield) $sortfield = "pc.datep";
if (!$sortorder) $sortorder = "DESC";
-
-if (empty($conf->tax->enabled) || empty($user->rights->tax->charges->lire))
-{
- accessforbidden();
-}
-
-
-/*
- * Actions
- */
-
-// Purge search criteria
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
-{
- $search_sc_type = '';
- //$toselect = '';
- //$search_array_options = array();
-}
/*
@@ -90,22 +65,19 @@
$socialcontrib = new ChargeSociales($db);
$payment_sc_static = new PaymentSocialContribution($db);
$sal_static = new PaymentSalary($db);
-$accountstatic = new Account($db);
-$formsocialcontrib = new FormSocialContrib($db);
-
-$title = $langs->trans("SocialContributionsPayments");
-
-llxHeader('', $title);
-
+
+llxHeader('', $langs->trans("SpecialExpensesArea"));
+
+$title = $langs->trans("SpecialExpensesArea");
+if ($mode == 'sconly') $title = $langs->trans("SocialContributionsPayments");
$param = '';
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
-if ($sortfield) $param .= '&sortfield='.urlencode($sortfield);
-if ($sortorder) $param .= '&sortorder='.urlencode($sortorder);
-if ($year) $param .= '&year='.urlencode($year);
-if ($search_sc_type) $param .= '&search_sc_type='.urlencode($search_sc_type);
-$num = 0;
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
+if ($mode == 'sconly') $param = '&mode=sconly';
+if ($sortfield) $param .= '&sortfield='.$sortfield;
+if ($sortorder) $param .= '&sortorder='.$sortorder;
+
print '';
-
-$parameters = array('user' => $user);
-$reshook = $hookmanager->executeHooks('dashboardSpecialBills', $parameters, $object); // Note that $action and $object may have been modified by hook
// End of page
llxFooter();