diff --git a/COPYRIGHT b/COPYRIGHT
index c0d8389369c..fd54e10f354 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -9,41 +9,41 @@ More information: http://www.gnu.org/licenses/gpl-3.0.txt
Dolibarr uses some external libraries released under different licenses. This is compatibility summary:
-Component Version License GPL Compatible Usage
+Component Version License GPL Compatible Usage
-------------------------------------------------------------------------------------
PHP libraries:
-AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
-CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
-FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management
-FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management
-GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
-NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
-odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
-PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
-PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
-TCPDF 6.0.093 LGPL-3+ Yes PDF generation
+AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
+CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
+FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management
+FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management
+GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
+NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
+odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
+PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
+PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
+TCPDF 6.0.093 LGPL-3+ Yes PDF generation
JS libraries:
-jQuery 1.8.2 MIT License Yes JS library
-jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
-jQuery UI Multiselect ? GPL and MIT License Yes JS library plugin for sexier multiselect
-jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
-jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
-jQuery DataTables 1.9.4 BSD Yes JS library for tables output
-jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
-jQuery Flot 0.7 MIT License Yes JS library to build graph
-jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
-jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
-jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
-jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
-jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors
-jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors
-jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15)
-jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used)
-jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
-jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
-jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
-jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
+jQuery 1.8.2 MIT License Yes JS library
+jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
+jQuery multiple-select 1.1.0 MIT License Yes JS library plugin for sexier multiselect
+jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
+jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
+jQuery DataTables 1.9.4 BSD Yes JS library for tables output
+jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
+jQuery Flot 0.7 MIT License Yes JS library to build graph
+jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
+jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
+jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
+jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
+jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors
+jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors
+jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15)
+jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used)
+jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
+jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
+jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
+jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
For licenses compatibility informations:
http://www.fsf.org/licensing/licenses/index_html
diff --git a/ChangeLog b/ChangeLog
index c5aeb5874b3..5182a84cd33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -163,18 +163,20 @@ Dolibarr better:
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
-- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice
-- Fix: bug 1588 : relative discount
+- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
+- Fix: bug 1588 : relative discount.
- Fix: label of input method not tranlated.
- Fix: box of customer and propsects were not correctly disabled.
-- Fix: right and error management #1961
-- Fix: Fix Error when trying to clone an Order #1943
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
+- Fix: Civility & birthdate wasn't save into adherent module.
+- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
+- Fix: Chars - is no more allowed into value for code for extra fields.
+( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users:
- Fix: Can upload files on services.
-- Fix: sql errors on updat fichinter.
+- Fix: sql errors on update fichinter.
- Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets.
@@ -310,6 +312,9 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
- Remove add_photo_web() that is ot used anymore by core code.
+***** ChangeLog for 3.5.6 compared to 3.5.5 *****
+Fix: Avoid missing class error for fetch_thirdparty method #1973
+
***** ChangeLog for 3.5.5 compared to 3.5.4 *****
Fix: Holiday module was broken. Initializaion of amount of holidays failed.
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index 60ff4b125c3..36739254d06 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -37,6 +37,11 @@ $mesg = '';
$action = GETPOST('action');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
+$search_account = GETPOST("search_account");
+$search_label = GETPOST("search_label");
+$search_accountparent = GETPOST("search_accountparent");
+$search_pcgtype = GETPOST("search_pcgtype");
+$search_pcgsubtype = GETPOST("search_pcgsubtype");
// Security check
if (!$user->admin)
@@ -83,6 +88,15 @@ if ($action == 'disable') {
}
}
+if (GETPOST("button_removefilter"))
+{
+ $search_account="";
+ $search_label="";
+ $search_accountparent="";
+ $search_pcgtype="";
+ $search_pcgsubtype="";
+}
+
/*
* View
*
@@ -96,20 +110,20 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa, " . MAIN_DB_PREFIX
$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $pcgver;
-if (strlen(trim($_GET["search_account"]))) {
- $sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'";
+if (strlen(trim($search_account))) {
+ $sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
-if (strlen(trim($_GET["search_label"]))) {
- $sql .= " AND aa.label like '%" . $_GET["search_label"] . "%'";
+if (strlen(trim($search_label))) {
+ $sql .= " AND aa.label like '%" . $search_label . "%'";
}
-if (strlen(trim($_GET["search_accountparent"]))) {
- $sql .= " AND aa.account_parent like '%" . $_GET["search_accountparent"] . "%'";
+if (strlen(trim($search_accountparent))) {
+ $sql .= " AND aa.account_parent like '%" . $search_accountparent . "%'";
}
-if (strlen(trim($_GET["search_pcgtype"]))) {
- $sql .= " AND aa.pcg_type like '%" . $_GET["search_pcgtype"] . "%'";
+if (strlen(trim($search_pcgtype))) {
+ $sql .= " AND aa.pcg_type like '%" . $search_pcgtype . "%'";
}
-if (strlen(trim($_GET["search_pcgsubtype"]))) {
- $sql .= " AND aa.pcg_subtype like '%" . $_GET["search_pcgsubtype"] . "%'";
+if (strlen(trim($search_pcgsubtype))) {
+ $sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
}
$sql .= $db->order($sortfield, $sortorder);
@@ -141,18 +155,20 @@ if ($result) {
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
- print_liste_field_titre(" ");
+ print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print '';
print '
';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
print ' ';
- print '';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
print ' ';
print ' ';
@@ -180,11 +196,13 @@ if ($result) {
}
print '';
- print '';
+ // Action
+ print ' ';
if ($user->admin) {
print '';
print img_edit();
- print ' ';
+ print '';
+ print ' ';
print '';
print img_delete();
print ' ';
diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php
index 9ebdea5fefc..ad6ca01b6ca 100644
--- a/htdocs/accountancy/admin/card.php
+++ b/htdocs/accountancy/admin/card.php
@@ -181,11 +181,6 @@ else if ($id)
if ($action == 'update')
{
- // WYSIWYG Editor
- $htmlacc = new FormVentilation($db);
-
- require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
-
$soc = new Societe($db);
if ($object->socid) {
$soc->fetch($object->socid);
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 9e109c7feeb..608c62cf1d0 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -35,8 +35,6 @@ $langs->load("accounting");
$id = GETPOST('id', 'int');
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
$action = GETPOST('action');
$piece_num = GETPOST("piece_num");
@@ -238,7 +236,9 @@ if ($action == 'create') {
print ' ';
print '';
-} else {
+}
+else
+{
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
@@ -309,14 +309,12 @@ if ($action == 'create') {
print ' ';
print '' . $line->montant . ' ';
print '' . $line->sens . ' ';
-
print '';
- if ($user->rights->accounting->access) {
- print ' ';
- }
+ print ' ';
print '';
print ' ';
- } else {
+ }
+ else {
print '' . $line->numero_compte . ' ';
print '' . $line->code_tiers . ' ';
print '' . $line->label_compte . ' ';
@@ -324,16 +322,15 @@ if ($action == 'create') {
print '' . $line->credit . ' ';
print '' . $line->montant . ' ';
print '' . $line->sens . ' ';
-
+
print '';
- if ($user->rights->accouting->access) {
- print '';
- print img_edit();
- print ' ';
- print '';
- print img_delete();
- print ' ';
- }
+ print '';
+ print img_edit();
+ print ' ';
+ print '';
+ print img_delete();
+ print ' ';
+
print ' ';
}
print "\n";
@@ -342,7 +339,7 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') {
$var = ! $var;
print "";
-
+
print ' ';
}
-
print "";
}
}
- } else {
+ }
+ else {
print_fiche_titre($langs->trans("NoRecords"));
}
}
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index b0e5096699b..21da5bacbb9 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -36,6 +36,11 @@ $page = GETPOST("page");
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
$action = GETPOST('action', 'alpha');
+$search_doc_type = GETPOST("search_doc_type");
+$search_doc_ref = GETPOST("search_doc_ref");
+$search_account = GETPOST("search_account");
+$search_thirdparty = GETPOST("search_thirdparty");
+$search_journal = GETPOST("search_journal");
if ($sortorder == "")
$sortorder = "ASC";
@@ -46,6 +51,15 @@ $offset = $conf->liste_limit * $page;
$formventilation = new FormVentilation($db);
+if (GETPOST("button_removefilter"))
+{
+ $search_doc_type="";
+ $search_doc_ref="";
+ $search_account="";
+ $search_thirdparty="";
+ $search_journal="";
+}
+
/*
* Action
*/
@@ -100,25 +114,25 @@ else {
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
- if (dol_strlen(trim(GETPOST("search_doc_type")))) {
+ if (dol_strlen(trim($search_doc_type))) {
- $sql .= " WHERE bk.doc_type LIKE '%" . GETPOST("search_doc_type") . "%'";
+ $sql .= " WHERE bk.doc_type LIKE '%" . $search_doc_type . "%'";
- if (dol_strlen(trim(GETPOST("search_doc_ref")))) {
- $sql .= " AND bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'";
+ if (dol_strlen(trim($search_doc_ref))) {
+ $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
}
}
- if (dol_strlen(trim(GETPOST("search_doc_ref")))) {
- $sql .= " WHERE bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'";
+ if (dol_strlen(trim($search_doc_ref))) {
+ $sql .= " WHERE bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
}
- if (dol_strlen(trim(GETPOST("search_compte")))) {
- $sql .= " WHERE bk.numero_compte LIKE '%" . GETPOST("search_compte") . "%'";
+ if (dol_strlen(trim($search_account))) {
+ $sql .= " WHERE bk.numero_compte LIKE '%" . $search_account . "%'";
}
- if (dol_strlen(trim(GETPOST("search_tiers")))) {
- $sql .= " WHERE bk.code_tiers LIKE '%" . GETPOST("search_tiers") . "%'";
+ if (dol_strlen(trim($search_thirdparty))) {
+ $sql .= " WHERE bk.code_tiers LIKE '%" . $search_thirdparty . "%'";
}
- if (dol_strlen(trim(GETPOST("search_journal")))) {
- $sql .= " WHERE bk.code_journal LIKE '%" . GETPOST("search_journal") . "%'";
+ if (dol_strlen(trim($search_journal))) {
+ $sql .= " WHERE bk.code_journal LIKE '%" . $search_journal . "%'";
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset);
@@ -149,7 +163,7 @@ else {
print ' ';
print '';
- print "";
+ print '';
print '';
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder);
@@ -157,29 +171,31 @@ else {
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "bk.code_tiers", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", "", "", $sortfield, $sortorder);
- print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", "", $sortfield, $sortorder);
- print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", "", $sortfield, $sortorder);
- print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder);
- print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
- print_liste_field_titre(" ");
+ print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print " \n";
print '';
print '';
print ' ';
@@ -201,9 +217,9 @@ else {
print '' . price($obj->debit) . ' ';
print '' . price($obj->credit) . ' ';
print '' . price($obj->montant) . ' ';
- print '' . $obj->sens . ' ';
+ print '' . $obj->sens . ' ';
print '' . $obj->code_journal . ' ';
- print '' . img_edit() . ' ';
+ print '' . img_edit() . ' ';
print "\n";
$i ++;
}
diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php
index 91a0eb5df8b..28d3d0c1f79 100644
--- a/htdocs/accountancy/customer/card.php
+++ b/htdocs/accountancy/customer/card.php
@@ -40,14 +40,12 @@ $id = GETPOST('id');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
/*
* Actions
*/
-if ($action == 'ventil' && $user->rights->accounting->access)
+if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
{
if (! GETPOST('cancel', 'alpha'))
{
@@ -109,7 +107,7 @@ if (! empty($id)) {
print ' ';
$linkback=''.$langs->trans("Back").' ';
- print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup');
+ print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup');
print '';
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 9ae070c25e0..cb40b7b361b 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -93,8 +93,8 @@ if ($action == 'validatehistory') {
*/
llxHeader('', $langs->trans("CustomersVentilation"));
-$textprevyear = "" . img_previous() . " ";
-$textnextyear = " " . img_next() . " ";
+$textprevyear = '' . img_previous() . ' ';
+$textnextyear = ' ' . img_next() . ' ';
print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
@@ -197,7 +197,7 @@ print "
\n";
print " \n";
print '';
-print '' . $langs->trans("TotalVente") . ' ';
+print '' . $langs->trans("Total") . ' ';
print '' . $langs->trans("JanuaryMin") . ' ';
print '' . $langs->trans("FebruaryMin") . ' ';
print '' . $langs->trans("MarchMin") . ' ';
@@ -212,7 +212,7 @@ print '' . $langs->trans("NovemberMin") . ' ';
print '' . $langs->trans("DecemberMin") . ' ';
print '' . $langs->trans("Total") . ' ';
-$sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Total',";
+$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS 'Total',";
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',";
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',";
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',";
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index dcd8fca4d41..1f9b0549121 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -68,8 +68,6 @@ $action = GETPOST('action');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
/*
* View
diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php
index 8af84a9ed58..fb5a15a513c 100644
--- a/htdocs/accountancy/journal/cashjournal.php
+++ b/htdocs/accountancy/journal/cashjournal.php
@@ -62,8 +62,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
$action = GETPOST('action');
diff --git a/htdocs/accountancy/journal/index.php b/htdocs/accountancy/journal/index.php
index 272d76fa20f..36286ce265e 100644
--- a/htdocs/accountancy/journal/index.php
+++ b/htdocs/accountancy/journal/index.php
@@ -36,8 +36,6 @@ $langs->load("accountancy");
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
llxHeader('', 'Journaux', '');
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index 789aa1111af..97d52124c01 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -55,8 +55,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
$action = GETPOST('action');
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index a7c0266998f..5bb1f989a92 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -56,8 +56,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->access)
- accessforbidden();
$action = GETPOST('action');
diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php
index b0078839b55..45c8de9b165 100644
--- a/htdocs/accountancy/supplier/card.php
+++ b/htdocs/accountancy/supplier/card.php
@@ -46,10 +46,9 @@ $codeventil = GETPOST('codeventil');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-if (! $user->rights->accounting->ventilation->dispatch)
- accessforbidden();
-if ($action == 'ventil' && $user->rights->accounting->access) {
+if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
+{
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id;
@@ -103,7 +102,7 @@ if ($_GET["id"]) {
print ' ';
print ' ';
- print_fiche_titre($langs->trans("Ventilation"));
+ print_fiche_titre($langs->trans("SuppliersVentilation"));
print '';
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 7d633c575f1..edebcfd9d46 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -92,10 +92,10 @@ if ($action == 'validatehistory') {
llxHeader('', $langs->trans("SuppliersVentilation"));
-$textprevyear = "" . img_previous() . " ";
-$textnextyear = " " . img_next() . " ";
+$textprevyear = '' . img_previous() . ' ';
+$textnextyear = ' ' . img_next() . ' ';
-print_fiche_titre($langs->trans("AccountingVentilationSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
+print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print '' . $langs->trans("DescVentilSupplier") . ' ';
print '';
diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php
index b2f839e3c3c..627d96acf17 100644
--- a/htdocs/adherents/admin/adherent_type_extrafields.php
+++ b/htdocs/adherents/admin/adherent_type_extrafields.php
@@ -7,7 +7,7 @@
*
* 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 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
+ * or see http://www.gnu.org/
*/
/**
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index ca7706989e0..102f45496c6 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -723,7 +723,7 @@ else
{
/* ************************************************************************** */
/* */
- /* Fiche creation */
+ /* Creation card */
/* */
/* ************************************************************************** */
$object->canvas=$canvas;
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index a057e7cba93..cdbfabf4576 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -5,6 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2009-2012 Regis Houssin
+ * Copyright (C) 2014 Alexandre Spangaro
*
* 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
@@ -124,7 +125,7 @@ class Adherent extends CommonObject
/**
- * Fonction envoyant un email a l'adherent avec le texte fourni en parametre.
+ * Function sending an email has the adherent with the text supplied in parameter.
*
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
@@ -247,9 +248,9 @@ class Adherent extends CommonObject
/**
- * Renvoie le libelle traduit de la nature d'un adherent (physique ou morale)
+ * Return translated label by the nature of a adherent (physical or moral)
*
- * @param string $morphy Nature physique ou morale de l'adherent
+ * @param string $morphy Nature of the adherent (physical or moral)
* @return string Label
*/
function getmorphylib($morphy='')
diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php
index 43ccef1e954..adb590ffcd2 100644
--- a/htdocs/admin/security.php
+++ b/htdocs/admin/security.php
@@ -165,6 +165,16 @@ else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
exit;
}
+if ($action == 'maj_pattern')
+{
+ dolibarr_set_const($db, "USER_PASSWORD_PATTERN", GETPOST("pattern"),'chaine',0,'',$conf->entity);
+ header("Location: security.php");
+ exit;
+}
+
+
+
+
@@ -265,6 +275,113 @@ foreach ($arrayhandler as $key => $module)
print '
';
print '';
+//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
+// Patter for Password Perso
+if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
+$var=!$var;
+
+ $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN);
+ /*$this->length2 = $tabConf[0];
+ $this->NbMaj = $tabConf[1];
+ $this->NbNum = $tabConf[2];
+ $this->NbSpe = $tabConf[3];
+ $this->NbRepeat = $tabConf[4];
+ $this->WithoutAmbi = $tabConf[5];
+ */
+ print '';
+
+ print '';
+}
+
+
// Cryptage mot de passe
print ' ';
$var=true;
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 607f8e14c4e..96db3133cf9 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -251,11 +251,11 @@ if ($action == 'add')
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
// Check parameters
- if (empty($object->userownerid))
+ if (empty($object->userownerid) && empty($_SESSION['assignedtouser']))
{
$error++; $donotclearsession=1;
$action = 'create';
- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
}
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
{
@@ -423,7 +423,7 @@ if ($action == 'update')
{
$error++; $donotclearsession=1;
$action = 'edit';
- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
}
// Fill array 'array_options' with data from add form
@@ -790,11 +790,11 @@ if ($id > 0)
{
$result1=$object->fetch($id);
$result2=$object->fetch_thirdparty();
- $result2=$object->fetch_contact();
- $result3=$object->fetch_userassigned();
- $result4=$object->fetch_optionals($id,$extralabels);
+ $result3=$object->fetch_contact();
+ $result4=$object->fetch_userassigned();
+ $result5=$object->fetch_optionals($id,$extralabels);
- if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0)
+ if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{
dol_print_error($db,$object->error);
exit;
diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php
deleted file mode 100644
index 334da53a2f4..00000000000
--- a/htdocs/comm/action/contact.php
+++ /dev/null
@@ -1,258 +0,0 @@
-
- * Copyright (C) 2004-2012 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2012 Philippe Grand
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/**
- * \file htdocs/comm/action/contact.php
- * \ingroup agenda
- * \brief Page for multi-users event
- */
-
-require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
-require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
-require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
-require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
-
-$langs->load("companies");
-$langs->load("commercial");
-$langs->load("other");
-$langs->load("bills");
-
-$id = GETPOST('id','int');
-$action = GETPOST('action','alpha');
-$ref = GETPOST('ref');
-$confirm = GETPOST('confirm');
-$lineid = GETPOST('lineid','int');
-
-// Security check
-$socid = GETPOST('socid','int');
-if ($user->societe_id) $socid=$user->societe_id;
-if ($user->societe_id > 0)
-{
- unset($_GET["action"]);
- $action='';
-}
-$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
-
-
-$object = new ActionComm($db);
-
-
-/*
- * Actions
- */
-
-// Add new contact
-if ($action == 'addcontact' && $user->rights->action->creer)
-{
- $result = $object->fetch($id);
-
- if ($object->id > 0)
- {
- $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
- $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
- }
-
- if ($result >= 0)
- {
- header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
- exit;
- }
- else
- {
- if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
- {
- $langs->load("errors");
- setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
- }
- else
- {
- setEventMessage($object->error, 'errors');
- }
- }
-}
-
-// modification d'un contact. On enregistre le type
-if ($action == 'updateline')
-{
- if ($object->fetch($id))
- {
- $contact = $object->detail_contact($_POST["line"]);
- $type = $_POST["type"];
- $statut = $contact->statut;
-
- $result = $object->update_contact($_POST["line"], $statut, $type);
- if ($result >= 0)
- {
- $db->commit();
- } else
- {
- dol_print_error($db, "result=$result");
- $db->rollback();
- }
- }
- else
- {
- setEventMessage($object->error, 'errors');
- }
-}
-
-// Bascule du statut d'un contact
-else if ($action == 'swapstatut')
-{
- if ($object->id > 0)
- {
- $result=$object->swapContactStatus(GETPOST('ligne'));
- }
-}
-
-// Efface un contact
-else if ($action == 'deletecontact')
-{
- $result = $object->delete_contact($lineid);
-
- if ($result >= 0)
- {
- header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
- exit;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formcompany= new FormCompany($db);
-
-$contactstatic=new Contact($db);
-$userstatic=new User($db);
-
-$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
-llxHeader('',$langs->trans("Agenda"),$help_url);
-
-
-if ($id > 0 || ! empty($ref))
-{
- if ($object->fetch($id,$ref) > 0)
- {
-
- $head=actions_prepare_head($object);
- dol_fiche_head($head, 'contact', $langs->trans("Action"),0,'action');
-
- // Affichage fiche action en mode visu
- print '';
-
- $linkback = ''.$langs->trans("BackToList").' ';
-
- // Ref
- print ''.$langs->trans("Ref").' ';
- print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
- print ' ';
-
- // Type
- if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
- {
- print ''.$langs->trans("Type").' '.$object->type.' ';
- }
-
- // Title
- print ''.$langs->trans("Title").' '.$object->label.' ';
-
- // Full day event
- print ''.$langs->trans("EventOnFullDay").' '.yn($object->fulldayevent).' ';
-
- // Date start
- print ''.$langs->trans("DateActionStart").' ';
- if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
- else print dol_print_date($object->datep,'day');
- if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
- print ' ';
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ' ';
- print ' ';
-
- // Date end
- print ''.$langs->trans("DateActionEnd").' ';
- if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
- else print dol_print_date($object->datef,'day');
- if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
- print ' ';
-
- // Location
- print ''.$langs->trans("Location").' '.$object->location.' ';
-
- print '
';
-
- dol_fiche_end();
-
- print ' ';
-
- // Contacts lines (modules that overwrite templates must declare this into descriptor)
- $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
- foreach($dirtpls as $reldir)
- {
- $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
- if ($res) break;
- }
-
- }
- else
- {
- print "ErrorRecordNotFound";
- }
-}
-
-llxFooter();
-
-$db->close();
-
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 5e180f66abb..9bb3af6dcbd 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -41,7 +41,7 @@ $langs->load("commercial");
$langs->load("other");
$langs->load("bills");
-$objectid = GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$action=GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
@@ -53,13 +53,13 @@ if ($user->societe_id > 0)
unset($_GET["action"]);
$action='';
}
-$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
+$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
$object = new ActionComm($db);
-if ($objectid > 0)
+if ($id > 0)
{
- $ret = $object->fetch($objectid);
+ $ret = $object->fetch($id);
$object->fetch_thirdparty();
}
@@ -96,11 +96,25 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
if ($object->id > 0)
{
+ $result1=$object->fetch($id);
+ $result2=$object->fetch_thirdparty();
+ $result3=$object->fetch_contact();
+ $result4=$object->fetch_userassigned();
+ $result5=$object->fetch_optionals($id,$extralabels);
+
+ if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
+ {
+ dol_print_error($db,$object->error);
+ exit;
+ }
+
+ if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
+ if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
+
$author=new User($db);
$author->fetch($object->author->id);
$object->author=$author;
- $object->fetch_contact();
$head=actions_prepare_head($object);
@@ -132,53 +146,15 @@ if ($object->id > 0)
print ''.$langs->trans("EventOnFullDay").' '.yn($object->fulldayevent).' ';
// Date start
- print ''.$langs->trans("DateActionStart").' ';
+ print ' '.$langs->trans("DateActionStart").' ';
if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print ' ';
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ' ';
print ' ';
// Date end
- print ''.$langs->trans("DateActionEnd").' ';
+ print ' '.$langs->trans("DateActionEnd").' ';
if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
else print dol_print_date($object->datef,'day');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
@@ -190,16 +166,38 @@ if ($object->id > 0)
print ' ';
// Location
- print ''.$langs->trans("Location").' '.$object->location.' ';
+ if (empty($conf->global->AGENDA_DISABLE_LOCATION))
+ {
+ print ''.$langs->trans("Location").' '.$object->location.' ';
+ }
// Assigned to
- print ''.$langs->trans("ActionAffectedTo").' ';
- if ($object->userownerid > 0)
+ print ' '.$langs->trans("ActionAffectedTo").' ';
+ $listofuserid=array();
+ if (empty($donotclearsession))
{
- $tmpuser=new User($object->userownerid);
- print $tmpuser->getNomUrl(1);
+ if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
+ if (! empty($object->userassigned)) // Now concat assigned users
+ {
+ // Restore array with key with same value than param 'id'
+ $tmplist1=$object->userassigned; $tmplist2=array();
+ foreach($tmplist1 as $key => $val)
+ {
+ if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
+ }
+ }
+ $_SESSION['assignedtouser']=dol_json_encode($listofuserid);
}
- print ' ';
+ else
+ {
+ if (!empty($_SESSION['assignedtouser']))
+ {
+ $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
+ }
+ }
+ print $form->select_dolusers_forevent('view','assignedtouser',1);
+ if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
+ print ' ';
print '
';
@@ -252,8 +250,20 @@ if ($object->id > 0)
print ($object->priority?$object->priority:'');
print '';
+ // Other attributes
+ $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id);
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook) && ! empty($extrafields->attribute_label))
+ {
+ print $object->showOptionals($extrafields,'edit');
+ }
- print '
';
+
+ print ' ';
+
+ print '';
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@@ -266,7 +276,8 @@ if ($object->id > 0)
print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.$totalsize.' '.$langs->trans("bytes").' ';
- print '
';
+
+ print '
';
print '';
@@ -274,6 +285,52 @@ if ($object->id > 0)
$permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+
+
+ if ($action != 'edit')
+ {
+ print " ";
+
+ // Link to agenda views
+ print '';
+ print ''."\n";
+ print ''."\n";
+ print ''."\n";
+ print ''."\n";
+ print '
';
+ }
}
else
{
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index c5347246719..4129b561ed1 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -118,6 +118,23 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
print " ";
}
+// Search contract
+if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
+{
+ $var=false;
+ print '\n";
+ print " ";
+}
+
/*
* Draft proposals
*/
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 189f1f9c041..3eeef6916eb 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -535,7 +535,7 @@ else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times
- if ($object->statut == 2 || $object->statut == 3) {
+ if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
$object->reopen($user, 1);
}
}
@@ -553,146 +553,19 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
}
}
-// Add file in email form
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory TODO Use a dedicated directory for temp mails files
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-// Remove file in email form
-if (GETPOST('removedfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'], 0);
- $action = 'presend';
-}
/*
* Send mail
*/
-if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
- $langs->load('mails');
- if ($object->id > 0) {
- if ($_POST['sendto']) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = $_POST['sendto'];
- $sendtoid = 0;
- } elseif ($_POST['receiver'] != '-1') {
- // Recipient was provided from combo list
- if ($_POST['receiver'] == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email');
- $sendtoid = $_POST['receiver'];
- }
- }
+// Actions to send emails
+$actiontypecode='AC_PROP';
+$trigger_name='PROPAL_SENTBYMAIL';
+$paramname='id';
+$mode='emailfromproposal';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- if (dol_strlen($sendto)) {
- $langs->load("commercial");
- $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
- $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>';
- $message = $_POST['message'];
- $sendtocc = $_POST['sendtocc'];
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
- $deliveryreceipt = $_POST['deliveryreceipt'];
-
- if (dol_strlen($_POST['subject']))
- $subject = $_POST['subject'];
- else
- $subject = $langs->transnoentities('Propal') . ' ' . $object->ref;
- $actiontypecode = 'AC_PROP';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles ['paths'];
- $filename = $attachedfiles ['names'];
- $mimetype = $attachedfiles ['mimes'];
-
- // Envoi de la propal
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg;
- $object->actionmsg2 = $actionmsg2;
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error++;
- $object->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if (! $error) {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- } else {
- dol_print_error($db);
- }
- } else {
- $langs->load("other");
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= ' ' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors');
- dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")));
- }
-}
// Go back to draft
if ($action == 'modif' && $user->rights->propal->creer)
@@ -2201,7 +2074,7 @@ if ($action == 'create')
}
// ReOpen
- if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) {
+ if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
print '';
}
@@ -2368,13 +2241,13 @@ if ($action == 'create')
$formmail->withcancel = 1;
// Tableau des substitutions
- $formmail->substit ['__PROPREF__'] = $object->ref;
- $formmail->substit ['__SIGNATURE__'] = $user->signature;
- $formmail->substit ['__REFCLIENT__'] = $object->ref_client;
- $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name;
- $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
- $formmail->substit ['__PERSONALIZED__'] = '';
- $formmail->substit ['__CONTACTCIVNAME__'] = '';
+ $formmail->substit['__PROPREF__'] = $object->ref;
+ $formmail->substit['__SIGNATURE__'] = $user->signature;
+ $formmail->substit['__REFCLIENT__'] = $object->ref_client;
+ $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
+ $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
+ $formmail->substit['__PERSONALIZED__'] = '';
+ $formmail->substit['__CONTACTCIVNAME__'] = '';
// Find the good contact adress
$custcontact = '';
@@ -2391,15 +2264,15 @@ if ($action == 'create')
}
if (! empty($custcontact)) {
- $formmail->substit ['__CONTACTCIVNAME__'] = $custcontact;
+ $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
}
}
// Tableau des parametres complementaires
- $formmail->param ['action'] = 'send';
- $formmail->param ['models'] = 'propal_send';
- $formmail->param ['id'] = $object->id;
- $formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
+ $formmail->param['action'] = 'send';
+ $formmail->param['models'] = 'propal_send';
+ $formmail->param['id'] = $object->id;
+ $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files
if (GETPOST("mode") == 'init') {
$formmail->clear_attached_files();
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index c056e5aa1c5..15d85afec07 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1739,8 +1739,14 @@ class Propal extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
+ $modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
+ $trigger_name='PROPAL_CLOSE_REFUSED';
+
if ($statut == 2)
{
+ $trigger_name='PROPAL_CLOSE_SIGNED';
+ $modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
+
// The connected company is classified as a client
$soc=new Societe($this->db);
$soc->id = $this->socid;
@@ -1752,48 +1758,31 @@ class Propal extends CommonObject
$this->db->rollback();
return -2;
}
-
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
- {
- // Define output language
- $outputlangs = $langs;
- if (! empty($conf->global->MAIN_MULTILANGS))
- {
- $outputlangs = new Translate("",$conf);
- $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
- $outputlangs->setDefaultLang($newlang);
- }
- //$ret=$object->fetch($id); // Reload to get new records
- $this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
- }
-
- // Call trigger
- $result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user);
- if ($result < 0) { $error++; }
- // End call triggers
}
- else
+ if ($statut == 4)
{
-
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
- {
- // Define output language
- $outputlangs = $langs;
- if (! empty($conf->global->MAIN_MULTILANGS))
- {
- $outputlangs = new Translate("",$conf);
- $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
- $outputlangs->setDefaultLang($newlang);
- }
- //$ret=$object->fetch($id); // Reload to get new records
- $this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
- }
-
- // Call trigger
- $result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user);
- if ($result < 0) { $error++; }
- // End call triggers
+ $trigger_name='PROPAL_CLASSIFY_BILLED';
}
+
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ // Define output language
+ $outputlangs = $langs;
+ if (! empty($conf->global->MAIN_MULTILANGS))
+ {
+ $outputlangs = new Translate("",$conf);
+ $newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ //$ret=$object->fetch($id); // Reload to get new records
+ $this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ }
+
+ // Call trigger
+ $result=$this->call_trigger($trigger_name,$user);
+ if ($result < 0) { $error++; }
+ // End call triggers
+
if ( ! $error )
{
$this->db->commit();
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 6522a592097..2b8e478d37d 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -322,8 +322,11 @@ if ($result)
print '';
$formpropal->selectProposalStatus($viewstatut,1);
print ' ';
- print ' ';
- print ' ';
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
print "\n";
$var=true;
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 94286ee4c53..113618ffae8 100644
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -48,7 +48,6 @@ $search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int');
-if ($search_status=='') $search_status=1; // always display activ customer first
$catid = GETPOST("catid",'int');
$sortfield = GETPOST("sortfield",'alpha');
@@ -154,6 +153,21 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist'));
+// Do we click on purge search criteria ?
+if (GETPOST("button_removefilter_x"))
+{
+ $socname="";
+ $stcomm="";
+ $search_nom="";
+ $search_zipcode="";
+ $search_town="";
+ $search_state="";
+ $search_datec="";
+ $search_categ="";
+ $search_status="";
+}
+
+if ($search_status=='') $search_status=1; // always display active customer first
/*
* Actions
@@ -361,7 +375,7 @@ if ($resql)
// Print these two select
print $langs->trans("From").' '.$options_from.' ';
print ' ';
- print $langs->trans("To").' '.$options_to.' ';
+ print $langs->trans("to").' '.$options_to.' ';
print '';
@@ -378,9 +392,9 @@ if ($resql)
print '';
// Print the search button
- print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
+ print " \n";
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 792da64a923..4bf1eceb6dc 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1151,162 +1151,18 @@ else if ($action == 'update_extras') {
$action = 'edit_extras';
}
-/*
- * Add file in email form
- */
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory TODO Use a dedicated directory for temp mails files
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-/*
- * Remove file in email form
- */
-if (GETPOST('removedfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process(GETPOST('removedfile'), 0);
- $action = 'presend';
-}
-
/*
* Send mail
*/
-if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
- $langs->load('mails');
- if ($object->id > 0) {
- // $ref = dol_sanitizeFileName($object->ref);
- // $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
+// Actions to send emails
+$actiontypecode='AC_COM';
+$trigger_name='ORDER_SENTBYMAIL';
+$paramname='id';
+$mode='emailfromorder';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- // if (is_readable($file))
- // {
- if (GETPOST('sendto')) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = GETPOST('sendto');
- $sendtoid = 0;
- } elseif (GETPOST('receiver') != '-1') {
- // Recipient was provided from combo list
- if (GETPOST('receiver') == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'), 'email');
- $sendtoid = GETPOST('receiver');
- }
- }
- if (dol_strlen($sendto)) {
- $langs->load("commercial");
-
- $from = GETPOST('fromname') . ' <' . GETPOST('frommail') . '>';
- $replyto = GETPOST('replytoname') . ' <' . GETPOST('replytomail') . '>';
- $message = GETPOST('message');
- $sendtocc = GETPOST('sendtocc');
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
- $deliveryreceipt = GETPOST('deliveryreceipt');
-
- if ($action == 'send') {
- if (dol_strlen(GETPOST('subject')))
- $subject = GETPOST('subject');
- else
- $subject = $langs->transnoentities('Order') . ' ' . $object->ref;
- $actiontypecode = 'AC_COM';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
- }
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles ['paths'];
- $filename = $attachedfiles ['names'];
- $mimetype = $attachedfiles ['mimes'];
-
- // Send mail
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- //Must not contain quotes
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
-
- $error = 0;
-
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg;
- $object->actionmsg2 = $actionmsg2;
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('ORDER_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error ++;
- $this->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if ($error) {
- dol_print_error($db);
- } else {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit();
- }
- } else {
- $langs->load("other");
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= ' ' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
-
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")), 'errors');
- dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")));
- }
-}
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
if ($action == 'addcontact') {
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index 25b7d91a3ff..1e8196481e6 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("companies");
+$langs->load("margins");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@@ -72,6 +73,15 @@ $limit = $conf->liste_limit;
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='b.dateo';
+if (GETPOST("button_removefilter"))
+{
+ $description="";
+ $type="";
+ $debit="";
+ $credit="";
+ $account="";
+ $bid="";
+}
/*
* View
@@ -198,7 +208,7 @@ if ($resql)
print ' ';
print ' ';
print '';
- $form->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8);
+ $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8);
print ' ';
print ' ';
print '';
@@ -214,9 +224,9 @@ if ($resql)
print ' ';
print ' ';
if (! empty($_REQUEST['bid'])) print ' ';
- print ' ';
- print ' ';
- print '';
+ print ' ';
+ print ' ';
+ print "\n";
// Loop on each record
$total_debit=0;
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index bb2c50b42bf..da0e3e21dcd 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -27,6 +27,8 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("companies");
$langs->load("users");
@@ -37,6 +39,10 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'deplacement','','');
+$search_ref=GETPOST('search_ref','int');
+$search_name=GETPOST('search_name','alpha');
+$search_company=GETPOST('search_company','alpha');
+// $search_amount=GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -48,13 +54,24 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.dated";
$limit = $conf->liste_limit;
-$search_ref=GETPOST('search_ref','alpha');
+$year=GETPOST("year");
+$month=GETPOST("month");
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_name="";
+ $search_company="";
+ // $search_amount="";
+ $year="";
+ $month="";
+}
/*
* View
*/
+$formother = new FormOther($db);
$tripandexpense_static=new Deplacement($db);
$userstatic = new User($db);
@@ -76,10 +93,31 @@ $sql.= " AND d.entity = ".$conf->entity;
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
-if (trim($search_ref) != '')
+
+if ($search_ref) $sql.=" AND d.rowid=".$search_ref;
+if ($search_name)
{
- $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
+ $sql .= natural_search('u.lastname', $search_name);
}
+if ($search_company)
+{
+ $sql .= natural_search('s.nom', $search_company);
+}
+// if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'";
+if ($month > 0)
+{
+ if ($year > 0 && empty($day))
+ $sql.= " AND d.dated BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
+ else if ($year > 0 && ! empty($day))
+ $sql.= " AND d.dated BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
+ else
+ $sql.= " AND date_format(d.dated, '%m') = '".$month."'";
+}
+else if ($year > 0)
+{
+ $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
+}
+
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@@ -97,7 +135,7 @@ if ($resql)
print "";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
@@ -107,24 +145,27 @@ if ($resql)
// Filters lines
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
- //print ' ';
+ print ' ';
+ print ' ';
+ print '';
+ if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ' ';
+ print ' ';
+ $formother->select_year($year?$year:-1,'year',1, 20, 5);
print ' ';
print '';
- //print ' ';
+ print ' ';
print ' ';
- print '';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
print '';
- print ' ';
- print ' ';
- print '';
- print ' ';
+ // print ' ';
print ' ';
print ' ';
+ print ' ';
print " \n";
$var=true;
@@ -142,9 +183,9 @@ if ($resql)
// Type
print ''.$langs->trans($obj->type).' ';
// Date
- print ''.dol_print_date($db->jdate($obj->dd),'day').' ';
+ print ''.dol_print_date($db->jdate($obj->dd),'day').' ';
// User
- print '';
+ print ' ';
$userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
diff --git a/htdocs/compta/dons/list.php b/htdocs/compta/dons/list.php
index badc71c96e2..174b5357bb2 100644
--- a/htdocs/compta/dons/list.php
+++ b/htdocs/compta/dons/list.php
@@ -43,12 +43,20 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
-$search_ref=GETPOST('search_ref');
-$search_company=GETPOST('search_company');
-$search_name=GETPOST('search_name');
+$search_ref=GETPOST('search_ref','alpha');
+$search_company=GETPOST('search_company','alpha');
+$search_name=GETPOST('search_name','alpha');
+$search_amount = GETPOST('search_amount','alpha');
if (!$user->rights->don->lire) accessforbidden();
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_company="";
+ $search_name="";
+ $search_amount="";
+}
/*
* View
@@ -82,6 +90,8 @@ if (trim($search_name) != '')
{
$sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
}
+if ($search_amount) $sql.=" AND d.amount='".$db->escape(price2num(trim($search_amount)))."'";
+
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@@ -141,11 +151,10 @@ if ($resql)
print ' ';
print ' ';
}
- print '';
- print ' ';
- print ' ';
+ print ' ';
print ' ';
- print " \n";
+ print ' ';
+ print "\n";
$var=True;
while ($i < min($num,$limit))
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 2ba425f5a90..9d003ae0aa7 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1550,178 +1550,24 @@ if (GETPOST('linkedOrder')) {
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
}
-/*
- * Add file in email form
- */
-if (GETPOST('addfile')) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- dol_add_file_process($upload_dir_tmp, 0, 0);
- $action = 'presend';
-}
-
-/*
- * Remove file in email form
- */
-if (! empty($_POST['removedfile'])) {
- require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
-
- // Set tmp user directory
- $vardir = $conf->user->dir_output . "/" . $user->id;
- $upload_dir_tmp = $vardir . '/temp';
-
- // TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'], 0);
- $action = 'presend';
-}
/*
* Send mail
*/
-if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
- $langs->load('mails');
- $actiontypecode = '';
- $subject = '';
- $actionmsg = '';
- $actionmsg2 = '';
+// Actions to send emails
+if (empty($id)) $id=$facid;
+$actiontypecode='AC_FAC';
+$trigger_name='BILL_SENTBYMAIL';
+$paramname='id';
+$mode='emailfrominvoice';
+include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
- $result = $object->fetch($id);
- $result = $object->fetch_thirdparty();
-
- if ($result > 0) {
- // $ref = dol_sanitizeFileName($object->ref);
- // $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
-
- // if (is_readable($file))
- // {
- if ($_POST['sendto']) {
- // Le destinataire a ete fourni via le champ libre
- $sendto = $_POST['sendto'];
- $sendtoid = 0;
- } elseif ($_POST['receiver'] != '-1') {
- // Recipient was provided from combo list
- if ($_POST['receiver'] == 'thirdparty') // Id of third party
- {
- $sendto = $object->thirdparty->email;
- $sendtoid = 0;
- } else // Id du contact
- {
- $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email');
- $sendtoid = $_POST['receiver'];
- }
- }
-
- if (dol_strlen($sendto))
- {
- $langs->load("commercial");
-
- $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
- $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>';
- $message = $_POST['message'];
- $sendtocc = $_POST['sendtocc'];
- $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
- $deliveryreceipt = $_POST['deliveryreceipt'];
-
- if ($action == 'send' || $action == 'relance')
- {
- if (dol_strlen($_POST['subject']))
- $subject = $_POST['subject'];
- else
- $subject = $langs->transnoentities('Bill') . ' ' . $object->ref;
- $actiontypecode = 'AC_FAC';
- $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
- if ($message) {
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
- $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
- $actionmsg = dol_concatdesc($actionmsg, $message);
- }
- // $actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
- }
-
- // Create form object
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $attachedfiles = $formmail->get_attached_files();
- $filepath = $attachedfiles['paths'];
- $filename = $attachedfiles['names'];
- $mimetype = $attachedfiles['mimes'];
-
- // Send mail
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
- $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1);
- if ($mailfile->error) {
- setEventMessage($mailfile->error, 'errors');
- } else {
- $result = $mailfile->sendfile();
- if ($result) {
- $error = 0;
-
- // Initialisation donnees
- $object->sendtoid = $sendtoid;
- $object->actiontypecode = $actiontypecode;
- $object->actionmsg = $actionmsg; // Long text
- $object->actionmsg2 = $actionmsg2; // Short text
- $object->fk_element = $object->id;
- $object->elementtype = $object->element;
-
- // Appel des triggers
- include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- $interface = new Interfaces($db);
- $result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf);
- if ($result < 0) {
- $error++;
- $object->errors = $interface->errors;
- }
- // Fin appel triggers
-
- if ($error) {
- dol_print_error($db);
- } else {
- // Redirect here
- // This avoid sending mail twice if going out and then back to page
- $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
- setEventMessage($mesg);
- header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id);
- exit();
- }
- } else {
- $langs->load("other");
-
- if ($mailfile->error) {
- $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto);
- $mesg .= ' ' . $mailfile->error;
- } else {
- $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
- }
-
- setEventMessage($mesg, 'errors');
- }
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
- dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
- }
- } else {
- $langs->load("other");
- setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Invoice")), 'errors');
- dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.');
- }
-
- $action = 'presend';
-}
/*
* Generate document
*/
-else if ($action == 'builddoc') // En get ou en post
+if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
$object->fetch_thirdparty();
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index 1699656acb1..47a6ee8ba74 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -38,6 +38,9 @@ $langs->load("bills");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'banque', '','');
+$search_ref = GETPOST('search_ref','int');
+$search_account = GETPOST('search_account','int');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -57,6 +60,16 @@ $formother = new FormOther($db);
$checkdepositstatic=new RemiseCheque($db);
$accountstatic=new Account($db);
+// If click on purge search criteria ?
+if (GETPOST("button_removefilter_x"))
+{
+ $search_ref='';
+ $search_amount='';
+ $search_account='';
+ $year='';
+ $month='';
+}
+
/*
* View
*/
@@ -72,9 +85,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
$sql.= " AND bc.entity = ".$conf->entity;
// Search criteria
-if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int');
-if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int');
-if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount"));
+if ($search_ref) $sql.=" AND bc.number=".$search_ref;
+if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
+if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($month > 0)
{
if ($year > 0 && empty($day))
@@ -103,7 +116,7 @@ if ($resql)
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
- print '';
}
@@ -229,13 +230,20 @@ if ($id)
if ($action == '')
{
- if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit)
+ if ($bon->statut == 2 && $lipre->statut == 2)
{
- print "id\">".$langs->trans("StandingOrderReject")." ";
+ if ($user->rights->prelevement->bons->credit)
+ {
+ print "id\">".$langs->trans("StandingOrderReject")." ";
+ }
+ else
+ {
+ print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")." ";
+ }
}
else
{
- print "".$langs->trans("StandingOrderReject")." ";
+ print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")." ";
}
}
@@ -256,7 +264,7 @@ if ($id)
* Liste des factures
*/
$sql = "SELECT pf.rowid";
- $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc";
+ $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut";
$sql.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@@ -287,7 +295,7 @@ if ($id)
print"\n\n";
print '';
print '';
- print ''.$langs->trans("Invoice").' '.$langs->trans("ThirdParty").' '.$langs->trans("Amount").' ';
+ print ''.$langs->trans("Invoice").' '.$langs->trans("ThirdParty").' '.$langs->trans("Amount").' '.$langs->trans("Status").' ';
print ' ';
$var=True;
@@ -312,6 +320,11 @@ if ($id)
print ''.price($obj->total_ttc)." \n";
+ print '';
+ $invoicestatic->fetch($obj->facid);
+ print $invoicestatic->getLibStatut(5);
+ print " \n";
+
print "\n";
$i++;
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index 10fb995c023..0a68aa686ae 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -42,10 +42,10 @@ $result = restrictedArea($user, 'prelevement','','','bons');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
-$search_line = GETPOST('search_ligne','alpha');
+$search_line = GETPOST('search_line','alpha');
$search_bon = GETPOST('search_bon','alpha');
$search_code = GETPOST('search_code','alpha');
-$search_societe = GETPOST('search_societe','alpha');
+$search_company = GETPOST('search_company','alpha');
$statut = GETPOST('statut','int');
$bon=new BonPrelevement($db,"");
@@ -53,7 +53,14 @@ $ligne=new LignePrelevement($db,$user);
$offset = $conf->liste_limit * $page ;
-
+if (GETPOST("button_removefilter"))
+{
+ $search_line="";
+ $search_bon="";
+ $search_code="";
+ $search_company="";
+ $statut="";
+}
/*
* View
@@ -88,9 +95,9 @@ if ($search_code)
{
$sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
}
-if ($search_societe)
+if ($search_company)
{
- $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
+ $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
}
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($conf->liste_limit+1, $offset);
@@ -122,15 +129,17 @@ if ($result)
print '';
$var=True;
diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php
index b2fc3e1b4a3..17c3efdbfaa 100644
--- a/htdocs/compta/salaries/index.php
+++ b/htdocs/compta/salaries/index.php
@@ -33,6 +33,9 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', '');
+$search_ref = GETPOST('search_ref','int');
+$search_label = GETPOST('search_label','alpha');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -61,6 +64,14 @@ else
$typeid=$_REQUEST['typeid'];
}
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_label="";
+ $search_amount="";
+ $typeid="";
+}
+
/*
* View
*/
@@ -78,8 +89,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
-if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'";
-if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount"));
+
+// Search criteria
+if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
+if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'";
+if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
@@ -118,19 +132,23 @@ if ($result)
print "\n";
print '';
+ // Ref
+ print '';
+ print ' ';
+ print ' ';
print ' ';
- print ' ';
- print ' ';
+ // Label
+ print ' ';
print ' ';
// Type
print '';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print ' ';
- print ' ';
- print '';
- print ' ';
- print ' ';
- print " \n";
+ // Amount
+ print ' ';
+ print ' ';
+ print ' ';
+ print " \n";
while ($i < min($num,$limit))
{
diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php
index 022aaf14ff0..db4bef2abe6 100644
--- a/htdocs/compta/sociales/index.php
+++ b/htdocs/compta/sociales/index.php
@@ -36,6 +36,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
+$search_ref = GETPOST('search_ref','int');
+$search_label = GETPOST('search_label','alpha');
+$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
@@ -65,6 +68,15 @@ else
$typeid=$_REQUEST['typeid'];
}
+if (GETPOST("button_removefilter"))
+{
+ $search_ref="";
+ $search_label="";
+ $search_amount="";
+ $typeid="";
+ $year="";
+ $month="";
+}
/*
* View
@@ -85,7 +97,11 @@ $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity;
-if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'";
+
+// Search criteria
+if ($search_ref) $sql.=" AND cs.rowid=".$search_ref;
+if ($search_label) $sql.=" AND cs.libelle LIKE '%".$db->escape($search_label)."%'";
+if ($search_amount) $sql.=" AND cs.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($year > 0)
{
$sql .= " AND (";
@@ -139,10 +155,8 @@ if ($resql)
{
print '