From c23fab267c2bbe2a738e53cf22208875abb59eee Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 05:30:17 +0200 Subject: [PATCH 01/17] This commit adds a way to filter projects by checking if selected year is in creation/ending range. The year input is shown after the list, outside the table. It's hidden by default and must be enabled with PROJECT_LIMIT_YEAR_RANGE --- htdocs/core/lib/project.lib.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e44b0dd413c..cad5880beab 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -642,6 +642,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $sortfield=''; $sortorder=''; + $project_year_filter=0; $title=$langs->trans("Project"); if ($statut == 0) $title=$langs->trans("ProjectDraft"); @@ -681,6 +682,16 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { $sql.= " AND p.fk_statut = ".$statut; } + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + $project_year_filter = GETPOST("project_year_filter"); + //Check if empty or invalid year. Wildcard ignores the sql check + if ($project_year_filter != "*") { + if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // + $project_year_filter = date("Y"); + } + $sql.= " AND (YEAR(p.datec) <= ".$project_year_filter." AND YEAR(p.datee) >= ".$project_year_filter.")"; + } + } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; $sql.= " ORDER BY p.title, p.ref"; @@ -724,6 +735,19 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { dol_print_error($db); } + print ""; + + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + //Add the year filter input + print ''; + print ''; + print ''; + print ''; + print '\n"; + print '
'.$langs->trans("Year").'
'; + print ''; + print "
'; + } } From 71a1857b49b9c8d675207c90aeb008e2274381fe Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 16:46:19 +0200 Subject: [PATCH 02/17] Ignore dateo/datee if is a null column --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index cad5880beab..f62d06c6af6 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -689,7 +689,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // $project_year_filter = date("Y"); } - $sql.= " AND (YEAR(p.datec) <= ".$project_year_filter." AND YEAR(p.datee) >= ".$project_year_filter.")"; + $sql.= " AND (p.datee IS NULL OR YEAR(p.dateo) <= ".$project_year_filter.") AND (p.datee IS NULL OR YEAR(p.datee) >= ".$project_year_filter.")"; } } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; From 68994823dd7738735f848ca9b607f9174b68f8bd Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 18:00:55 +0200 Subject: [PATCH 03/17] Closed projects are greyed out in project selector --- htdocs/core/class/html.formprojet.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4042bb16e31..eafe9d9f166 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -115,12 +115,17 @@ class FormProjets { $disabled=0; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); - if (! $obj->fk_statut > 0) + if ($obj->fk_statut == 0) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + else if ($obj->fk_statut == 2) + { + $disabled=1; + $labeltoshow.=' - '.$langs->trans("Closed"); + } + else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From d4bcea07990b8981c076e11f269b7274dcb4aea7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 15 Sep 2014 20:30:03 +0200 Subject: [PATCH 04/17] Correct bank journal --- htdocs/accountancy/journal/bankjournal.php | 51 +++++++++++++--------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f2d5a586b37..82c3a09e20a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -132,7 +132,7 @@ if ($result) { $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); - $cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); + $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); $tabpay = array (); $tabbq = array (); @@ -173,21 +173,26 @@ if ($result) { $tabtype[$obj->rowid] = $links[$key]['type']; - if ($links[$key]['type'] == 'payment') { + if ($links[$key]['type'] == 'payment') + { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'payment_supplier') { + } + else if ($links[$key]['type'] == 'payment_supplier') + { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'company') { - + } + else if ($links[$key]['type'] == 'company') + { $societestatic->id = $links[$key]['url_id']; $societestatic->nom = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { - + } + else if ($links[$key]['type'] == 'sc') + { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; @@ -196,7 +201,9 @@ if ($result) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; $chargestatic->lib = $langs->trans($reg[1]); - } else { + } + else + { $chargestatic->lib = $links[$key]['label']; } $chargestatic->ref = $chargestatic->lib; @@ -211,29 +218,33 @@ if ($result) { dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); - if ($resultmid) { + if ($resultmid) + { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; } - } else if ($links[$key]['type'] == 'payment_vat') { - + } + else if ($links[$key]['type'] == 'payment_vat') + { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_salary') { - + } + else if ($links[$key]['type'] == 'payment_salary') + { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cptsociale] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; } /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; @@ -477,14 +488,14 @@ if ($action == 'export_csv') { llxHeader('', $langs->trans("BankJournal")); - $nom = $langs->trans("BankJournal"); - $nomlink = ''; + $namereport = $langs->trans("BankJournal"); + $namelink = ''; $periodlink = ''; $exportlink = ''; $builddate = time(); $description = $langs->trans("DescBankJournal") . '
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); print ''; From c3b255bce999935b84b922cd62ef98aeaf697d21 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Tue, 16 Sep 2014 15:27:04 +0200 Subject: [PATCH 05/17] Changed sql to be portable --- htdocs/core/lib/project.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f62d06c6af6..7a8f2302c12 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -689,7 +689,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // $project_year_filter = date("Y"); } - $sql.= " AND (p.datee IS NULL OR YEAR(p.dateo) <= ".$project_year_filter.") AND (p.datee IS NULL OR YEAR(p.datee) >= ".$project_year_filter.")"; + $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; + $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; } } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; From 28e20f18260da84eb8cbda5dcccb4b2946bcce98 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 20:06:31 +0200 Subject: [PATCH 06/17] typo of link into eldy menu --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 682c00ef77a..9aa38b584d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -918,7 +918,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Grand livre $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); + if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); // Accountancy journals if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') From 14ab058f34147859f1935ac51ee06bd28f680f98 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:05:57 +0200 Subject: [PATCH 07/17] Add Dunning into compta report --- ChangeLog | 1 + htdocs/compta/dons/class/don.class.php | 22 +++-- htdocs/compta/resultat/clientfourn.php | 124 +++++++++++++++++++++++++ htdocs/compta/resultat/index.php | 79 ++++++++++++++++ htdocs/langs/en_US/donations.lang | 1 + htdocs/langs/fr_FR/donations.lang | 3 +- 6 files changed, 220 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cecbc2b752..fb593d3722c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,7 @@ For users: - New: [ task #1204 ] add a External reference to contract - New: [ task #1204 ] add Numering contrat module free (like leopard in product module) - New: Enable supplier price log table +- New: Add dunning into compta Report For translators: - Update language files. diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index 7751a1138c8..993eda5a0f7 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Florian Henry * * 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 @@ -209,38 +209,42 @@ class Don extends CommonObject */ function check($minimum=0) { + global $langs; + $langs->load('main'); + $langs->load('companies'); + $err = 0; if (dol_strlen(trim($this->societe)) == 0) { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { - $error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe."; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); $err++; } } if (dol_strlen(trim($this->address)) == 0) { - $error_string[$err] = "L'adresse saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Address')); $err++; } if (dol_strlen(trim($this->zip)) == 0) { - $error_string[$err] = "Le code postal saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip')); $err++; } if (dol_strlen(trim($this->town)) == 0) { - $error_string[$err] = "La ville saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Town')); $err++; } if (dol_strlen(trim($this->email)) == 0) { - $error_string[$err] = "L'email saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail')); $err++; } @@ -252,7 +256,7 @@ class Don extends CommonObject { if (!isset($map[substr($this->amount, $i, 1)] )) { - $error_string[$err] = "Le montant du don contient un/des caractere(s) invalide(s)"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; $amount_invalid = 1; break; @@ -263,14 +267,14 @@ class Don extends CommonObject { if ($this->amount == 0) { - $error_string[$err] = "Le montant du don est null"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[$err] = "Le montant minimum du don est de $minimum"; + $error_string[$err] = $langs->trans('MinimumAmount',$langs->trans('$minimum')); $err++; } } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5dcd09814ad..3d72b15804b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -3,6 +3,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -32,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("bills"); +$langs->load("donation"); +$langs->load("salaries"); $date_startmonth=GETPOST('date_startmonth'); $date_startday=GETPOST('date_startday'); @@ -538,6 +542,126 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } +/* + * Salaries + */ + +print ''.$langs->trans("Salaries").''; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; +$sql.= " WHERE p.entity = ".$conf->entity; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + +$sql.= " GROUP BY u.rowid"; +$sql.= " ORDER BY u.firstname"; + +dol_syslog("get payment salaries"); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht -= $obj->amount; + $total_ttc -= $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + + $var = !$var; + print " "; + + print "".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''.price(-$obj->amount).''; + print ''.price(-$obj->amount).''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print " "; + print ''.$langs->trans("None").''; + print ''; + } +} +else +{ + dol_print_error($db); +} +/* + * Dunning +*/ + +print ''.$langs->trans("Donation").''; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname"; +$sql.= " ORDER BY p.societe, p.firstname, p.lastname"; + +dol_syslog("get dunning"); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht += $obj->amount; + $total_ttc += $obj->amount; + $subtotal_ht -= $obj->amount; + $subtotal_ttc -= $obj->amount; + + $var = !$var; + print " "; + + print "".$langs->trans("Donation")." nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''.price($obj->amount).''; + print ''.price($obj->amount).''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print " "; + print ''.$langs->trans("None").''; + print ''; + } +} +else +{ + dol_print_error($db); +} +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''.price(-$subtotal_ht).''; +print ''.price(-$subtotal_ttc).''; +print ''; /* * VAT diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index c61c8b76e08..17b408af1d6 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -3,6 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -469,6 +471,83 @@ $parameters["mode"] = $modecompta; $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +/* + * Salaries + */ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " GROUP BY p.label, dm"; + +dol_syslog("get social salaries payments"); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; + $encaiss[$obj->dm] += $obj->amount; + + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; + $decaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + +/* + * get dunning paiement +*/ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + +dol_syslog("get social salaries payments"); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; + + if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; + $encaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + /* * Show result array */ diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 728661dfa04..66ddea95a5c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -30,3 +30,4 @@ SearchADonation=Search a donation DonationRecipient=Donation recipient ThankYou=Thank You IConfirmDonationReception=The recipient declare reception, as a donation, of the following amount +MinimumAmount=Minimum amount is %s diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 9af7a87a12d..2da59454571 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -37,4 +37,5 @@ IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des d FrenchOptions=Options éligibles en France DONATION_ART200=Les dons ou versements reçus sont éligibles à l'article 200 du CGI DONATION_ART238=Les dons ou versements reçus sont éligibles à l'article 238bis du CGI -DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI \ No newline at end of file +DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI +MinimumAmount=Le montant minimum du don est de %s \ No newline at end of file From 32c777a78bc1a639c1ebef8f0fcc9e41afe348c7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:17:22 +0200 Subject: [PATCH 08/17] Fix bad merge --- htdocs/compta/resultat/clientfourn.php | 4 ++-- htdocs/compta/resultat/index.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 7892704a41c..da30c04d53d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -547,14 +547,14 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti */ print ''.$langs->trans("Salaries").''; -$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; -$sql.= " GROUP BY u.rowid"; +$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; dol_syslog("get payment salaries"); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 17b408af1d6..05c3a93e011 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -494,8 +494,8 @@ if ($result) { $obj = $db->fetch_object($result); - if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; - $encaiss[$obj->dm] += $obj->amount; + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; $decaiss_ttc[$obj->dm] += $obj->amount; @@ -533,8 +533,8 @@ if ($result) { $obj = $db->fetch_object($result); - if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; - $decaiss[$obj->dm] += $obj->amount; + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; + $encaiss[$obj->dm] += $obj->amount; if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; $encaiss_ttc[$obj->dm] += $obj->amount; From fc65421b2eda7dea72004ae0d87d0ed2f4f1c99f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:19:07 +0200 Subject: [PATCH 09/17] bad merge --- htdocs/compta/resultat/clientfourn.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index da30c04d53d..1d8a05984e3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -542,11 +542,12 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } + /* * Salaries */ -print ''.$langs->trans("Salaries").''; +print ''.$langs->trans("Salaries").''; $sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; @@ -556,7 +557,7 @@ if (! empty($date_start) && ! empty($date_end)) $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; - + dol_syslog("get payment salaries"); $result=$db->query($sql); $subtotal_ht = 0; @@ -579,9 +580,9 @@ if ($result) $var = !$var; print " "; - + print "".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."\n"; - + if ($modecompta == 'CREANCES-DETTES') print ''.price(-$obj->amount).''; print ''.price(-$obj->amount).''; print ''; From 15d680ea4b64c035c9853a8560aea1c4abaa6bc4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:19:52 +0200 Subject: [PATCH 10/17] bad mege --- htdocs/compta/resultat/clientfourn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 1d8a05984e3..d55930ef80f 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -554,7 +554,7 @@ $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; - + $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; From 5216bbca720928cee778f6df316b78f7652ac54e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 21:31:58 +0200 Subject: [PATCH 11/17] Traduce button --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/es_ES/accountancy.lang | 1 + htdocs/langs/fr_FR/accountancy.lang | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index de3bbf5c1db..b0e5096699b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -137,11 +137,11 @@ else { print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); - print '
'; + print ''; print '
'; print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6745b56daf1..0c1ad62eab2 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -122,6 +122,7 @@ CustomerInvoicePayment=Payment of invoice customer ThirdPartyAccount=Thirdparty account +NewAccountingMvt=New movement NumMvts=Number of movement ListeMvts=List of the movement ErrorDebitCredit=Debit and Credit cannot have a value at the same time diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index afcb8456a5d..624e2c02291 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -120,6 +120,7 @@ CustomerInvoicePayment=Pago Factura a cliente ThirdPartyAccount=Cuenta tercero +NewAccountingMvt=Nueva movimiento NumMvts=Número de movimiento ListeMvts=Apuntes del movimiento ErrorDebitCredit=Débito y Crédito no pueden terner valor al mismo tiempo diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 72c7475fd1d..8f66eb5319f 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -122,6 +122,7 @@ CustomerInvoicePayment=Règlement de facture client ThirdPartyAccount=Compte tiers +NewAccountingMvt=Nouveau mouvement NumMvts=Numéro de mouvement ListeMvts=Liste du mouvement ErrorDebitCredit=Debit et Credit ne peuvent avoir une valeur en même temps From fe9e7a0fa951e1ba2945af6728101aa2d5266d97 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 18:00:55 +0200 Subject: [PATCH 12/17] Revert "Closed projects are greyed out in project selector" This reverts commit 68994823dd7738735f848ca9b607f9174b68f8bd. --- htdocs/core/class/html.formprojet.class.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index eafe9d9f166..4042bb16e31 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -115,17 +115,12 @@ class FormProjets { $disabled=0; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); - if ($obj->fk_statut == 0) + if (! $obj->fk_statut > 0) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - else if ($obj->fk_statut == 2) - { - $disabled=1; - $labeltoshow.=' - '.$langs->trans("Closed"); - } - else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From c15849df2d8640094c7ac5add6307563ed380007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 17 Sep 2014 16:40:35 +0200 Subject: [PATCH 13/17] Fixed typo --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 13edeb168fa..6f70ba71673 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -685,7 +685,7 @@ class FormMail * @param DoliDB $db Database handler * @param string $type_template Get message for key module * @param string $user Use template public or limited to this user - * @para Translate $outputlangs Output lang object + * @param Translate $outputlangs Output lang object * @return array array('topic'=>,'content'=>,..) */ private function getEMailTemplate($db, $type_template, $user, $outputlangs) From 9cc01635aac0c8e1cb14926acd085c56c49404a0 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:56:53 +0200 Subject: [PATCH 14/17] Add clear search icon on unpaid invoices list --- htdocs/compta/facture/impayees.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 88fa6ebad27..4db7935e69c 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -372,6 +372,17 @@ $search_montant_ht = GETPOST("search_montant_ht"); $search_montant_ttc = GETPOST("search_montant_ttc"); $late = GETPOST("late"); +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_paymentmode=''; + $search_montant_ht=''; + $search_montant_ttc=''; +} + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -571,6 +582,7 @@ if ($resql) print ' '; print ''; print ''; + print ''; print ''; if (empty($mode)) { From 3611ac673f97fb5d2367e7cf36a61271fb759851 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:58:11 +0200 Subject: [PATCH 15/17] Add clear search icon on invoices list --- htdocs/compta/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3532125ed8e..f5dbd8186cd 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -327,6 +327,7 @@ if ($resql) print ''; print ' '; print ''; + print ''; print "\n"; if ($num > 0) From f6df17bc011ac11a8cd73b3b76c0de50f25b8c58 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:58:37 +0200 Subject: [PATCH 16/17] Add filters on shipment list + delivery informations --- htdocs/expedition/liste.php | 63 +++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index 29ab105ee91..91eb7056b2c 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -34,6 +34,10 @@ $expeditionid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expedition',$expeditionid,''); +$search_ref_exp = GETPOST("search_ref_exp"); +$search_ref_liv = GETPOST('search_ref_liv'); +$search_societe = GETPOST("search_societe"); + $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); @@ -47,6 +51,13 @@ if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref_exp=''; + $search_ref_liv=''; + $search_societe=''; +} /* * View @@ -79,10 +90,9 @@ if ($socid) { $sql.= " AND e.fk_soc = ".$socid; } -if (GETPOST('sf_ref','alpha')) -{ - $sql.= " AND e.ref like '%".$db->escape(GETPOST('sf_ref','alpha'))."%'"; -} +if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); @@ -94,7 +104,10 @@ if ($resql) $expedition = new Expedition($db); - $param="&socid=$socid"; + $param=""; + if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; + if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; + if ($search_societe) $param.= "&search_societe=".$search_societe; print_barre_liste($langs->trans('ListOfSendings'), $page, "liste.php",$param,$sortfield,$sortorder,'',$num); @@ -103,14 +116,44 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"liste.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),"ship2bill.php","e.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),"ship2bill.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"ship2bill.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); if($conf->livraison_bon->enabled) { - print_liste_field_titre($langs->trans("DateReceived"),"liste.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DeliveryOrder"),"ship2bill.php","e.date_expedition","",$param, '',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateReceived"),"ship2bill.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + if($conf->livraison_bon->enabled) { + print ''; + } + print ''; + print ''; + + print "\n"; + $var=True; while ($i < min($num,$limit)) From 64fe08253952624a15024e71b30aafc5add94af0 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:59:00 +0200 Subject: [PATCH 17/17] New generic functions for search pictos, to be used in every lists --- htdocs/core/lib/functions.lib.php | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e2bf34a75d..17e9467fb81 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2252,6 +2252,47 @@ function img_phone($titlealt = 'default', $option = 0) return img_picto($titlealt, $img); } +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_search($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'search.png', $other, false, 1); + + $input = ''; + + return $input; +} + +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_searchclear($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); + + $input = ''; + + return $input; +} /** * Show information for admin users
'; + print ''; + print ''; + print ''; + print ' '; + print ''; + print ' '; + // Développé dans la 3.7 + //print img_search(); + //print img_searchclear(); + print ''; + print ''; + print ''; + print ''.$langs->trans("All").' / '.$langs->trans("None").''; + print '