Merge remote-tracking branch 'Upstream/develop' into develop-admin

This commit is contained in:
aspangaro 2014-11-12 07:08:29 +01:00
commit b4c0e39b6d
238 changed files with 4089 additions and 3399 deletions

View File

@ -53,12 +53,14 @@ before_script:
- sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo Mysql version
- mysql --version
- echo Init database - echo Init database
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.4.0.sql; fi" - sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
- echo Create config file htdocs/conf/conf.php - echo Create config file htdocs/conf/conf.php
- echo '<?php ' > htdocs/conf/conf.php - echo '<?php ' > htdocs/conf/conf.php
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
@ -88,12 +90,12 @@ before_script:
script: script:
- cd htdocs/install - cd htdocs/install
- date - date
- php upgrade.php 3.4.0 3.5.0 > upgrade.log # - php upgrade.php 3.4.0 3.5.0 > upgrade.log
- php upgrade2.php 3.4.0 3.5.0 > upgrade2.log # - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log - php upgrade.php 3.5.0 3.6.0 >> upgrade.log
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log - php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log - php upgrade.php 3.6.0 3.7.0 >> upgrade.log
# - cat upgrade.log # - cat upgrade360370.log
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
# - cat upgrade2.log # - cat upgrade2.log
- cd ../.. - cd ../..

View File

@ -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: 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: PHP libraries:
AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package) AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management 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 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) 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) 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 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 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 PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
TCPDF 6.0.093 LGPL-3+ Yes PDF generation TCPDF 6.0.093 LGPL-3+ Yes PDF generation
JS libraries: JS libraries:
jQuery 1.8.2 MIT License Yes JS library 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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) jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
For licenses compatibility informations: For licenses compatibility informations:
http://www.fsf.org/licensing/licenses/index_html http://www.fsf.org/licensing/licenses/index_html

View File

@ -99,6 +99,7 @@ For users:
- Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1506, #1507 ] ECM trigger error problem
- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
- Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe.
- Fix: [ bug #1535 ] Supplier invoice Extrafields are not shown
For users, new experimental module (need to set feature level of instance to experimental to see them): For users, new experimental module (need to set feature level of instance to experimental to see them):
- New: Module Accounting Expert to manage accountancy - New: Module Accounting Expert to manage accountancy
@ -163,18 +164,20 @@ Dolibarr better:
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
- Fix: bug 1588 : relative discount - Fix: bug 1588 : relative discount.
- Fix: label of input method not tranlated. - Fix: label of input method not tranlated.
- Fix: box of customer and propsects were not correctly disabled. - 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: [ 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.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:
- Fix: Can upload files on services. - Fix: Can upload files on services.
- Fix: sql errors on updat fichinter. - Fix: sql errors on update fichinter.
- Fix: debian script syntax error. - Fix: debian script syntax error.
- Fix: error "menu param is not inside list" into pos module. - Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets. - Fix: Salary payments are not reflected on the reporting sheets.
@ -310,6 +313,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. - 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 ***** ***** ChangeLog for 3.5.5 compared to 3.5.4 *****
Fix: Holiday module was broken. Initializaion of amount of holidays failed. 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. Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.

View File

@ -446,6 +446,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;

View File

@ -108,7 +108,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="80" /> <property name="complexity" value="80" />
<property name="absoluteComplexity" value="200" /> <property name="absoluteComplexity" value="250" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) ---Put here your own copyright and developer email---
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -79,7 +80,7 @@ class Skeleton_Class extends CommonObject
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mytable("; $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
$sql.= " field1,"; $sql.= " field1,";
$sql.= " field2"; $sql.= " field2";
//... //...
@ -91,13 +92,13 @@ class Skeleton_Class extends CommonObject
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) if (! $error)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."mytable"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
if (! $notrigger) if (! $notrigger)
{ {
@ -116,7 +117,7 @@ class Skeleton_Class extends CommonObject
{ {
foreach($this->errors as $errmsg) foreach($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();
@ -145,7 +146,7 @@ class Skeleton_Class extends CommonObject
$sql.= " t.field1,"; $sql.= " t.field1,";
$sql.= " t.field2"; $sql.= " t.field2";
//... //...
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; if ($ref) $sql.= " WHERE t.ref = '".$ref."'";
else $sql.= " WHERE t.rowid = ".$id; else $sql.= " WHERE t.rowid = ".$id;
@ -195,7 +196,7 @@ class Skeleton_Class extends CommonObject
// Put here code to add a control on parameters values // Put here code to add a control on parameters values
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."mytable SET"; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").","; $sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").",";
$sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null").""; $sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null")."";
//... //...
@ -203,7 +204,7 @@ class Skeleton_Class extends CommonObject
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::update"); dol_syslog(__METHOD__);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
@ -226,7 +227,7 @@ class Skeleton_Class extends CommonObject
{ {
foreach($this->errors as $errmsg) foreach($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();
@ -270,10 +271,10 @@ class Skeleton_Class extends CommonObject
if (! $error) if (! $error)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable"; $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete"); dol_syslog(__METHOD__);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
} }
@ -283,7 +284,7 @@ class Skeleton_Class extends CommonObject
{ {
foreach($this->errors as $errmsg) foreach($this->errors as $errmsg)
{ {
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();

View File

@ -37,6 +37,11 @@ $mesg = '';
$action = GETPOST('action'); $action = GETPOST('action');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', '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 // Security check
if (!$user->admin) 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 * 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 .= " WHERE aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $pcgver; $sql .= " AND asy.rowid = " . $pcgver;
if (strlen(trim($_GET["search_account"]))) { if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'"; $sql .= " AND aa.account_number like '%" . $search_account . "%'";
} }
if (strlen(trim($_GET["search_label"]))) { if (strlen(trim($search_label))) {
$sql .= " AND aa.label like '%" . $_GET["search_label"] . "%'"; $sql .= " AND aa.label like '%" . $search_label . "%'";
} }
if (strlen(trim($_GET["search_accountparent"]))) { if (strlen(trim($search_accountparent))) {
$sql .= " AND aa.account_parent like '%" . $_GET["search_accountparent"] . "%'"; $sql .= " AND aa.account_parent like '%" . $search_accountparent . "%'";
} }
if (strlen(trim($_GET["search_pcgtype"]))) { if (strlen(trim($search_pcgtype))) {
$sql .= " AND aa.pcg_type like '%" . $_GET["search_pcgtype"] . "%'"; $sql .= " AND aa.pcg_type like '%" . $search_pcgtype . "%'";
} }
if (strlen(trim($_GET["search_pcgsubtype"]))) { if (strlen(trim($search_pcgsubtype))) {
$sql .= " AND aa.pcg_subtype like '%" . $_GET["search_pcgsubtype"] . "%'"; $sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
} }
$sql .= $db->order($sortfield, $sortorder); $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("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("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($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("&nbsp;"); print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . GETPOST("search_account") . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . GETPOST("search_label") . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . GETPOST("search_accountparent") . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . $search_accountparent . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . GETPOST("search_pcgtype") . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . GETPOST("search_pcgsubtype") . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -180,11 +196,13 @@ if ($result) {
} }
print '</td>'; print '</td>';
print '<td>'; // Action
print '<td align="center">';
if ($user->admin) { if ($user->admin) {
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">'; print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;'; print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">'; print '<a href="./card.php?action=delete&id=' . $obj->rowid . '">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';

View File

@ -181,11 +181,6 @@ else if ($id)
if ($action == 'update') if ($action == 'update')
{ {
// WYSIWYG Editor
$htmlacc = new FormVentilation($db);
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$soc = new Societe($db); $soc = new Societe($db);
if ($object->socid) { if ($object->socid) {
$soc->fetch($object->socid); $soc->fetch($object->socid);

View File

@ -35,8 +35,6 @@ $langs->load("accounting");
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');
$piece_num = GETPOST("piece_num"); $piece_num = GETPOST("piece_num");
@ -238,7 +236,9 @@ if ($action == 'create') {
print '<input type="submit" class="butAction" value="' . $langs->trans("Save") . '">'; print '<input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
print '</form>'; print '</form>';
} else { }
else
{
$book = new BookKeeping($db); $book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num); $result = $book->fetch_per_mvt($piece_num);
if ($result < 0) { if ($result < 0) {
@ -309,14 +309,12 @@ if ($action == 'create') {
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>'; print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>'; print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
if ($user->rights->accounting->access) { print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
}
print '</form>'; print '</form>';
print '</td>'; print '</td>';
} else { }
else {
print '<td>' . $line->numero_compte . '</td>'; print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>'; print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
@ -326,14 +324,13 @@ if ($action == 'create') {
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
if ($user->rights->accouting->access) { print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; print img_edit();
print img_edit(); print '</a>&nbsp;';
print '</a>&nbsp;'; print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; print img_delete();
print img_delete(); print '</a>';
print '</a>';
}
print '</td>'; print '</td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -359,14 +356,13 @@ if ($action == 'create') {
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>'; print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>'; print '</tr>';
} }
print "</table>"; print "</table>";
} }
} }
} else { }
else {
print_fiche_titre($langs->trans("NoRecords")); print_fiche_titre($langs->trans("NoRecords"));
} }
} }

View File

@ -36,6 +36,11 @@ $page = GETPOST("page");
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield"); $sortfield = GETPOST("sortfield");
$action = GETPOST('action', 'alpha'); $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 == "") if ($sortorder == "")
$sortorder = "ASC"; $sortorder = "ASC";
@ -46,6 +51,15 @@ $offset = $conf->liste_limit * $page;
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
if (GETPOST("button_removefilter"))
{
$search_doc_type="";
$search_doc_ref="";
$search_account="";
$search_thirdparty="";
$search_journal="";
}
/* /*
* Action * 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 = "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"; $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")))) { if (dol_strlen(trim($search_doc_ref))) {
$sql .= " AND bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
} }
} }
if (dol_strlen(trim(GETPOST("search_doc_ref")))) { if (dol_strlen(trim($search_doc_ref))) {
$sql .= " WHERE bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; $sql .= " WHERE bk.doc_ref LIKE '%" . $search_doc_ref . "%'";
} }
if (dol_strlen(trim(GETPOST("search_compte")))) { if (dol_strlen(trim($search_account))) {
$sql .= " WHERE bk.numero_compte LIKE '%" . GETPOST("search_compte") . "%'"; $sql .= " WHERE bk.numero_compte LIKE '%" . $search_account . "%'";
} }
if (dol_strlen(trim(GETPOST("search_tiers")))) { if (dol_strlen(trim($search_thirdparty))) {
$sql .= " WHERE bk.code_tiers LIKE '%" . GETPOST("search_tiers") . "%'"; $sql .= " WHERE bk.code_tiers LIKE '%" . $search_thirdparty . "%'";
} }
if (dol_strlen(trim(GETPOST("search_journal")))) { if (dol_strlen(trim($search_journal))) {
$sql .= " WHERE bk.code_journal LIKE '%" . GETPOST("search_journal") . "%'"; $sql .= " WHERE bk.code_journal LIKE '%" . $search_journal . "%'";
} }
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset); $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset);
@ -149,7 +163,7 @@ else {
print '<input type="submit" class="button" style="float: right;" value="Export CSV" />'; print '<input type="submit" class="button" style="float: right;" value="Export CSV" />';
print '</form>'; print '</form>';
print "<table class=\"noborder\" width=\"100%\">"; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder); 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); 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("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("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("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("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", "", $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", "", "", "", $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", "", "", "", $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($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("&nbsp;"); print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<td><input type="text" name="search_doc_type" value="' . $_GET["search_doc_type"] . '"></td>'; print '<td><input type="text" name="search_doc_type" size="8" value="' . $search_doc_type . '"></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td><input type="text" name="search_doc_ref" value="' . $_GET["search_doc_ref"] . '"></td>'; print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td><input type="text" name="search_compte" value="' . $_GET["search_compte"] . '"></td>'; print '<td><input type="text" name="search_account" size="8" value="' . $search_account . '"></td>';
print '<td><input type="text" name="search_tiers" value="' . $_GET["search_tiers"] . '"></td>'; print '<td><input type="text" name="search_thirdparty" size="8" value="' . $search_thirdparty . '"></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td><input type="text" name="search_journal" size="3" value="' . $_GET["search_journal"] . '"></td>'; print '<td><input type="text" name="search_journal" size="3" value="' . $search_journal . '"></td>';
print '<td align="right">'; print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print '</form>'; print '</form>';
print '</tr>'; print '</tr>';
@ -201,9 +217,9 @@ else {
print '<td align="right">' . price($obj->debit) . '</td>'; print '<td align="right">' . price($obj->debit) . '</td>';
print '<td align="right">' . price($obj->credit) . '</td>'; print '<td align="right">' . price($obj->credit) . '</td>';
print '<td align="right">' . price($obj->montant) . '</td>'; print '<td align="right">' . price($obj->montant) . '</td>';
print '<td>' . $obj->sens . '</td>'; print '<td align="center">' . $obj->sens . '</td>';
print '<td>' . $obj->code_journal . '</td>'; print '<td>' . $obj->code_journal . '</td>';
print '<td><a href="./card.php?piece_num=' . $obj->piece_num . '">' . img_edit() . '</a></td>'; print '<td align="center"><a href="./card.php?piece_num=' . $obj->piece_num . '">' . img_edit() . '</a></td>';
print "</tr>\n"; print "</tr>\n";
$i ++; $i ++;
} }

View File

@ -40,14 +40,12 @@ $id = GETPOST('id');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
/* /*
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->access) if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
{ {
if (! GETPOST('cancel', 'alpha')) if (! GETPOST('cancel', 'alpha'))
{ {
@ -109,7 +107,7 @@ if (! empty($id)) {
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup'); print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -93,8 +93,8 @@ if ($action == 'validatehistory') {
*/ */
llxHeader('', $langs->trans("CustomersVentilation")); llxHeader('', $langs->trans("CustomersVentilation"));
$textprevyear = "<a href=\"index.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>"; $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = " <a href=\"index.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>"; $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
@ -197,7 +197,7 @@ print "</table>\n";
print "<br>\n"; print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>'; print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>'; print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>'; print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
@ -212,7 +212,7 @@ print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>'; print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
$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)=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)=2,fd.total_ht,0)),2) AS 'Fevrier',";
$sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',";

View File

@ -68,8 +68,6 @@ $action = GETPOST('action');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
/* /*
* View * View

View File

@ -62,8 +62,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -36,8 +36,6 @@ $langs->load("accountancy");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
llxHeader('', 'Journaux', ''); llxHeader('', 'Journaux', '');

View File

@ -55,8 +55,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -56,8 +56,6 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -46,10 +46,9 @@ $codeventil = GETPOST('codeventil');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); 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 = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
@ -103,7 +102,7 @@ if ($_GET["id"]) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print_fiche_titre($langs->trans("Ventilation")); print_fiche_titre($langs->trans("SuppliersVentilation"));
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';

View File

@ -92,10 +92,10 @@ if ($action == 'validatehistory') {
llxHeader('', $langs->trans("SuppliersVentilation")); llxHeader('', $langs->trans("SuppliersVentilation"));
$textprevyear = "<a href=\"index.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>"; $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = " <a href=\"index.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>"; $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
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 '<b>' . $langs->trans("DescVentilSupplier") . '</b>'; print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>';

View File

@ -7,7 +7,7 @@
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * 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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/ */
/** /**

View File

@ -723,7 +723,7 @@ else
{ {
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Fiche creation */ /* Creation card */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
$object->canvas=$canvas; $object->canvas=$canvas;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 $text Content of message (not html entities encoded)
* @param string $subject Subject of message * @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 * @return string Label
*/ */
function getmorphylib($morphy='') function getmorphylib($morphy='')

View File

@ -165,6 +165,16 @@ else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
exit; 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 '</table>'; print '</table>';
print '</form>'; print '</form>';
//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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("MinLength")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[0].'" id="minlenght" min="1"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbMajMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[1].'" id="NbMajMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbNumMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[2].'" id="NbNumMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbSpeMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[3].'" id="NbSpeMin" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NbIteConsecutive")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[4].'" id="NbIteConsecutive" min="0"></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>";
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2"></td><td width="103" align="center"><a id="linkChangePattern">'.$langs->trans("Save").'</a></td>';
print '</tr>';
print '</table>';
print '<script type="text/javascript">';
print ' function getStringArg(){';
print ' var pattern = "";';
print ' pattern += $("#minlenght").val() + ";";';
print ' pattern += $("#NbMajMin").val() + ";";';
print ' pattern += $("#NbNumMin").val() + ";";';
print ' pattern += $("#NbSpeMin").val() + ";";';
print ' pattern += $("#NbIteConsecutive").val() + ";";';
print ' pattern += $("#NoAmbiCaracAutoGeneration")[0].checked ? "1" : "0";';
print ' return pattern;';
print ' }';
print ' function valuePossible(){';
print ' var length = parseInt($("#minlenght").val());';
print ' var length_mini = parseInt($("#NbMajMin").val()) + parseInt($("#NbNumMin").val()) + parseInt($("#NbSpeMin").val());';
print ' return length >= length_mini;';
print ' }';
print ' function generatelink(){';
print ' return "security.php?action=maj_pattern&pattern="+getStringArg();';
print ' }';
print ' function valuePatternChange(){';
print ' var lang_save = "'.$langs->trans("Save").'";';
print ' var lang_error = "'.$langs->trans("Error").'";';
print ' var lang_Disabled = "'.$langs->trans("Disabled").'";';
print ' var lang_Activated = "'.$langs->trans("Activated").'";';
print ' $("#textcheckbox").html($("#NoAmbiCaracAutoGeneration")[0].checked ? unescape(lang_Activated) : unescape(lang_Disabled));';
print ' if(valuePossible()){';
print ' $("#linkChangePattern").attr("href",generatelink()).text(lang_save);';
print ' }';
print ' else{';
print ' $("#linkChangePattern").attr("href", null).text(lang_error);';
print ' }';
print ' }';
print ' $("#minlenght").change(function(){valuePatternChange();});';
print ' $("#NbMajMin").change(function(){valuePatternChange();});';
print ' $("#NbNumMin").change(function(){valuePatternChange();});';
print ' $("#NbSpeMin").change(function(){valuePatternChange();});';
print ' $("#NbIteConsecutive").change(function(){valuePatternChange();});';
print ' $("#NoAmbiCaracAutoGeneration").change(function(){valuePatternChange();});';
print '</script>';
}
// Cryptage mot de passe // Cryptage mot de passe
print '<br>'; print '<br>';
$var=true; $var=true;

View File

@ -277,20 +277,14 @@ if ($object->id > 0)
print '<tr><td width="30%" nowrap>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td width="30%" nowrap>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; dol_fiche_end();
$modulepart = 'actions';
$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') if ($action != 'edit')
{ {
print "<br>";
// Link to agenda views // Link to agenda views
print '<div id="agendaviewbutton">'; print '<div id="agendaviewbutton">';
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
@ -330,13 +324,23 @@ if ($object->id > 0)
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';
print '<div style="clear: both"></div>';
print "<br><br>";
} }
$modulepart = 'actions';
$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';
} }
else else
{ {
print $langs->trans("ErrorUnknown"); print $langs->trans("ErrorUnknown");
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -99,6 +99,13 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi
$filterd=$user->id; $filterd=$user->id;
} }
// Purge search criteria
if (GETPOST("button_removefilter"))
{
$datestart='';
$dateend='';
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('agendalist')); $hookmanager->initHooks(array('agendalist'));
@ -278,8 +285,7 @@ if ($resql)
//print '<td class="liste_titre"></td>'; //print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
//print '&nbsp; '; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
//print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -1008,8 +1008,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($output[0]['color']) $color2 = $output[0]['color']; if ($output[0]['color']) $color2 = $output[0]['color'];
} }
else if (count($cases2[$h]) > 1) $color2='222222'; else if (count($cases2[$h]) > 1) $color2='222222';
$ids1=join(',',array_keys($cases1[$h])); $ids1='';$ids2='';
$ids2=join(',',array_keys($cases2[$h])); if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
//var_dump($cases1[$h]); //var_dump($cases1[$h]);
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>'; print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>';

View File

@ -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 * Send mail
*/ */
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
$langs->load('mails');
if ($object->id > 0) { // Actions to send emails
if ($_POST['sendto']) { $actiontypecode='AC_PROP';
// Le destinataire a ete fourni via le champ libre $trigger_name='PROPAL_SENTBYMAIL';
$sendto = $_POST['sendto']; $paramname='id';
$sendtoid = 0; $mode='emailfromproposal';
} elseif ($_POST['receiver'] != '-1') { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// 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_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 .= '<br>' . $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 // Go back to draft
if ($action == 'modif' && $user->rights->propal->creer) if ($action == 'modif' && $user->rights->propal->creer)

View File

@ -322,7 +322,9 @@ if ($result)
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$formpropal->selectProposalStatus($viewstatut,1); $formpropal->selectProposalStatus($viewstatut,1);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right">';
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -48,7 +48,6 @@ $search_state = GETPOST("search_state");
$search_datec = GETPOST("search_datec"); $search_datec = GETPOST("search_datec");
$search_categ = GETPOST("search_categ",'int'); $search_categ = GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int'); $search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$catid = GETPOST("catid",'int'); $catid = GETPOST("catid",'int');
$sortfield = GETPOST("sortfield",'alpha'); $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 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist')); $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 * Actions
@ -361,7 +375,7 @@ if ($resql)
// Print these two select // Print these two select
print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>'; print $langs->trans("From").' <select class="flat" name="search_level_from">'.$options_from.'</select>';
print ' '; print ' ';
print $langs->trans("To").' <select class="flat" name="search_level_to">'.$options_to.'</select>'; print $langs->trans("to").' <select class="flat" name="search_level_to">'.$options_to.'</select>';
print '</td>'; print '</td>';
@ -378,9 +392,9 @@ if ($resql)
print '</td>'; print '</td>';
// Print the search button // Print the search button
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input class="liste_titre" name="button_search" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print "</td></tr>\n";
$parameters=array(); $parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -1151,162 +1151,18 @@ else if ($action == 'update_extras') {
$action = 'edit_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 * Send mail
*/ */
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
$langs->load('mails');
if ($object->id > 0) { // Actions to send emails
// $ref = dol_sanitizeFileName($object->ref); $actiontypecode='AC_COM';
// $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $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 .= '<br>' . $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 (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
if ($action == 'addcontact') { if ($action == 'addcontact') {

View File

@ -43,9 +43,9 @@ $orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int"); $ordermonth=GETPOST("ordermonth","int");
$deliveryyear=GETPOST("deliveryyear","int"); $deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int"); $deliverymonth=GETPOST("deliverymonth","int");
$sref=GETPOST('sref','alpha'); $search_ref=GETPOST('search_ref','alpha');
$sref_client=GETPOST('sref_client','alpha'); $search_ref_customer=GETPOST('search_ref_customer','alpha');
$snom=GETPOST('snom','alpha'); $search_company=GETPOST('search_company','alpha');
$sall=GETPOST('sall'); $sall=GETPOST('sall');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int'); $search_user=GETPOST('search_user','int');
@ -69,6 +69,20 @@ $limit = $conf->liste_limit;
$viewstatut=GETPOST('viewstatut'); $viewstatut=GETPOST('viewstatut');
// Purge search criteria
if (GETPOST("button_removefilter"))
{
$search_categ='';
$search_user='';
$search_sale='';
$search_ref='';
$search_ref_customer='';
$search_company='';
$orderyear='';
$ordermonth='';
$deliverymonth='';
$deliveryyear='';
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('orderlist')); $hookmanager->initHooks(array('orderlist'));
@ -81,24 +95,6 @@ $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
{
$search_categ='';
$search_user='';
$search_sale='';
$search_ref='';
$search_refcustomer='';
$search_societe='';
$search_montant_ht='';
$orderyear='';
$ordermonth='';
$deliverymonth='';
$deliveryyear='';
}
/* /*
* View * View
*/ */
@ -128,8 +124,8 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
$sql.= ' AND c.entity = '.$conf->entity; $sql.= ' AND c.entity = '.$conf->entity;
if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($socid) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($sref) { if ($search_ref) {
$sql .= natural_search('c.ref', $sref); $sql .= natural_search('c.ref', $search_ref);
} }
if ($sall) if ($sall)
{ {
@ -188,13 +184,13 @@ else if ($deliveryyear > 0)
{ {
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'"; $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
} }
if (!empty($snom)) if (!empty($search_company))
{ {
$sql .= natural_search('s.nom', $snom); $sql .= natural_search('s.nom', $search_company);
} }
if (!empty($sref_client)) if (!empty($search_ref_customer))
{ {
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\'';
} }
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0) if ($search_user > 0)
@ -246,15 +242,15 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param='&socid='.$socid.'&viewstatut='.$viewstatut; $param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($ordermonth) $param.='&ordermonth='.$ordermonth;
if ($orderyear) $param.='&orderyear='.$orderyear; if ($orderyear) $param.='&orderyear='.$orderyear;
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth; if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth;
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear; if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear;
if ($sref) $param.='&sref='.$sref; if ($search_ref) $param.='&search_ref='.$search_ref;
if ($snom) $param.='&snom='.$snom; if ($search_company) $param.='&search_company='.$search_company;
if ($sref_client) $param.='&sref_client='.$sref_client; if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_user > 0) $param.='&search_user='.$search_user;
if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_sale > 0) $param.='&search_sale='.$search_sale;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
@ -294,33 +290,35 @@ if ($resql)
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="sref" value="'.$sref.'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="sref_client" value="'.$sref_client.'">'; print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">'; print '<input class="flat" type="text" name="search_company" value="'.$search_company.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">';
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
print '</td><td class="liste_titre">'; print '</td><td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
print '</td><td class="liste_titre">&nbsp;'; print '</td>';
print '</td><td align="right" class="liste_titre">'; print '<td class="liste_titre">&nbsp;</td>';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td></tr>'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$var=true; $var=true;
$total=0; $total=0;
@ -443,12 +441,12 @@ if ($resql)
print '</td>'; print '</td>';
// Order date // Order date
print '<td align="right">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->date_commande), 'day'); print dol_print_date($db->jdate($objp->date_commande), 'day');
print '</td>'; print '</td>';
// Delivery date // Delivery date
print '<td align="right">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->date_livraison), 'day'); print dol_print_date($db->jdate($objp->date_livraison), 'day');
print '</td>'; print '</td>';

View File

@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
$langs->load("banks"); $langs->load("banks");
$langs->load("categories"); $langs->load("categories");
$langs->load("companies"); $langs->load("companies");
$langs->load("margins");
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -72,6 +73,15 @@ $limit = $conf->liste_limit;
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='b.dateo'; if (! $sortfield) $sortfield='b.dateo';
if (GETPOST("button_removefilter"))
{
$description="";
$type="";
$debit="";
$credit="";
$account="";
$bid="";
}
/* /*
* View * View
@ -198,7 +208,7 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$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 '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -214,9 +224,9 @@ if ($resql)
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="hidden" name="action" value="search">'; print '<input type="hidden" name="action" value="search">';
if (! empty($_REQUEST['bid'])) print '<input type="hidden" name="bid" value="'.$_REQUEST["bid"].'">'; if (! empty($_REQUEST['bid'])) print '<input type="hidden" name="bid" value="'.$_REQUEST["bid"].'">';
print '<input type="image" class="liste_titre" name="submit" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</tr>'; print "</td></tr>\n";
// Loop on each record // Loop on each record
$total_debit=0; $total_debit=0;

View File

@ -27,6 +27,8 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.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.'/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("companies");
$langs->load("users"); $langs->load("users");
@ -37,6 +39,10 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'deplacement','',''); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -48,13 +54,24 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.dated"; if (! $sortfield) $sortfield="d.dated";
$limit = $conf->liste_limit; $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 * View
*/ */
$formother = new FormOther($db);
$tripandexpense_static=new Deplacement($db); $tripandexpense_static=new Deplacement($db);
$userstatic = new User($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 (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 (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; 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 d.dated 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->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
@ -97,7 +135,7 @@ if ($resql)
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder); 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("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("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("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); 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 // Filters lines
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">'; print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">'; print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre">';
print '&nbsp;'; print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '&nbsp;'; // print '<input class="flat" size="10" type="text" name="search_amount" value="'.$search_amount.'">';
print '</td>';
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n"; print "</td></tr>\n";
$var=true; $var=true;
@ -142,9 +183,9 @@ if ($resql)
// Type // Type
print '<td>'.$langs->trans($obj->type).'</td>'; print '<td>'.$langs->trans($obj->type).'</td>';
// Date // Date
print '<td>'.dol_print_date($db->jdate($obj->dd),'day').'</td>'; print '<td align="center">'.dol_print_date($db->jdate($obj->dd),'day').'</td>';
// User // User
print '<td align="left">'; print '<td>';
$userstatic->id = $obj->rowid; $userstatic->id = $obj->rowid;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname; $userstatic->firstname = $obj->firstname;

View File

@ -43,12 +43,20 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
$search_ref=GETPOST('search_ref'); $search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company'); $search_company=GETPOST('search_company','alpha');
$search_name=GETPOST('search_name'); $search_name=GETPOST('search_name','alpha');
$search_amount = GETPOST('search_amount','alpha');
if (!$user->rights->don->lire) accessforbidden(); if (!$user->rights->don->lire) accessforbidden();
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_company="";
$search_name="";
$search_amount="";
}
/* /*
* View * View
@ -82,6 +90,8 @@ if (trim($search_name) != '')
{ {
$sql .= natural_search(array('d.lastname', 'd.firstname'), $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->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
@ -141,11 +151,10 @@ if ($resql)
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td></tr>\n"; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$var=True; $var=True;
while ($i < min($num,$limit)) while ($i < min($num,$limit))

View File

@ -1550,178 +1550,24 @@ if (GETPOST('linkedOrder')) {
$result = $object->add_object_linked('commande', 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 * Send mail
*/ */
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) {
$langs->load('mails');
$actiontypecode = ''; // Actions to send emails
$subject = ''; if (empty($id)) $id=$facid;
$actionmsg = ''; $actiontypecode='AC_FAC';
$actionmsg2 = ''; $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 .= '<br>' . $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 * Generate document
*/ */
else if ($action == 'builddoc') // En get ou en post if ($action == 'builddoc') // En get ou en post
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$langs->load('bills'); $langs->load('bills');
$langs->load('compta');
// Security check // Security check
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); $id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));

View File

@ -90,6 +90,7 @@ else
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">'; //print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref"; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref";
$sql.= ", bc.statut, bc.nbcheque"; $sql.= ", bc.statut, bc.nbcheque";
@ -98,8 +99,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rowid = bc.fk_bank_account"; $sql.= " WHERE ba.rowid = bc.fk_bank_account";
$sql.= " AND bc.entity = ".$conf->entity; $sql.= " AND bc.entity = ".$conf->entity;
$sql.= " ORDER BY bc.rowid"; $sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql.= " DESC LIMIT 10"; $sql.= $db->plimit($max);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -107,7 +108,7 @@ if ($resql)
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("CheckReceiptShort").'</td>'; print '<td>'.$langs->trans("LastCheckReceiptShort",$max).'</td>';
print '<td>'.$langs->trans("Date")."</td>"; print '<td>'.$langs->trans("Date")."</td>";
print '<td>'.$langs->trans("Account").'</td>'; print '<td>'.$langs->trans("Account").'</td>';
print '<td align="right">'.$langs->trans("NbOfCheques").'</td>'; print '<td align="right">'.$langs->trans("NbOfCheques").'</td>';

View File

@ -38,6 +38,9 @@ $langs->load("bills");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'banque', '',''); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -57,6 +60,16 @@ $formother = new FormOther($db);
$checkdepositstatic=new RemiseCheque($db); $checkdepositstatic=new RemiseCheque($db);
$accountstatic=new Account($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 * View
*/ */
@ -72,9 +85,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
$sql.= " AND bc.entity = ".$conf->entity; $sql.= " AND bc.entity = ".$conf->entity;
// Search criteria // Search criteria
if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int'); if ($search_ref) $sql.=" AND bc.number=".$search_ref;
if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int'); if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount")); if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($month > 0) if ($month > 0)
{ {
if ($year > 0 && empty($day)) 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_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder);
@ -117,7 +130,7 @@ if ($resql)
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.GETPOST('search_ref').'">'; print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
@ -125,16 +138,15 @@ if ($resql)
$formother->select_year($year?$year:-1,'year',1, 20, 5); $formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); $form->select_comptes($search_account,'search_account',0,'',1);
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input class="fat" type="text" size="6" name="search_amount" value="'.GETPOST('search_amount').'">'; print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print "</td></tr>\n";
print "</tr>\n";
$var=true; $var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))

View File

@ -42,6 +42,11 @@ $paymentstatic=new Paiement($db);
$accountstatic=new Account($db); $accountstatic=new Account($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
$search_ref=GETPOST("search_ref","int");
$search_account=GETPOST("search_account","int");
$search_paymenttype=GETPOST("search_paymenttype");
$search_amount=GETPOST("search_amount");
$search_company=GETPOST("search_company");
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -53,8 +58,14 @@ $limit = $conf->liste_limit;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.rowid"; if (! $sortfield) $sortfield="p.rowid";
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_account="";
$search_amount="";
$search_paymenttype="";
$search_company="";
}
/* /*
* View * View
@ -110,11 +121,11 @@ else
else $sql.= " AND f.fk_user_author = ".$userid; else $sql.= " AND f.fk_user_author = ".$userid;
} }
// Search criteria // Search criteria
if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int'); if ($search_ref) $sql .=" AND p.rowid=".$search_ref;
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int'); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'"; if ($search_paymenttype != "") $sql .=" AND c.code='".$search_paymenttype."'";
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount")); if ($search_amount) $sql .=" AND p.amount='".price2num($search_amount)."'";
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company')); if ($search_company) $sql .= natural_search('s.nom', $search_company);
} }
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
@ -129,9 +140,9 @@ if ($resql)
$paramlist=''; $paramlist='';
$paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); $paramlist.=(GETPOST("orphelins")?"&orphelins=1":"");
$paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:""); $paramlist.=($search_ref?"&search_ref=".$search_ref:"");
$paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:""); $paramlist.=($search_company?"&search_company=".$search_company:"");
$paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:""); $paramlist.=($search_amount?"&search_amount=".$search_amount:"");
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num);
@ -149,26 +160,29 @@ if ($resql)
{ {
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
} }
print "</tr>\n"; print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
// Lines for filters fields // Lines for filters fields
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="left">'; print '<td align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$_REQUEST["search_ref"].'">'; print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="left">'; print '<td align="left">';
print '<input class="fat" type="text" size="6" name="search_company" value="'.$_REQUEST["search_company"].'">'; print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1); $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); $form->select_comptes($search_account,'search_account',0,'',1);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$_REQUEST["search_amount"].'">'; print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
print '</td><td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{ {
@ -224,6 +238,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -1,103 +0,0 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/prelevement/bon.php
* \ingroup prelevement
* \brief Fiche apercu du bon de prelevement
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("bills");
$langs->load("categories");
// Security check
$socid=0;
$id = GETPOST('id','int');
$ref = GETPOST('ref','alpha');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement', $id);
llxHeader('','Bon de prelevement');
$form = new Form($db);
if ($id > 0 || ! empty($ref))
{
$object = new BonPrelevement($db,"");
if ($object->fetch($id) == 0)
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'preview', 'Prelevement : '. $object->ref);
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$object->ref.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
$relativepath = 'bon/'.$object->ref;
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$object->ref.'</a>';
print '</td></tr>';
print '</table><br>';
$fileimage = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps.png.0';
$fileps = $conf->prelevement->dir_output.'/receipts/'.$object->ref.'.ps';
// Conversion du PDF en image png si fichier png non existant
if (!file_exists($fileimage))
{
if (class_exists("Imagick"))
{
$ret = dol_convert_file($file,'png',$fileimage);
if ($ret < 0) $error++;
}
else
{
$langs->load("errors");
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
}
}
if (file_exists($fileimage))
{
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=prelevement&file='.urlencode(basename($fileimage)).'">';
}
dol_fiche_end();
}
else
{
dol_print_error($db);
}
}
llxFooter();

View File

@ -821,7 +821,9 @@ class BonPrelevement extends CommonObject
{ {
$bac = new CompanyBankAccount($this->db); $bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$soc->id); $bac->fetch(0,$soc->id);
if ($bac->verif() >= 1) if ($bac->verif() >= 1)
//if (true)
{ {
$factures_prev[$i] = $fac; $factures_prev[$i] = $fac;
/* second tableau necessaire pour BonPrelevement */ /* second tableau necessaire pour BonPrelevement */
@ -1226,26 +1228,24 @@ class BonPrelevement extends CommonObject
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
//TODO: Optimize code to read lines in a single function //TODO: Optimize code to read lines in a single function
function Generate() function generate()
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$result = 0; $result = 0;
dol_syslog(get_class($this)."::Generate build file ".$this->filename); dol_syslog(get_class($this)."::generate build file ".$this->filename);
$this->file = fopen($this->filename,"w"); $this->file = fopen($this->filename,"w");
$found=0; $found=0;
// Build file for European countries // Build file for European countries
if (! $mysoc->isInEEC()) if ($mysoc->isInEEC())
{ {
$found++; $found++;
/** /**
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA
*/ */
// SEPA Initialisation // SEPA Initialisation
@ -1308,8 +1308,6 @@ class BonPrelevement extends CommonObject
} }
/** /**
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA
* SECTION CREATION FICHIER SEPA * SECTION CREATION FICHIER SEPA
*/ */
// SEPA File Header // SEPA File Header
@ -1401,11 +1399,14 @@ class BonPrelevement extends CommonObject
} }
} }
else else
{ {
$result = -2; $result = -2;
} }
$langs->load('withdrawals'); $langs->load('withdrawals');
fputs($this->file, $langs->trans('WithdrawalFileNotCapable'));
// TODO Add here code to generate a generic file
fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code));
} }
fclose($this->file); fclose($this->file);

View File

@ -173,7 +173,8 @@ class RejetPrelevement
} }
//Tag invoice as unpaid //Tag invoice as unpaid
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref); dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
$fac->set_unpaid($fac->id, $user);
$fac->set_unpaid($user);
//TODO: Must be managed by notifications module //TODO: Must be managed by notifications module
// Send email to sender of the standing order request // Send email to sender of the standing order request
@ -194,7 +195,7 @@ class RejetPrelevement
} }
/** /**
* Envoi mail * Send email to all users that has asked the withdraw request
* *
* @param Facture $fac Invoice object * @param Facture $fac Invoice object
* @return void * @return void

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks"); $langs->load("banks");
$langs->load("categories"); $langs->load("categories");
$langs->load("widthdrawals"); $langs->load("withdrawals");
$langs->load("companies"); $langs->load("companies");
// Security check // Security check

View File

@ -213,6 +213,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -105,10 +105,13 @@ if ($action == 'confirm_rejet')
} }
} }
/* /*
* View * View
*/ */
$invoicestatic=new Facture($db);
llxHeader('',$langs->trans("StandingOrder")); llxHeader('',$langs->trans("StandingOrder"));
$h = 0; $h = 0;
@ -134,9 +137,7 @@ if ($id)
print '<a href="card.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>'; print '<a href="card.php?id='.$lipre->bon_rowid.'">'.$lipre->bon_ref.'</a></td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut,1).'</td></tr>';
print $lipre->LibStatut($lipre->statut,1).'</td></tr>';
if ($lipre->statut == 3) if ($lipre->statut == 3)
{ {
@ -215,7 +216,7 @@ if ($id)
print '</table><br>'; print '</table><br>';
//Confirm Button //Confirm Button
print '<center><input type="submit" class="valid" value='.$langs->trans("Confirm").'><center>'; print '<center><input type="submit" class="button" value='.$langs->trans("Confirm").'><center>';
print '</form>'; print '</form>';
} }
@ -229,13 +230,20 @@ if ($id)
if ($action == '') if ($action == '')
{ {
if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit) if ($bon->statut == 2 && $lipre->statut == 2)
{ {
print "<a class=\"butAction\" href=\"ligne.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>"; if ($user->rights->prelevement->bons->credit)
{
print "<a class=\"butAction\" href=\"ligne.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
}
else
{
print "<a class=\"butActionRefused\" href=\"#\" title=\"".$langs->trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")."</a>";
}
} }
else else
{ {
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("StandingOrderReject")."</a>"; print "<a class=\"butActionRefused\" href=\"#\" title=\"".$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")."</a>";
} }
} }
@ -256,7 +264,7 @@ if ($id)
* Liste des factures * Liste des factures
*/ */
$sql = "SELECT pf.rowid"; $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.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@ -287,7 +295,7 @@ if ($id)
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Invoice").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>'; print '<td>'.$langs->trans("Invoice").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td><td align="right">'.$langs->trans("Status").'</td>';
print '</tr>'; print '</tr>';
$var=True; $var=True;
@ -312,6 +320,11 @@ if ($id)
print '<td align="right">'.price($obj->total_ttc)."</td>\n"; print '<td align="right">'.price($obj->total_ttc)."</td>\n";
print '<td align="right">';
$invoicestatic->fetch($obj->facid);
print $invoicestatic->getLibStatut(5);
print "</td>\n";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;

View File

@ -42,10 +42,10 @@ $result = restrictedArea($user, 'prelevement','','','bons');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); $sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','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_bon = GETPOST('search_bon','alpha');
$search_code = GETPOST('search_code','alpha'); $search_code = GETPOST('search_code','alpha');
$search_societe = GETPOST('search_societe','alpha'); $search_company = GETPOST('search_company','alpha');
$statut = GETPOST('statut','int'); $statut = GETPOST('statut','int');
$bon=new BonPrelevement($db,""); $bon=new BonPrelevement($db,"");
@ -53,7 +53,14 @@ $ligne=new LignePrelevement($db,$user);
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
if (GETPOST("button_removefilter"))
{
$search_line="";
$search_bon="";
$search_code="";
$search_company="";
$statut="";
}
/* /*
* View * View
@ -88,9 +95,9 @@ if ($search_code)
{ {
$sql.= " AND s.code_client LIKE '%".$db->escape($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->order($sortfield,$sortorder);
$sql.=$db->plimit($conf->liste_limit+1, $offset); $sql.=$db->plimit($conf->liste_limit+1, $offset);
@ -122,15 +129,17 @@ if ($result)
print '<form action="list.php" method="GET">'; print '<form action="list.php" method="GET">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. dol_escape_htmltag($search_line).'" size="6"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" value="'. dol_escape_htmltag($search_societe).'" size="12"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="12"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="8"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="8"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td class="liste_titre" align="right">';
print '</tr>'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</form>'; print '</form>';
$var=True; $var=True;

View File

@ -560,7 +560,7 @@ print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="center" colspan="2">'; print '<td align="center" colspan="2" class="borderrightlight">';
print '<a href="clientfourn.php?year='.$annee.'">'; print '<a href="clientfourn.php?year='.$annee.'">';
print $annee; print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
@ -571,7 +571,7 @@ print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="right">'.$langs->trans("Outcome").'</td>'; print '<td align="right">'.$langs->trans("Outcome").'</td>';
print '<td align="right">'.$langs->trans("Income").'</td>'; print '<td align="right" class="borderrightlight">'.$langs->trans("Income").'</td>';
} }
print '</tr>'; print '</tr>';
@ -601,7 +601,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
} }
print "</td>"; print "</td>";
print '<td align="right">&nbsp;'; print '<td align="right" class="borderrightlight">&nbsp;';
//if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
if (isset($encaiss_ttc[$case])) if (isset($encaiss_ttc[$case]))
{ {
@ -623,7 +623,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
$nbcols+=2; $nbcols+=2;
print '<td align="right">'.(isset($totsorties[$annee])?price(price2num($totsorties[$annee],'MT')):'&nbsp;').'</td>'; print '<td align="right">'.(isset($totsorties[$annee])?price(price2num($totsorties[$annee],'MT')):'&nbsp;').'</td>';
print '<td align="right">'.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):'&nbsp;').'</td>'; print '<td align="right" style="border-right: 1px solid #DDD">'.(isset($totentrees[$annee])?price(price2num($totentrees[$annee],'MT')):'&nbsp;').'</td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -637,7 +637,7 @@ $var=!$var;
print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>'; print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="right" colspan="2"> '; print '<td align="right" colspan="2" class="borderrightlight"> ';
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) if (isset($totentrees[$annee]) || isset($totsorties[$annee]))
{ {
$in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0); $in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0);

View File

@ -33,6 +33,9 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', ''); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -61,6 +64,14 @@ else
$typeid=$_REQUEST['typeid']; $typeid=$_REQUEST['typeid'];
} }
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_label="";
$search_amount="";
$typeid="";
}
/* /*
* View * 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.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user"; $sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity; $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) { if ($filtre) {
$filtre=str_replace(":","=",$filtre); $filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre; $sql .= " AND ".$filtre;
@ -118,19 +132,23 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; // Label
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// Type // Type
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16); $form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>'; // Amount
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</tr>\n"; print "</td></tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {

View File

@ -36,6 +36,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -65,6 +68,15 @@ else
$typeid=$_REQUEST['typeid']; $typeid=$_REQUEST['typeid'];
} }
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_label="";
$search_amount="";
$typeid="";
$year="";
$month="";
}
/* /*
* View * 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.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql.= " WHERE cs.fk_type = c.id"; $sql.= " WHERE cs.fk_type = c.id";
$sql.= " AND cs.entity = ".$conf->entity; $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) if ($year > 0)
{ {
$sql .= " AND ("; $sql .= " AND (";
@ -139,10 +155,8 @@ if ($resql)
{ {
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste" width="100%">';
print "<table class=\"noborder\" width=\"100%\">"; print '<tr class="liste_titre">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
@ -153,20 +167,26 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>'; // Ref
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_label" value="'.GETPOST("search_label").'"></td>'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_label" value="'.$search_label.'"></td>';
// Type // Type
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
$formsocialcontrib->select_type_socialcontrib($typeid,'typeid',1,16,0); $formsocialcontrib->select_type_socialcontrib($typeid,'typeid',1,16,0);
print '</td>'; print '</td>';
// Period end date // Period end date
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; // Amount
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input class="flat" type="text" size="6" name="search_amount" value="'.$search_amount.'">';
print '</td>'; print '</td>';
print "</tr>\n"; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {

View File

@ -184,7 +184,7 @@ print '<tr class="liste_titre"><td>&nbsp;</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
if ($modecompta == 'CREANCES-DETTES') print '<td align="center" width="10%" colspan="3">'; if ($modecompta == 'CREANCES-DETTES') print '<td align="center" width="10%" colspan="3">';
else print '<td align="center" width="10%" colspan="2">'; else print '<td align="center" width="10%" colspan="2" class="borderrightlight">';
print '<a href="casoc.php?year='.$annee.'">'; print '<a href="casoc.php?year='.$annee.'">';
print $annee; print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
@ -198,7 +198,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.$langs->trans("AmountHT").'</td>'; if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.$langs->trans("AmountHT").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("Delta").'</td>'; print '<td align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>';
if ($annee != $year_end) print '<td width="15">&nbsp;</td>'; if ($annee != $year_end) print '<td width="15">&nbsp;</td>';
} }
print '</tr>'; print '</tr>';
@ -266,29 +266,29 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
{ {
$percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print '<td align="right">'.($percent>=0?"+$percent":"$percent").'%</td>'; print '<td align="right" class="borderrightlight">'.($percent>=0?"+$percent":"$percent").'%</td>';
} }
if ($cum[$caseprev] && ! $cum[$case]) if ($cum[$caseprev] && ! $cum[$case])
{ {
print '<td align="right">-100%</td>'; print '<td align="right" class="borderrightlight">-100%</td>';
} }
if (! $cum[$caseprev] && $cum[$case]) if (! $cum[$caseprev] && $cum[$case])
{ {
//print '<td align="right">+Inf%</td>'; //print '<td align="right">+Inf%</td>';
print '<td align="right">-</td>'; print '<td align="right" class="borderrightlight">-</td>';
} }
if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case])
{ {
print '<td align="right">+0%</td>'; print '<td align="right" class="borderrightlight">+0%</td>';
} }
if (! isset($cum[$caseprev]) && ! $cum[$case]) if (! isset($cum[$caseprev]) && ! $cum[$case])
{ {
print '<td align="right">-</td>'; print '<td align="right" class="borderrightlight">-</td>';
} }
} }
else else
{ {
print '<td align="right">'; print '<td align="right" class="borderrightlight">';
if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; }
else { print '&nbsp;'; } else { print '&nbsp;'; }
print '</td>'; print '</td>';
@ -398,24 +398,24 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
if ($total[$annee-1] && $total[$annee]) { if ($total[$annee-1] && $total[$annee]) {
$percent=(round(($total[$annee]-$total[$annee-1])/$total[$annee-1],4)*100); $percent=(round(($total[$annee]-$total[$annee-1])/$total[$annee-1],4)*100);
print '<td align="right" class="nowrap">'.($percent>=0?"+$percent":"$percent").'%</td>'; print '<td align="right" class="nowrap borderrightlight">'.($percent>=0?"+$percent":"$percent").'%</td>';
} }
if ($total[$annee-1] && ! $total[$annee]) if ($total[$annee-1] && ! $total[$annee])
{ {
print '<td align="right">-100%</td>'; print '<td align="right" class="borderrightlight">-100%</td>';
} }
if (! $total[$annee-1] && $total[$annee]) if (! $total[$annee-1] && $total[$annee])
{ {
print '<td align="right">+Inf%</td>'; print '<td align="right" class="borderrightlight">+Inf%</td>';
} }
if (! $total[$annee-1] && ! $total[$annee]) if (! $total[$annee-1] && ! $total[$annee])
{ {
print '<td align="right">+0%</td>'; print '<td align="right" class="borderrightlight">+0%</td>';
} }
} }
else else
{ {
print '<td align="right">'; print '<td align="right" class="borderrightlight">';
if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear,$maxyear))) { print '-'; } if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear,$maxyear))) { print '-'; }
else { print '&nbsp;'; } else { print '&nbsp;'; }
print '</td>'; print '</td>';

View File

@ -35,6 +35,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
@ -63,6 +66,14 @@ else
$typeid=$_REQUEST['typeid']; $typeid=$_REQUEST['typeid'];
} }
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_label="";
$search_amount="";
$typeid="";
}
/* /*
* View * View
*/ */
@ -76,8 +87,9 @@ $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dm, t.fk_typepayment as ty
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
$sql.= " WHERE t.entity = ".$conf->entity; $sql.= " WHERE t.entity = ".$conf->entity;
if (GETPOST("search_label")) $sql.=" AND t.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; if ($search_ref) $sql.=" AND t.rowid=".$search_ref;
if (GETPOST("search_amount")) $sql.=" AND t.amount = ".price2num(GETPOST("search_amount")); if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'";
if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'";
if ($filtre) { if ($filtre) {
$filtre=str_replace(":","=",$filtre); $filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre; $sql .= " AND ".$filtre;
@ -106,27 +118,26 @@ if ($result)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre(""); print_liste_field_titre("");
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre"><input type="text" class="flat" size="4" name="search_ref" value="'.$search_ref.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.GETPOST("search_label").'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// Type // Type
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16); $form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.GETPOST("search_amount").'"></td>'; print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print "</td></tr>\n";
print "</tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {

View File

@ -357,7 +357,6 @@ if ($result)
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" value="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" value="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -40,11 +40,11 @@ if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
$search_nom=GETPOST('search_nom'); $search_name=GETPOST('search_name');
$search_contract=GETPOST('search_contract'); $search_contract=GETPOST('search_contract');
$search_ref_supplier=GETPOST('search_ref_supplier','alpha'); $search_ref_supplier=GETPOST('search_ref_supplier','alpha');
$sall=GETPOST('sall'); $sall=GETPOST('sall');
$statut=GETPOST('statut')?GETPOST('statut'):1; $search_status=GETPOST('search_status');
$socid=GETPOST('socid'); $socid=GETPOST('socid');
if (! $sortfield) $sortfield="c.rowid"; if (! $sortfield) $sortfield="c.rowid";
@ -58,6 +58,17 @@ $result = restrictedArea($user, 'contrat', $id);
$staticcontrat=new Contrat($db); $staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db); $staticcontratligne=new ContratLigne($db);
if (GETPOST("button_removefilter"))
{
$search_name="";
$search_contract="";
$search_ref_supplier="";
$sall="";
$search_status="";
}
if ($search_status == '') $search_status=1;
/* /*
* View * View
@ -84,8 +95,8 @@ $sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_nom) { if ($search_name) {
$sql .= natural_search('s.nom', $search_nom); $sql .= natural_search('s.nom', $search_name);
} }
if ($search_contract) { if ($search_contract) {
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
@ -106,13 +117,13 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_nom='.$search_nom, $sortfield, $sortorder,'',$num); print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num);
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$param='&amp;search_contract='.$search_contract; $param='&amp;search_contract='.$search_contract;
$param.='&amp;search_nom='.$search_nom; $param.='&amp;search_name='.$search_name;
$param.='&amp;search_ref_supplier='.$search_ref_supplier; $param.='&amp;search_ref_supplier='.$search_ref_supplier;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
@ -136,13 +147,13 @@ if ($resql)
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">'; print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">'; print '<input type="text" class="flat" size="24" name="search_name" value="'.$search_name.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
print '<td colspan="4" class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td colspan="4" class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>"; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
$var=true; $var=true;

View File

@ -44,7 +44,7 @@ if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
$filter=GETPOST("filter"); $filter=GETPOST("filter");
$search_nom=GETPOST("search_nom"); $search_name=GETPOST("search_name");
$search_contract=GETPOST("search_contract"); $search_contract=GETPOST("search_contract");
$search_service=GETPOST("search_service"); $search_service=GETPOST("search_service");
$statut=GETPOST('statut')?GETPOST('statut'):1; $statut=GETPOST('statut')?GETPOST('statut'):1;
@ -69,6 +69,21 @@ $staticcontrat=new Contrat($db);
$staticcontratligne=new ContratLigne($db); $staticcontratligne=new ContratLigne($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
if (GETPOST("button_removefilter"))
{
$search_name="";
$search_contract="";
$search_service="";
$op1month="";
$op1day="";
$op1year="";
$filter_op1="";
$op2month="";
$op2day="";
$op2year="";
$filter_op2="";
}
/* /*
* View * View
*/ */
@ -101,7 +116,7 @@ if ($mode == "0") $sql.= " AND cd.statut = 0";
if ($mode == "4") $sql.= " AND cd.statut = 4"; if ($mode == "4") $sql.= " AND cd.statut = 4";
if ($mode == "5") $sql.= " AND cd.statut = 5"; if ($mode == "5") $sql.= " AND cd.statut = 5";
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'"; if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
@ -122,7 +137,7 @@ if ($resql)
$param=''; $param='';
if ($search_contract) $param.='&amp;search_contract='.urlencode($search_contract); if ($search_contract) $param.='&amp;search_contract='.urlencode($search_contract);
if ($search_nom) $param.='&amp;search_nom='.urlencode($search_nom); if ($search_name) $param.='&amp;search_name='.urlencode($search_name);
if ($search_service) $param.='&amp;search_service='.urlencode($search_service); if ($search_service) $param.='&amp;search_service='.urlencode($search_service);
if ($mode) $param.='&amp;mode='.$mode; if ($mode) $param.='&amp;mode='.$mode;
if ($filter) $param.='&amp;filter='.$filter; if ($filter) $param.='&amp;filter='.$filter;
@ -168,7 +183,7 @@ if ($resql)
print '</td>'; print '</td>';
// Third party // Third party
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">'; print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$arrayofoperators=array('<'=>'<','>'=>'>'); $arrayofoperators=array('<'=>'<','>'=>'>');
@ -184,9 +199,9 @@ if ($resql)
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
print $form->select_date($filter_date2,'op2',0,0,1); print $form->select_date($filter_date2,'op2',0,0,1);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>"; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
$contractstatic=new Contrat($db); $contractstatic=new Contrat($db);

View File

@ -87,10 +87,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result > 0) if ($result > 0)
{ {
if ($_POST['sendto']) if (trim($_POST['sendto']))
{ {
// Recipient is provided into free text // Recipient is provided into free text
$sendto = $_POST['sendto']; $sendto = trim($_POST['sendto']);
$sendtoid = 0; $sendtoid = 0;
} }
elseif ($_POST['receiver'] != '-1') elseif ($_POST['receiver'] != '-1')
@ -107,6 +107,22 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$sendtoid = $_POST['receiver']; $sendtoid = $_POST['receiver'];
} }
} }
if (trim($_POST['sendtocc']))
{
$sendtocc = trim($_POST['sendtocc']);
}
elseif ($_POST['receivercc'] != '-1')
{
// Recipient was provided from combo list
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
{
$sendtocc = $thirdparty->email;
}
else // Id du contact
{
$sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email');
}
}
if (dol_strlen($sendto)) if (dol_strlen($sendto))
{ {
@ -115,8 +131,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message']; $message = $_POST['message'];
$sendtocc = $_POST['sendtocc']; $sendtocc = $sendtocc;
$sendtobcc=''; $sendtobcc= GETPOST('sendtoccc');
if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
@ -172,7 +188,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $this->errors=$interface->errors;
} }

View File

@ -51,8 +51,6 @@ for($i = 0; $i < $length; $i++)
$sessionkey='dol_antispam_value'; $sessionkey='dol_antispam_value';
$_SESSION[$sessionkey]=$string; $_SESSION[$sessionkey]=$string;
header("Content-type: image/png");
$img = imagecreate(80,32); $img = imagecreate(80,32);
if (empty($img)) if (empty($img))
{ {
@ -60,6 +58,8 @@ if (empty($img))
exit; exit;
} }
header("Content-type: image/png");
$background_color = imagecolorallocate($img, 250, 250, 250); $background_color = imagecolorallocate($img, 250, 250, 250);
$ecriture_color = imagecolorallocate($img, 0, 0, 0); $ecriture_color = imagecolorallocate($img, 0, 0, 0);
imagestring($img, 4, 24, 8, $string, $ecriture_color); imagestring($img, 4, 24, 8, $string, $ecriture_color);

View File

@ -609,6 +609,8 @@ abstract class CommonObject
if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0; if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0;
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty));
$this->client = $thirdparty; // deprecated $this->client = $thirdparty; // deprecated
@ -1823,7 +1825,7 @@ abstract class CommonObject
if (empty($sourceid) && empty($targetid)) if (empty($sourceid) && empty($targetid))
{ {
dol_print_error('','Bad usage of function. No parameter defined and no id defined'); dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR);
return -1; return -1;
} }
@ -2523,14 +2525,14 @@ abstract class CommonObject
if (! empty($conf->margin->enabled) && empty($user->societe_id)) if (! empty($conf->margin->enabled) && empty($user->societe_id))
{ {
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>'; print '<td align="right" class="margininfos" width="80">'.$langs->trans('BuyingPrice').'</td>';
else else
print '<td align="right" width="80">'.$langs->trans('CostPrice').'</td>'; print '<td align="right" class="margininfos" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>'; print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td align="right" width="50">'.$langs->trans('MarkRate').'</td>'; print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarkRate').'</td>';
} }
// Total HT // Total HT
@ -3010,11 +3012,16 @@ abstract class CommonObject
$marginInfo = $this->getMarginInfos($force_price); $marginInfo = $this->getMarginInfos($force_price);
if (! empty($conf->global->MARGININFO_HIDE_SHOW)) print $langs->trans('ShowMarginInfos').' : ';
{ $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW'];
print "<img onclick=\"$('.margininfos').toggle();\" src='".img_picto($langs->trans("Hide")."/".$langs->trans("Show"),'object_margin.png','','',1)."'>"; print '<span id="showMarginInfos" class="linkobject '.(!empty($hidemargininfos)?'':'hideobject').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
if ($conf->global->MARGININFO_HIDE_SHOW == 2) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>'; // hide by default print '<span id="hideMarginInfos" class="linkobject '.(!empty($hidemargininfos)?'hideobject':'').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
}
print '<script>$(document).ready(function() {
$("span#showMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 0); $(".margininfos").show(); $("span#showMarginInfos").addClass("hideobject"); $("span#hideMarginInfos").removeClass("hideobject");})});
$("span#hideMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 1); $(".margininfos").hide(); $("span#hideMarginInfos").addClass("hideobject"); $("span#showMarginInfos").removeClass("hideobject");})});
});</script>';
if (!empty($hidemargininfos)) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
print '<table class="nobordernopadding margintable" width="100%">'; print '<table class="nobordernopadding margintable" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -157,7 +157,7 @@ class ExtraFields
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
{ {
if ($type=='boolean') { if ($type=='boolean') {
$typedb='int'; $typedb='int';
@ -752,15 +752,17 @@ class ExtraFields
if (strpos($InfoFieldList[4], 'extra')!==false) if (strpos($InfoFieldList[4], 'extra')!==false)
{ {
$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra'; $sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
$sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
} }
else else
{ {
$sqlwhere.= ' AND '.$InfoFieldList[4]; $sqlwhere.= ' WHERE '.$InfoFieldList[4];
} }
}else {
$sqlwhere.= ' WHERE 1';
} }
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
$sql.=preg_replace('/^ AND /','',$sqlwhere); //$sql.=preg_replace('/^ AND /','',$sqlwhere);
//print $sql; //print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
@ -988,7 +990,10 @@ class ExtraFields
{ {
foreach ($fields_label as $field_toshow) foreach ($fields_label as $field_toshow)
{ {
$translabel=$langs->trans($obj->$field_toshow); $translabel='';
if (!empty($obj->$field_toshow)) {
$translabel=$langs->trans($obj->$field_toshow);
}
if ($translabel!=$field_toshow) { if ($translabel!=$field_toshow) {
$value.=dol_trunc($translabel,18).' '; $value.=dol_trunc($translabel,18).' ';
}else { }else {
@ -998,7 +1003,10 @@ class ExtraFields
} }
else else
{ {
$translabel=$langs->trans($obj->$InfoFieldList[1]); $translabel='';
if (!empty($obj->$InfoFieldList[1])) {
$translabel=$langs->trans($obj->$InfoFieldList[1]);
}
if ($translabel!=$obj->$InfoFieldList[1]) { if ($translabel!=$obj->$InfoFieldList[1]) {
$value=dol_trunc($translabel,18); $value=dol_trunc($translabel,18);
}else { }else {

View File

@ -1835,11 +1835,12 @@ class Form
* @param string $filterkey Filtre des produits * @param string $filterkey Filtre des produits
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $outputmode 0=HTML select string, 1=Array * @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @return array Array of keys for json * @return array Array of keys for json
*/ */
function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0) function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100)
{ {
global $langs,$conf; global $langs,$conf,$db;
$out=''; $out='';
$outarray=array(); $outarray=array();
@ -1877,6 +1878,7 @@ class Form
$sql.=')'; $sql.=')';
} }
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; $sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
$sql.= $db->plimit($limit);
// Build output string // Build output string
@ -4032,9 +4034,10 @@ class Form
* @param int $translate Translate and encode value * @param int $translate Translate and encode value
* @param int $maxlen Length maximum for labels * @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled * @param int $disabled Html select box is disabled
* @param int $sort 'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
* @param string $morecss Add more class to css styles * @param string $morecss Add more class to css styles
* @return string HTML select string. * @return string HTML select string.
* @see multiselectarray
*/ */
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='') static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='')
{ {
@ -4092,54 +4095,65 @@ class Form
* *
* @param string $htmlname Name of select * @param string $htmlname Name of select
* @param array $array Array with key+value * @param array $array Array with key+value
* @param array $selected Preselected keys * @param array $selected Array with key+value preselected
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $value_as_key 1 to use value as key * @param int $value_as_key 1 to use value as key
* @param string $option Valeur de l'option en fonction du type choisi * @param string $option Valeur de l'option en fonction du type choisi
* @param int $translate Translate and encode value * @param int $translate Translate and encode value
* @param int $width Force width of select box. May be used only when using jquery couch.
* @return string HTML multiselect string * @return string HTML multiselect string
* @see selectarray
*/ */
function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0) static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0, $width=0)
{ {
global $conf, $langs; global $conf, $langs;
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.'>'."\n"; // Add code for jquery to use multiselect
// Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it.
if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiselect'))
|| (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT')))
{
print '<!-- JS CODE FOR multiselect -->
<script type="text/javascript">
$(document).ready(function () {
$.extend($.ui.multiselect.locale, {
addAll:\''.$langs->transnoentities("AddAll").'\',
removeAll:\''.$langs->transnoentities("RemoveAll").'\',
itemsCount:\''.$langs->transnoentities("ItemsCount").'\'
});
$(function(){
$("#'.$htmlname.'").multiselect({
searchable: false,
width: '.($width?$width:300).',
height: 120
});
});
});
</script>';
}
// Add code for jquery to use multiple-select
// Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it.
if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiple-select'))
|| (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT')))
{
print '<!-- JS CODE FOR multiple-select -->
<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiple-select/jquery.multiple.select.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(\'#'.$htmlname.'\').multipleSelect();
});
</script>';
}
// Try also magic suggest
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.($width?' style="width: '.$width.'px"':'').'>'."\n";
if (is_array($array) && ! empty($array)) if (is_array($array) && ! empty($array))
{ {
if ($value_as_key) $array=array_combine($array, $array); if ($value_as_key) $array=array_combine($array, $array);
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && is_array($selected) && ! empty($selected)) if (! empty($array))
{
foreach ($selected as $selected_value)
{
foreach($array as $key => $value)
{
if ($selected_value == $key)
{
$value=$array[$selected_value];
$out.= '<option value="'.$key.'" selected="selected">';
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
$out.= dol_htmlentitiesbr($newval);
$out.= '</option>'."\n";
unset($array[$key]);
}
}
}
if (! empty($array))
{
foreach ($array as $key => $value)
{
$out.= '<option value="'.$key.'">';
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
$out.= dol_htmlentitiesbr($newval);
$out.= '</option>'."\n";
}
}
}
else
{ {
foreach ($array as $key => $value) foreach ($array as $key => $value)
{ {
@ -4150,7 +4164,7 @@ class Form
} }
$out.= '>'; $out.= '>';
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value); $newval = ($translate ? $langs->trans($value) : $value);
$newval = ($key_in_label ? $key.' - '.$newval : $newval); $newval = ($key_in_label ? $key.' - '.$newval : $newval);
$out.= dol_htmlentitiesbr($newval); $out.= dol_htmlentitiesbr($newval);
$out.= '</option>'."\n"; $out.= '</option>'."\n";

View File

@ -4,7 +4,7 @@
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -14,6 +14,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/ */
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -173,7 +174,7 @@ class Notify
// Check notification per third party // Check notification per third party
$sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
$sql.= " a.rowid as adid, a.label, a.code, n.rowid"; $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
@ -292,8 +293,8 @@ class Notify
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, objet_type, objet_id, email)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')"; $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", ".$obj->cid.", '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($obj->email)."')";
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
dol_print_error($this->db); dol_print_error($this->db);
@ -421,8 +422,8 @@ class Notify
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, objet_type, objet_id, email)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, objet_id, email)";
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; $sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$actiondefid.", ".$object->socid.", null, '".$obj->type."', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
if (! $this->db->query($sql)) if (! $this->db->query($sql))
{ {
dol_print_error($this->db); dol_print_error($this->db);

View File

@ -33,7 +33,6 @@ class Translate
var $defaultlang; // Current language for current user var $defaultlang; // Current language for current user
var $direction = 'ltr'; // Left to right or Right to left var $direction = 'ltr'; // Left to right or Right to left
var $charset_inputfile=array(); // To store charset encoding used for language
var $charset_output='UTF-8'; // Codage used by "trans" method outputs var $charset_output='UTF-8'; // Codage used by "trans" method outputs
var $tab_translate=array(); // Array of all translations key=>value var $tab_translate=array(); // Array of all translations key=>value

View File

@ -631,7 +631,7 @@ function hideMessage(fieldId,message) {
/* /*
* TODO Used by admin page only ? * Used by button to set on/off
*/ */
function setConstant(url, code, input, entity, strict) { function setConstant(url, code, input, entity, strict) {
$.get( url, { $.get( url, {
@ -689,7 +689,7 @@ function setConstant(url, code, input, entity, strict) {
} }
/* /*
* TODO Used by admin page only ? * Used by button to set on/off
*/ */
function delConstant(url, code, input, entity, strict) { function delConstant(url, code, input, entity, strict) {
$.get( url, { $.get( url, {
@ -743,7 +743,7 @@ function delConstant(url, code, input, entity, strict) {
} }
/* /*
* TODO Used by admin page only ? * Used by button to set on/off
*/ */
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) { function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) {
var boxConfirm = box; var boxConfirm = box;

View File

@ -173,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
} }
$("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified $("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified
} }
,delay: 500
}).data( "autocomplete" )._renderItem = function( ul, item ) { }).data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" ) return $( "<li></li>" )
.data( "item.autocomplete", item ) .data( "item.autocomplete", item )

View File

@ -766,7 +766,7 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
* @param int $inhour 0: return number of days, 1: return number of hours * @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes * @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end * @param int $halfday Tag to define half day when holiday start and end
* @param string $countrycode Country code (company country code if not defined) * @param string $country_code Country code (company country code if not defined)
* @return int Number of days or hours * @return int Number of days or hours
*/ */
function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='') function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')

View File

@ -44,14 +44,31 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* @param string $class Class name * @param string $class Class name
* @param string $member Name of property * @param string $member Name of property
* @return mixed Return value of static property * @return mixed Return value of static property
* @deprecated PHP 5.3 is now the minimum requirement, this is no longer necessary
*/ */
function getStaticMember($class, $member) function getStaticMember($class, $member)
{ {
if (isset($class::$member)) { // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
return $class::$member; /*if (version_compare(phpversion(), '5.3.0', '<'))
} {
if (is_object($class)) $class = get_class($class);
$classObj = new ReflectionClass($class);
$result = null;
$found=0;
foreach($classObj->getStaticProperties() as $prop => $value)
{
if ($prop == $member)
{
$result = $value;
$found++;
break;
}
}
if ($found) return $result;
}*/
if (isset($class::$member)) return $class::$member;
dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); dol_print_error('','Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
return null; return null;
} }

View File

@ -2,19 +2,20 @@
/* /*
* Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ * or see http://www.gnu.org/
*/
/** /**
* \file htdocs/core/lib/invoice2.lib.php * \file htdocs/core/lib/invoice2.lib.php

View File

@ -44,14 +44,6 @@ function prelevement_prepare_head($object)
$head[$h][2] = 'prelevement'; $head[$h][2] = 'prelevement';
$h++; $h++;
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$object->id;
$head[$h][1] = $langs->trans("Preview");
$head[$h][2] = 'preview';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$object->id;
$head[$h][1] = $langs->trans("Lines"); $head[$h][1] = $langs->trans("Lines");
$head[$h][2] = 'lines'; $head[$h][2] = 'lines';

View File

@ -774,9 +774,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Supplier Orders // Supplier Orders
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$langs->load("supplier"); if (! empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE))
$newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); {
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); $langs->load("supplier");
$newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
} }
@ -952,7 +955,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
$newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy", $langs->trans("Chartofaccounts"),0,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
} }
} }

View File

@ -210,6 +210,7 @@ class CommActionRapport
$sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid"; $sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid";
$sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'"; $sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'";
$sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'"; $sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'";
$sql.= " AND a.entity = ".$conf->entity;
$sql.= " ORDER BY a.datep DESC"; $sql.= " ORDER BY a.datep DESC";
$eventstatic=new ActionComm($this->db); $eventstatic=new ActionComm($this->db);

View File

@ -230,6 +230,14 @@ class modAccounting extends DolibarrModules
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++; $r++;
$this->rights[$r][0] = 50440;
$this->rights[$r][1] = 'Manage chart of accounts';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'chartofaccount';
$this->rights[$r][5] = '';
$r++;
// Main menu entries // Main menu entries
$this->menus = array(); $this->menus = array();
$r = 0; $r = 0;

View File

@ -0,0 +1,219 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
*
* 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 <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/security/generate/modGeneratePassPerso.class.php
* \ingroup core
* \brief File to manage no password generation.
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php';
/**
* \class modGeneratePassPerso
* \brief Class to generate a password according to personal rules
*/
class modGeneratePassPerso extends ModeleGenPassword
{
var $id;
var $length;
var $length2; // didn't overright display
var $NbMaj;
var $NbNum;
var $NbSpe;
var $NbRepeat;
var $WithoutAmbi;
var $db;
var $conf;
var $lang;
var $user;
var $Maj;
var $Min;
var $Nb;
var $Spe;
var $Ambi;
var $All;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Conf $conf Handler de conf
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
function __construct($db, $conf, $langs, $user)
{
$this->id = "Perso";
$this->length = $langs->trans("SetupPerso");
$this->db=$db;
$this->conf=$conf;
$this->langs=$langs;
$this->user=$user;
if(empty($conf->global->USER_PASSWORD_PATTERN)){
// default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation.
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity);
}
$this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$this->Min = strtolower($this->Maj);
$this->Nb = "0123456789";
$this->Spe = "!@#$%&*()_-+={}[]\\|:;'/";
$this->Ambi = array("1","I","l","|","O","0");
$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];
if ($this->WithoutAmbi)
{
$this->Maj = str_replace($this->Ambi,"",$this->Maj);
$this->Min = str_replace($this->Ambi,"",$this->Min);
$this->Nb = str_replace($this->Ambi,"",$this->Nb);
$this->Spe = str_replace($this->Ambi,"",$this->Spe);
}
$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe);
//$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
//$this->All = $this->Spe;
}
/**
* Return description of module
*
* @return string Description of text
*/
function getDescription()
{
global $langs;
return $langs->trans("PasswordGenerationPerso");
}
/**
* Return an example of password generated by this module
*
* @return string Example of password
*/
function getExample()
{
return $this->getNewGeneratedPassword();
}
/**
* Build new password
*
* @return string Return a new generated password
*/
function getNewGeneratedPassword()
{
$pass = "";
for($i=0; $i<$this->NbMaj; $i++){ // Y
$pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)];
}
for($i=0; $i<$this->NbNum; $i++){ // X
$pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)];
}
for($i=0; $i<$this->NbSpe; $i++){ // @
$pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)];
}
for($i=strlen($pass);$i<$this->length2; $i++){ // y
$pass .= $this->All[rand(0,strlen($this->All) -1)];
}
$pass = str_shuffle($pass);
if ($this->validatePassword($pass))
{
return $pass;
}
return $this->getNewGeneratedPassword();
}
/**
* Validate a password
*
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
function validatePassword($password)
{
$password_a = str_split($password);
$maj = str_split($this->Maj);
$num = str_split($this->Nb);
$spe = str_split($this->Spe);
if(count(array_intersect($password_a, $maj)) < $this->NbMaj){
return 0;
}
if(count(array_intersect($password_a, $num)) < $this->NbNum){
return 0;
}
if(count(array_intersect($password_a, $spe)) < $this->NbSpe){
return 0;
}
if(!$this->consecutiveInterationSameCharacter($password)){
return 0;
}
return 1;
}
/**
* consecutive iterations of the same character
*
* @param string $password Password to check
* @return int 0 if KO, >0 if OK
*/
function consecutiveInterationSameCharacter($password){
$last = "";
$count = 0;
$char = str_split($password);
foreach($char as $c){
if($c != $last){
$last = $c;
$count = 0;
}else{
$count++;
}
if($count >= $this->NbRepeat) {
return 0;
}
}
return 1;
}
}

View File

@ -87,8 +87,8 @@
</td> </td>
<td> <td>
<table class="nobordernopadding"> <table class="nobordernopadding">
<tr><td width="30%"> <tr><td>
<textarea name="param" id="param"><?php echo GETPOST('param'); ?></textarea> <textarea name="param" id="param" cols="80" rwos="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
</td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td> </td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td>
<td id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></td></tr> <td id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></td></tr>
</table> </table>

View File

@ -98,8 +98,8 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ
</td> </td>
<td> <td>
<table class="nobordernopadding"> <table class="nobordernopadding">
<tr><td width="30%"> <tr><td>
<textarea name="param" id="param"><?php echo $param_chain; ?></textarea> <textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo $param_chain; ?></textarea>
</td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?></td></tr> </td><td><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp".$type),1,0)?></td></tr>
</table> </table>
</td> </td>

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr> /* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -48,7 +49,18 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
print '<table width="100%" class="nobordernopadding"><tr><td'; print '<table width="100%" class="nobordernopadding"><tr><td';
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"'; if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
print '>' . $label . '</td>'; print '>' . $label . '</td>';
if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) && $user->rights->{$object->element}->creer && ($action != 'edit_extras' || GETPOST('attribute') != $key))
//TODO Improve element and rights detection
//var_dump($user->rights);
$permok=false;
$keyforperm=$object->element;
if ($object->element == 'fichinter') $keyforperm='ficheinter';
if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer;
if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer;
if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key])
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key))
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
print '</tr></table>'; print '</tr></table>';
@ -59,7 +71,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]); $value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
} }
if ($action == 'edit_extras' && $user->rights->{$object->element}->creer && GETPOST('attribute') == $key) //TODO Improve element and rights detection
if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key)
{ {
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
print '<input type="hidden" name="action" value="update_extras">'; print '<input type="hidden" name="action" value="update_extras">';

View File

@ -83,13 +83,17 @@ $(document).ready(function () {
<tr> <tr>
<td valign="middle" class="loginfield"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong></td> <td valign="middle" class="loginfield"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong></td>
<td valign="middle" class="nowrap"> <td valign="middle" class="nowrap">
<input type="text" id="username" name="username" class="flat" size="15" maxlength="40" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" autofocus="autofocus" /> <span class="span-icon-user">
<input type="text" id="username" name="username" class="flat input-icon-user" size="15" maxlength="40" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" autofocus="autofocus" />
</span>
</td> </td>
</tr> </tr>
<!-- Password --> <!-- Password -->
<tr><td valign="middle" class="loginfield nowrap"><strong><label for="password"><?php echo $langs->trans('Password'); ?></label></strong></td> <tr><td valign="middle" class="loginfield nowrap"><strong><label for="password"><?php echo $langs->trans('Password'); ?></label></strong></td>
<td valign="middle" class="nowrap"> <td valign="middle" class="nowrap">
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" /> <span class="span-icon-password">
<input id="password" name="password" class="flat input-icon-password" type="password" size="15" maxlength="30" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" />
</span>
</td></tr> </td></tr>
<?php <?php
if (! empty($hookmanager->resArray['options'])) { if (! empty($hookmanager->resArray['options'])) {
@ -111,7 +115,11 @@ if (! empty($hookmanager->resArray['options'])) {
<td valign="top" class="nowrap none" align="left"> <td valign="top" class="nowrap none" align="left">
<table class="login_table_securitycode" style="width: 100px;"><tr> <table class="login_table_securitycode" style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="4" /></td> <td>
<span class="span-icon-security">
<input id="securitycode" class="flat input-icon-security" type="text" size="6" maxlength="5" name="code" tabindex="4" />
</span>
</td>
<td><img src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" /></td> <td><img src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" /></td>
<td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td> <td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td>
</tr></table> </tr></table>

View File

@ -61,7 +61,7 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"> <td align="right" class="margininfos">
<?php <?php
echo '<label for="buying_price">'; echo '<label for="buying_price">';
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
@ -72,8 +72,8 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord
?> ?>
</td> </td>
<?php <?php
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td align="right" class="margininfos"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td align="right" class="margininfos"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
} }
?> ?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td> <td colspan="<?php echo $colspan; ?>">&nbsp;</td>
@ -217,7 +217,7 @@ else {
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"> <td align="right" class="margininfos">
<!-- For predef product --> <!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select> <select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select>
@ -232,12 +232,12 @@ else {
{ {
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
{ {
echo '<td align="right" class="nowrap"><input type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'"><span class="np_marginRate hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:'').'"><span class="np_marginRate hideonsmartphone">%</span></td>';
$coldisplay++; $coldisplay++;
} }
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))
{ {
echo '<td align="right" class="nowrap"><input type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'"><span class="np_markRate hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" id="np_markRate" name="np_markRate" value="'.(isset($_POST["np_markRate"])?$_POST["np_markRate"]:'').'"><span class="np_markRate hideonsmartphone">%</span></td>';
$coldisplay++; $coldisplay++;
} }
} }

View File

@ -125,7 +125,7 @@ $coldisplay=-1; // We remove first td
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"><?php $coldisplay++; ?> <td align="right" class="margininfos"><?php $coldisplay++; ?>
<!-- For predef product --> <!-- For predef product -->
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?> <?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select> <select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select>
@ -139,9 +139,9 @@ $coldisplay=-1; // We remove first td
$margin_rate = (isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx))); $margin_rate = (isset($_POST["np_marginRate"])?$_POST["np_marginRate"]:(($line->pa_ht == 0)?'':price($line->marge_tx)));
// if credit note, dont allow to modify margin // if credit note, dont allow to modify margin
if ($line->subprice < 0) if ($line->subprice < 0)
echo '<td align="right" class="nowrap">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
else else
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++; $coldisplay++;
} }
elseif (! empty($conf->global->DISPLAY_MARK_RATES)) elseif (! empty($conf->global->DISPLAY_MARK_RATES))
@ -149,9 +149,9 @@ $coldisplay=-1; // We remove first td
$mark_rate = (isset($_POST["np_markRate"])?$_POST["np_markRate"]:price($line->marque_tx)); $mark_rate = (isset($_POST["np_markRate"])?$_POST["np_markRate"]:price($line->marque_tx));
// if credit note, dont allow to modify margin // if credit note, dont allow to modify margin
if ($line->subprice < 0) if ($line->subprice < 0)
echo '<td align="right" class="nowrap">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
else else
echo '<td align="right" class="nowrap"><input type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>'; echo '<td align="right" class="nowrap margininfos"><input type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
$coldisplay++; $coldisplay++;
} }
} }

View File

@ -141,13 +141,13 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (! empty($conf->margin->enabled) && empty($user->societe_id)) { if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
?> ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><div class="margininfos"><?php echo price($line->pa_ht); ?></div></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?> <?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
<?php <?php
} }
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
<?php } } ?> <?php } } ?>
<?php if ($line->special_code == 3) { ?> <?php if ($line->special_code == 3) { ?>

View File

@ -69,7 +69,9 @@ $(document).ready(function () {
<tr> <tr>
<td valign="bottom" class="loginfield nowrap"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong></td> <td valign="bottom" class="loginfield nowrap"><strong><label for="username"><?php echo $langs->trans('Login'); ?></label></strong></td>
<td valign="bottom" class="nowrap"> <td valign="bottom" class="nowrap">
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat" size="15" maxlength="40" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" /> <span class="span-icon-user">
<input type="text" <?php echo $disabled; ?> id="username" name="username" class="flat input-icon-user" size="15" maxlength="40" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" />
</span>
</td> </td>
</tr> </tr>
@ -91,7 +93,11 @@ if (! empty($hookmanager->resArray['options'])) {
<td valign="top" class="nowrap none" align="left"> <td valign="top" class="nowrap none" align="left">
<table class="login_table_securitycode" style="width: 100px;"><tr> <table class="login_table_securitycode" style="width: 100px;"><tr>
<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="4" /></td> <td>
<span class="span-icon-security">
<input id="securitycode" class="flat input-icon-security" type="text" size="6" maxlength="5" name="code" tabindex="4" />
</span>
</td>
<td><img src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" /></td> <td><img src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" /></td>
<td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td> <td><a href="<?php echo $php_self; ?>"><?php echo $captcha_refresh; ?></a></td>
</tr></table> </tr></table>

View File

@ -92,6 +92,7 @@ print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>'; print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>'; print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>'; print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -107,6 +108,7 @@ foreach($extrafields->attribute_type as $key => $value)
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n"; print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n"; print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n"; print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; // TODO This must be generalised into all page to admin extrafield. Mutualize code here is easy and will save a lot of code
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>"; print "</tr>";

View File

@ -62,6 +62,13 @@ $search_desc=GETPOST('search_desc','alpha');
$search_status=GETPOST('search_status'); $search_status=GETPOST('search_status');
$sall=GETPOST('sall'); $sall=GETPOST('sall');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_company="";
$search_desc="";
$search_status="";
}
/* /*
* View * View
@ -131,6 +138,7 @@ if ($result)
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder);
} }
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"], '');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -151,9 +159,10 @@ if ($result)
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$liststatus=$interventionstatic->statuts_short; $liststatus=$interventionstatic->statuts_short;
print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1);
print '<input class="liste_titre" align="right" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$companystatic=new Societe($db); $companystatic=new Societe($db);
@ -185,6 +194,7 @@ if ($result)
} }
print '<td align="right">'.$interventionstatic->LibStatut($objp->fk_statut,5).'</td>'; print '<td align="right">'.$interventionstatic->LibStatut($objp->fk_statut,5).'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$total += $objp->duree; $total += $objp->duree;
@ -194,7 +204,7 @@ if ($result)
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
{ {
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total).'</td><td>&nbsp;</td>'; print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total).'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -146,7 +146,7 @@ class FactureFournisseur extends CommonInvoice
*/ */
function create($user) function create($user)
{ {
global $langs,$conf; global $langs,$conf,$hookmanager;
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -255,6 +255,23 @@ class FactureFournisseur extends CommonInvoice
$result=$this->update_price(); $result=$this->update_price();
if ($result > 0) if ($result > 0)
{ {
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierinvoicedao'));
$parameters=array('socid'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
else if ($reshook < 0) $error++;
// Call trigger // Call trigger
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user); $result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
if ($result < 0) $error++; if ($result < 0) $error++;

View File

@ -39,12 +39,11 @@ $langs->load("sendings");
$search_ref=GETPOST('search_ref'); $search_ref=GETPOST('search_ref');
$search_refsupp=GETPOST('search_refsupp'); $search_refsupp=GETPOST('search_refsupp');
$search_nom=GETPOST('search_nom'); $search_company=GETPOST('search_company');
$search_user=GETPOST('search_user'); $search_user=GETPOST('search_user');
$search_ttc=GETPOST('search_ttc'); $search_ttc=GETPOST('search_ttc');
$sall=GETPOST('search_all'); $sall=GETPOST('search_all');
$search_status=GETPOST('search_status','int'); $search_status=GETPOST('search_status','int');
if ($search_status == '') $search_status=-1;
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -58,6 +57,18 @@ $orderid = GETPOST('orderid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
// Purge search criteria
if (GETPOST("button_removefilter"))
{
$search_ref='';
$search_refsupp='';
$search_company='';
$search_user='';
$search_ttc='';
$search_status='';
}
if ($search_status == '') $search_status=-1;
/* /*
* View * View
@ -102,9 +113,9 @@ if ($search_ref)
{ {
$sql .= natural_search('cf.ref', $search_ref); $sql .= natural_search('cf.ref', $search_ref);
} }
if ($search_nom) if ($search_company)
{ {
$sql .= natural_search('s.nom', $search_nom); $sql .= natural_search('s.nom', $search_company);
} }
if ($search_user) if ($search_user)
{ {
@ -154,13 +165,14 @@ if ($resql)
$i = 0; $i = 0;
$param=""; $param="";
if ($search_ref) $param.="&search_ref=".$search_ref; if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_nom) $param.="&search_nom=".$search_nom; if ($search_company) $param.="&search_company=".$search_company;
if ($search_user) $param.="&search_user=".$search_user; if ($search_user) $param.="&search_user=".$search_user;
if ($search_ttc) $param.="&search_ttc=".$search_ttc; if ($search_ttc) $param.="&search_ttc=".$search_ttc;
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".$socid;
if ($search_status >= 0) $param.="&search_status=".$search_status; if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -180,7 +192,7 @@ if ($resql)
print '<td class="liste_titre"><input type="text" class="flat" name="search_ref" value="'.$search_ref.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_ref" value="'.$search_ref.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_refsupp" value="'.$search_refsupp.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_refsupp" value="'.$search_refsupp.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$search_nom.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.$search_company.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_user" value="'.$search_user.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_user" value="'.$search_user.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ttc" value="'.$search_ttc.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat" name="search_ttc" value="'.$search_ttc.'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -188,10 +200,9 @@ if ($resql)
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$formorder->selectSupplierOrderStatus($search_status,1,'search_status'); $formorder->selectSupplierOrderStatus($search_status,1,'search_status');
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print "</td></tr>\n";
print '</tr>';
$var=true; $var=true;

View File

@ -301,10 +301,16 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
$error++; $error++;
} }
// Fill array 'array_options' with data from add form
if (! $error) if (! $error)
{ {
$db->begin(); $db->begin();
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error ++;
$tmpproject = GETPOST('projectid', 'int'); $tmpproject = GETPOST('projectid', 'int');
// Creation facture // Creation facture
@ -1077,7 +1083,7 @@ elseif ($action == 'update_extras')
{ {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierorderdao')); $hookmanager->initHooks(array('supplierinvoicedao'));
$parameters=array('id'=>$object->id); $parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -1179,6 +1185,9 @@ llxHeader('','','');
// Mode creation // Mode creation
if ($action == 'create') if ($action == 'create')
{ {
$facturestatic = new FactureFournisseur($db);
$extralabels = $extrafields->fetch_name_optionals_label($facturestatic->table_element);
print_fiche_titre($langs->trans('NewBill')); print_fiche_titre($langs->trans('NewBill'));
dol_htmloutput_events(); dol_htmloutput_events();
@ -1420,6 +1429,11 @@ if ($action == 'create')
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; // print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
print '</tr>'; print '</tr>';
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields, 'edit');
}
if (is_object($objectsrc)) if (is_object($objectsrc))
{ {
print "\n<!-- ".$classname." info -->"; print "\n<!-- ".$classname." info -->";
@ -1531,6 +1545,9 @@ else
$result=$societe->fetch($object->socid); $result=$societe->fetch($object->socid);
if ($result < 0) dol_print_error($db); if ($result < 0) dol_print_error($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
/* /*
* View card * View card
*/ */

View File

@ -47,6 +47,31 @@ if ($user->societe_id > 0)
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_ref = GETPOST('search_ref','alpha');
$search_ref_supplier = GETPOST('search_ref_supplier','alpha');
$search_company = GETPOST('search_company','alpha');
$search_amount_no_tax = GETPOST('search_amount_no_tax','alpha');
$search_amount_all_tax = GETPOST('search_amount_all_tax','alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_ref_supplier="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
}
/* /*
* View * View
@ -61,31 +86,6 @@ $title=$langs->trans("BillsSuppliersUnpaid");
$facturestatic=new FactureFournisseur($db); $facturestatic=new FactureFournisseur($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
/***************************************************************************
* *
* Mode Liste *
* *
***************************************************************************/
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_ref = GETPOST('search_ref','alpha');
$search_ref_supplier = GETPOST('search_ref_supplier','alpha');
$search_societe = GETPOST('search_societe','alpha');
$search_montant_ht = GETPOST('search_montant_ht','int');
$search_montant_ttc = GETPOST('search_montant_ttc','int');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.date_lim_reglement";
if (! $sortorder) $sortorder="ASC";
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.rowid as socid, s.nom as name,"; $sql = "SELECT s.rowid as socid, s.nom as name,";
@ -124,19 +124,19 @@ if ($user->rights->fournisseur->facture->lire)
$sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'"; $sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'";
} }
if ($search_societe) if ($search_company)
{ {
$sql .= " AND s.nom LIKE '%".$search_societe."%'"; $sql .= " AND s.nom LIKE '%".$search_company."%'";
} }
if ($search_montant_ht) if ($search_amount_no_tax)
{ {
$sql .= " AND f.total_ht = '".$search_montant_ht."'"; $sql .= " AND f.total_ht = '".$search_amount_no_tax."'";
} }
if ($search_montant_ttc) if ($search_amount_all_tax)
{ {
$sql .= " AND f.total_ttc = '".$search_montant_ttc."'"; $sql .= " AND f.total_ttc = '".$search_amount_all_tax."'";
} }
if (dol_strlen(GETPOST('sf_re')) > 0) if (dol_strlen(GETPOST('sf_re')) > 0)
@ -165,9 +165,9 @@ if ($user->rights->fournisseur->facture->lire)
if ($search_ref) $param.='&amp;search_ref='.urlencode($search_ref); if ($search_ref) $param.='&amp;search_ref='.urlencode($search_ref);
if ($search_ref_supplier) $param.='&amp;search_ref_supplier='.urlencode($search_ref_supplier); if ($search_ref_supplier) $param.='&amp;search_ref_supplier='.urlencode($search_ref_supplier);
if ($search_societe) $param.='&amp;search_societe='.urlencode($search_societe); if ($search_company) $param.='&amp;search_company='.urlencode($search_company);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht); if ($search_amount_no_tax) $param.='&amp;search_amount_no_tax='.urlencode($search_amount_no_tax);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc); if ($search_amount_all_tax) $param.='&amp;search_amount_all_tax='.urlencode($search_amount_all_tax);
$param.=($option?"&option=".$option:""); $param.=($option?"&option=".$option:"");
if (! empty($late)) $param.='&late='.urlencode($late); if (! empty($late)) $param.='&late='.urlencode($late);
@ -209,15 +209,15 @@ if ($user->rights->fournisseur->facture->lire)
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'">'; print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.$search_montant_ht.'">'; print '<input class="flat" type="text" size="8" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.$search_montant_ttc.'">'; print '<input class="flat" type="text" size="8" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" colspan="2" align="right">'; print '</td><td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</tr>\n"; print "</td></tr>\n";
if ($num > 0) if ($num > 0)
{ {

View File

@ -64,9 +64,26 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fac.datef,fac.rowid"; if (! $sortfield) $sortfield="fac.datef,fac.rowid";
$month = GETPOST('month','int'); $search_ref = GETPOST("search_ref","int");
$year = GETPOST('year','int'); $search_ref_supplier = GETPOST("search_ref_supplier","alpha");
$search_label = GETPOST("search_label","alpha");
$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$month = GETPOST("month","int");
$year = GETPOST("year","int");
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_ref_supplier="";
$search_label="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
$year="";
$month="";
}
/* /*
* Actions * Actions
@ -93,9 +110,6 @@ if ($mode == 'search')
} }
} }
/* /*
* View * View
*/ */
@ -132,14 +146,14 @@ if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a
} }
} }
if (GETPOST("search_ref")) if ($search_ref)
{ {
if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility if (is_numeric($search_ref)) $sql .= natural_search(array('fac.rowid', 'fac.ref'), $search_ref);// For backward compatibility
else $sql .= natural_search('fac.ref', GETPOST("search_ref")); else $sql .= natural_search('fac.ref', $search_ref);
} }
if (GETPOST("search_ref_supplier")) if (search_ref_supplier)
{ {
$sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier')); $sql .= natural_search('fac.ref_supplier', $search_ref_supplier);
} }
if ($month > 0) if ($month > 0)
{ {
@ -152,24 +166,24 @@ else if ($year > 0)
{ {
$sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
} }
if (GETPOST("search_libelle")) if ($search_label)
{ {
$sql .= natural_search('fac.libelle', GETPOST('search_libelle')); $sql .= natural_search('fac.libelle', $search_label);
} }
if (GETPOST("search_societe")) if ($search_company)
{ {
$sql .= natural_search('s.nom', GETPOST('search_societe')); $sql .= natural_search('s.nom', $search_company);
} }
if (GETPOST("search_montant_ht")) if ($search_amount_no_tax)
{ {
$sql .= " AND fac.total_ht = '".$db->escape(price2num(GETPOST("search_montant_ht")))."'"; $sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'";
} }
if (GETPOST("search_montant_ttc")) if ($search_amount_all_tax)
{ {
$sql .= " AND fac.total_ttc = '".$db->escape(price2num(GETPOST("search_montant_ttc")))."'"; $sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'";
} }
$nbtotalofrecords = 0; $nbtotalofrecords = 0;
@ -195,14 +209,14 @@ if ($resql)
} }
$param='&socid='.$socid; $param='&socid='.$socid;
if ($month) $param.='&month='.urlencode($month); if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&year=' .urlencode($year); if ($year) $param.='&year=' .urlencode($year);
if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref")); if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier);
if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle")); if ($search_label) $param.='&search_label='.urlencode($search_label);
if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe")); if ($search_company) $param.='&search_company='.urlencode($search_company);
if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht")); if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax);
if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc")); if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre")); if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre"));
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
@ -218,17 +232,18 @@ if ($resql)
if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.GETPOST("search_ref").'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.GETPOST("search_ref_supplier").'">'; print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="1" align="center">'; print '<td class="liste_titre" colspan="1" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
@ -239,10 +254,10 @@ if ($resql)
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" size="16" type="text" name="search_libelle" value="'.GETPOST("search_libelle").'">'; print '<input class="flat" size="16" type="text" name="search_label" value="'.$search_label.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_societe" value="'.GETPOST("search_societe").'">'; print '<input class="flat" type="text" size="8" name="search_company" value="'.$search_company.'">';
print '</td>'; print '</td>';
if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS))
{ {
@ -250,13 +265,15 @@ if ($resql)
print '</td>'; print '</td>';
} }
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.GETPOST("search_montant_ht").'">'; print '<input class="flat" type="text" size="8" name="search_amount_no_tax" value="'.$search_amount_no_tax.'">';
print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.GETPOST("search_montant_ttc").'">';
print '</td><td class="liste_titre" align="center">';
$liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed")); $liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed"));
print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1); print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1);
print '<input type="image" class="liste_titre" align="right" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '</td><td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -313,6 +330,8 @@ if ($resql)
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5); print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5);
print '</td>'; print '</td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
@ -325,6 +344,7 @@ if ($resql)
print '<td class="liste_total" align="right">'.price($total).'</td>'; print '<td class="liste_total" align="right">'.price($total).'</td>';
print '<td class="liste_total" align="right">'.price($total_ttc).'</td>'; print '<td class="liste_total" align="right">'.price($total_ttc).'</td>';
print '<td class="liste_total" align="center">&nbsp;</td>'; print '<td class="liste_total" align="center">&nbsp;</td>';
print '<td class="liste_total" align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }

View File

@ -459,6 +459,15 @@ if (empty($action))
$search_amount=GETPOST('search_amount'); $search_amount=GETPOST('search_amount');
$search_company=GETPOST('search_company'); $search_company=GETPOST('search_company');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$search_account="";
$search_paymenttype="";
$search_amount="";
$search_company="";
}
$sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
$sql.= ' s.rowid as socid, s.nom as name,'; $sql.= ' s.rowid as socid, s.nom as name,';
$sql.= ' c.libelle as paiement_type,'; $sql.= ' c.libelle as paiement_type,';
@ -494,7 +503,7 @@ if (empty($action))
} }
if (! empty($search_amount)) if (! empty($search_amount))
{ {
$sql .= " AND p.amount=".price2num($search_amount); $sql .= " AND p.amount='".price2num($search_amount)."'";
} }
if (! empty($search_company)) if (! empty($search_company))
{ {
@ -515,7 +524,7 @@ if (empty($action))
$paramlist=''; $paramlist='';
$paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:""); $paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:"");
$paramlist.=(! empty($search_company)?"&search_company=".$search_company:""); $paramlist.=(! empty($search_company)?"&search_company=".$search_company:"");
$paramlist.=(! empty($search_amount)?"&search_amount=".$search_amount:""); $paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:"");
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num);
@ -529,16 +538,17 @@ if (empty($action))
print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'f.amount','',$paramlist,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'f.amount','',$paramlist,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder);
print "</tr>\n"; print '<td class="liste_titre">&nbsp;</td>';
print "</tr>\n";
// Lines for filters fields // Lines for filters fields
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="left">'; print '<td align="left">';
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$search_ref.'">'; print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td align="left">'; print '<td align="left">';
print '<input class="fat" type="text" size="6" name="search_company" value="'.$search_company.'">'; print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
@ -547,9 +557,11 @@ if (empty($action))
$form->select_comptes($search_account,'search_account',0,'',1); $form->select_comptes($search_account,'search_account',0,'',1);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$search_amount.'">'; print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" alt="'.$langs->trans("Search").'">'; print '</td><td align="right">';
print '</td>'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n"; print "</tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
@ -585,6 +597,7 @@ if (empty($action))
print $invoicesupplierstatic->getNomUrl(1); print $invoicesupplierstatic->getNomUrl(1);
print '</td>';*/ print '</td>';*/
print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -32,15 +32,15 @@ $langs->load("suppliers");
$langs->load("orders"); $langs->load("orders");
$langs->load("companies"); $langs->load("companies");
$socname = GETPOST("socname"); $socname = GETPOST("socname");
$search_nom = GETPOST("search_nom"); $search_name = GETPOST("search_name");
$search_zipcode = GETPOST("search_zipcode"); $search_zipcode = GETPOST("search_zipcode");
$search_town = GETPOST("search_town"); $search_town = GETPOST("search_town");
$search_code_fournisseur = GETPOST("search_code_fournisseur"); $search_supplier_code = GETPOST("search_supplier_code");
$search_compta_fournisseur = GETPOST("search_compta_fournisseur"); $search_supplier_accounting = GETPOST("search_supplier_accounting");
$search_datec = GETPOST("search_datec"); $search_datec = GETPOST("search_datec");
$search_categ = GETPOST('search_categ','int'); $search_categ = GETPOST('search_categ','int');
$catid = GETPOST("catid",'int'); $catid = GETPOST("catid",'int');
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -60,6 +60,19 @@ if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('supplierlist')); $hookmanager->initHooks(array('supplierlist'));
if (GETPOST("button_removefilter_x"))
{
$socname="";
$search_name="";
$search_zipcode="";
$search_town="";
$search_supplier_code="";
$search_supplier_accounting="";
$search_datec="";
$search_categ="";
$catid="";
}
/* /*
* Actions * Actions
*/ */
@ -95,15 +108,15 @@ if ($socname) {
$sortfield = "s.nom"; $sortfield = "s.nom";
$sortorder = "ASC"; $sortorder = "ASC";
} }
if ($search_nom) { if ($search_name) {
$sql .= natural_search('s.nom', $search_nom); $sql .= natural_search('s.nom', $search_name);
} }
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) { if ($search_town) {
$sql .= natural_search('s.town', $search_town); $sql .= natural_search('s.town', $search_town);
} }
if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'"; if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'";
if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'"; if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'";
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid; if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL"; if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL";
@ -126,7 +139,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param = "&amp;search_nom=".$search_nom."&amp;search_code_fournisseur=".$search_code_fournisseur."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town; $param = "&amp;search_name=".$search_name."&amp;search_supplier_code=".$search_supplier_code."&amp;search_zipcode=".$search_zipcode."&amp;search_town=".$search_town;
if ($search_categ != '') $param.='&amp;search_categ='.$search_categ; if ($search_categ != '') $param.='&amp;search_categ='.$search_categ;
print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
@ -166,25 +179,27 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$search_nom.'"></td>'; print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_name" value="'.$search_name.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>'; print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_zipcode" value="'.$search_zipcode.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_town" value="'.$search_town.'"></td>'; print '<td class="liste_titre"><input type="text" size="10" class="flat" name="search_town" value="'.$search_town.'"></td>';
print '<td align="left" class="liste_titre">'; print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_code_fournisseur" value="'.$search_code_fournisseur.'">'; print '<input class="flat" type="text" size="10" name="search_supplier_code" value="'.$search_supplier_code.'">';
print '</td>'; print '</td>';
print '<td align="left" class="liste_titre">'; print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_compta_fournisseur" value="'.$search_compta_fournisseur.'">'; print '<input class="flat" type="text" size="10" name="search_supplier_accounting" value="'.$search_supplier_accounting.'">';
print '</td>'; print '</td>';
print '<td align="right" class="liste_titre">'; print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">'; print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$parameters=array(); $parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook

View File

@ -64,6 +64,19 @@ $search_employe = GETPOST('search_employe');
$search_valideur = GETPOST('search_valideur'); $search_valideur = GETPOST('search_valideur');
$search_statut = GETPOST('select_statut'); $search_statut = GETPOST('select_statut');
if (GETPOST("button_removefilter"))
{
$search_ref="";
$month_create="";
$year_create="";
$month_start="";
$year_start="";
$month_end="";
$year_end="";
$search_employe="";
$search_valideur="";
$search_statut="";
}
/* /*
* Actions * Actions
@ -71,8 +84,6 @@ $search_statut = GETPOST('select_statut');
// None // None
/* /*
* View * View
*/ */
@ -257,7 +268,7 @@ print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_use
print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder);
print '<td></td>'; print '<td></td>';
print "</tr>\n"; print "</tr>\n";
@ -323,7 +334,8 @@ print '</td>';
// ACTION // ACTION
print '<td align="right">'; print '<td align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" alt="'.$langs->trans('Search').'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -0,0 +1,21 @@
(The MIT License)
Copyright (c) 2012-2014 Zhixin Wen <wenzhixin2010@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,96 @@
# Multiple Select
Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
To get started checkout examples and documentation at http://wenzhixin.net.cn/p/multiple-select
## Contributors
Multiple select is due to the excellent work of the following contributors:
<table>
<tbody>
<tr><th align="left">文翼</th><td><a href="https://github.com/wenzhixin">GitHub/wenzhixin</a></td></tr>
<tr><th align="left">Gaurav Jassal</th><td><a href="https://github.com/creativeaura">GitHub/creativeaura</a></td><</tr>
<tr><th align="left">guli</th><td><a href="https://github.com/guli">GitHub/guli</a></td></tr>
<tr><th align="left">jwheadon</th><td><a href="https://github.com/jwheadon">GitHub/jwheadon</a></td></tr>
<tr><th align="left">yx</th><td><a href="https://github.com/qqfish">GitHub/qqfish</a></td></tr>
<tr><th align="left">Tobias Macey</th><td><a href="https://github.com/blarghmatey">GitHub/blarghmatey</a></td></tr>
<tr><th align="left">Jona Goldman</th><td><a href="https://github.com/jonagoldman">GitHub/jonagoldman</a></td></tr>
<tr><th align="left">Alex Jeffrey</th><td><a href="https://github.com/ajeffrey">GitHub/ajeffrey</a></td></tr>
</tbody>
</table>
## Changelog
### 1.1.0
* Fix #63: Add ```keepOpen``` option.
* Fix #62: Fix ```isOpen``` and ```filter``` options are both true bug.
* Fix #57: Fire onCheckAll event when literally select.
* Add data attributes for support.
* Fix #55: Add ```name``` option.
### 1.0.9
* Fix #42: Add ```styler``` option to custom item style.
* Fix firefox click bug.
* Add ```allSelected```, ```minumimCountSelected``` and ```countSelected``` options.
* Fix #35: Add ```onFocus``` and ```onBlur``` events.
* Fix #25: Add ```focus``` and ```blur``` methods.
* Fix #31: Trigger the onCheckAll & onUncheckAll events when use filter to select all.
### 1.0.8
* Update the license to The MIT License.
* Fix #47: Add ```No matches found``` message when there are no results found.
* Fix #43: Add ```position``` option.
### 1.0.7
* Fix #44: The filters not working bugs.
### 1.0.6
* Fix #21: Add ```single``` option.
* Add ```override``` option.
* Add ```container``` option.
* Fix #29: Update the optgroups select text.
* Fix #30: Image is not shown in Firefox 25.0.1.
* Fix #22: fix group filter problem.
### 1.0.5
* Update the button text witdh.
* Add keyboard support.
### 1.0.4
* Fix #12: Add ```width``` option.
* Fix #11: Add callback events.
* Add ```maxHeight``` option.
### 1.0.3
* Fix #4: Add ```filter``` option.
* Support mobile devices.
* Fix #6: Add ```refresh``` method.
### 1.0.2
* Fix #7: Add ```selected``` and ```disabled``` options.
* Fix #5: Add ```checkAll``` and ```uncheckAll``` methods.
### 1.0.1
* Fix #3: Add optgroups support.
* Add ```placeholder``` option.
* Fix #2: use prop method instead of attr.
### 1.0.0
* Initial release
## LICENSE
[The MIT License](https://github.com/wenzhixin/multiple-select/blob/master/LICENSE)

View File

@ -0,0 +1,466 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* @version 1.1.0
*
* http://wenzhixin.net.cn/p/multiple-select/
*/
(function($) {
'use strict';
function MultipleSelect($el, options) {
var that = this,
name = $el.attr('name') || options.name || '',
elWidth = $el.width();
this.$el = $el.hide();
this.options = options;
this.$parent = $('<div class="ms-parent"></div>');
this.$choice = $('<button type="button" class="ms-choice"><span class="placeholder">' +
options.placeholder + '</span><div></div></button>');
this.$drop = $('<div class="ms-drop ' + options.position + '"></div>');
this.$el.after(this.$parent);
this.$parent.append(this.$choice);
this.$parent.append(this.$drop);
if (this.$el.prop('disabled')) {
this.$choice.addClass('disabled');
}
this.$choice.css('width', elWidth + 'px');
this.$drop.css({
width: (options.width || elWidth) + 'px'
});
if (!this.options.keepOpen) {
$('body').click(function(e) {
if ($(e.target)[0] === that.$choice[0] ||
$(e.target).parents('.ms-choice')[0] === that.$choice[0]) {
return;
}
if (($(e.target)[0] === that.$drop[0] ||
$(e.target).parents('.ms-drop')[0] !== that.$drop[0]) &&
that.options.isOpen) {
that.close();
}
});
}
this.selectAllName = 'name="selectAll' + name + '"';
this.selectGroupName = 'name="selectGroup' + name + '"';
this.selectItemName = 'name="selectItem' + name + '"';
}
MultipleSelect.prototype = {
constructor : MultipleSelect,
init: function() {
var that = this,
html = [];
if (this.options.filter) {
html.push(
'<div class="ms-search">',
'<input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false">',
'</div>'
);
}
html.push('<ul>');
if (this.options.selectAll && !this.options.single) {
html.push(
'<li>',
'<label>',
'<input type="checkbox" ' + this.selectAllName + ' /> ',
'[' + this.options.selectAllText + ']',
'</label>',
'</li>'
);
}
$.each(this.$el.children(), function(i, elm) {
html.push(that.optionToHtml(i, elm));
});
html.push('<li class="ms-no-results">No matches found</li>');
html.push('</ul>');
this.$drop.html(html.join(''));
this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px');
this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px');
this.$searchInput = this.$drop.find('.ms-search input');
this.$selectAll = this.$drop.find('input[' + this.selectAllName + ']');
this.$selectGroups = this.$drop.find('input[' + this.selectGroupName + ']');
this.$selectItems = this.$drop.find('input[' + this.selectItemName + ']:enabled');
this.$disableItems = this.$drop.find('input[' + this.selectItemName + ']:disabled');
this.$noResults = this.$drop.find('.ms-no-results');
this.events();
this.update();
if (this.options.isOpen) {
this.open();
}
},
optionToHtml: function(i, elm, group, groupDisabled) {
var that = this,
$elm = $(elm),
html = [],
multiple = this.options.multiple,
disabled,
type = this.options.single ? 'radio' : 'checkbox';
if ($elm.is('option')) {
var value = $elm.val(),
text = $elm.text(),
selected = $elm.prop('selected'),
style = this.options.styler(value) ? ' style="' + this.options.styler(value) + '"' : '';
disabled = groupDisabled || $elm.prop('disabled');
html.push(
'<li' + (multiple ? ' class="multiple"' : '') + style + '>',
'<label' + (disabled ? ' class="disabled"' : '') + '>',
'<input type="' + type + '" ' + this.selectItemName + ' value="' + value + '"' +
(selected ? ' checked="checked"' : '') +
(disabled ? ' disabled="disabled"' : '') +
(group ? ' data-group="' + group + '"' : '') +
'/> ',
text,
'</label>',
'</li>'
);
} else if (!group && $elm.is('optgroup')) {
var _group = 'group_' + i,
label = $elm.attr('label');
disabled = $elm.prop('disabled');
html.push(
'<li class="group">',
'<label class="optgroup' + (disabled ? ' disabled' : '') + '" data-group="' + _group + '">',
'<input type="checkbox" ' + this.selectGroupName +
(disabled ? ' disabled="disabled"' : '') + ' /> ',
label,
'</label>',
'</li>');
$.each($elm.children(), function(i, elm) {
html.push(that.optionToHtml(i, elm, _group, disabled));
});
}
return html.join('');
},
events: function() {
var that = this;
this.$choice.off('click').on('click', function(e) {
e.preventDefault();
that[that.options.isOpen ? 'close' : 'open']();
})
.off('focus').on('focus', this.options.onFocus)
.off('blur').on('blur', this.options.onBlur);
this.$parent.off('keydown').on('keydown', function(e) {
switch (e.which) {
case 27: // esc key
that.close();
that.$choice.focus();
break;
}
});
this.$searchInput.off('keyup').on('keyup', function() {
that.filter();
});
this.$selectAll.off('click').on('click', function() {
var checked = $(this).prop('checked'),
$items = that.$selectItems.filter(':visible');
if ($items.length === that.$selectItems.length) {
that[checked ? 'checkAll' : 'uncheckAll']();
} else { // when the filter option is true
that.$selectGroups.prop('checked', checked);
$items.prop('checked', checked);
that.options[checked ? 'onCheckAll' : 'onUncheckAll']();
that.update();
}
});
this.$selectGroups.off('click').on('click', function() {
var group = $(this).parent().attr('data-group'),
$items = that.$selectItems.filter(':visible'),
$children = $items.filter('[data-group="' + group + '"]'),
checked = $children.length !== $children.filter(':checked').length;
$children.prop('checked', checked);
that.updateSelectAll();
that.update();
that.options.onOptgroupClick({
label: $(this).parent().text(),
checked: checked,
children: $children.get()
});
});
this.$selectItems.off('click').on('click', function() {
that.updateSelectAll();
that.update();
that.updateOptGroupSelect();
that.options.onClick({
label: $(this).parent().text(),
value: $(this).val(),
checked: $(this).prop('checked')
});
});
},
open: function() {
if (this.$choice.hasClass('disabled')) {
return;
}
this.options.isOpen = true;
this.$choice.find('>div').addClass('open');
this.$drop.show();
if (this.options.container) {
var offset = this.$drop.offset();
this.$drop.appendTo($(this.options.container));
this.$drop.offset({ top: offset.top, left: offset.left });
}
if (this.options.filter) {
this.$searchInput.val('');
this.filter();
}
this.options.onOpen();
},
close: function() {
this.options.isOpen = false;
this.$choice.find('>div').removeClass('open');
this.$drop.hide();
if (this.options.container) {
this.$parent.append(this.$drop);
this.$drop.css({
'top': 'auto',
'left': 'auto'
})
}
this.options.onClose();
},
update: function() {
var selects = this.getSelects('text'),
$span = this.$choice.find('>span');
if (selects.length === this.$selectItems.length + this.$disableItems.length && this.options.allSelected) {
$span.removeClass('placeholder').html(this.options.allSelected);
} else if (selects.length > this.options.minumimCountSelected && this.options.countSelected) {
$span.removeClass('placeholder').html(this.options.countSelected
.replace('#', selects.length)
.replace('%', this.$selectItems.length + this.$disableItems.length));
} else if (selects.length) {
$span.removeClass('placeholder').html(selects.join(', '));
} else {
$span.addClass('placeholder').html(this.options.placeholder);
}
// set selects to select
this.$el.val(this.getSelects());
},
updateSelectAll: function() {
var $items = this.$selectItems.filter(':visible');
this.$selectAll.prop('checked', $items.length &&
$items.length === $items.filter(':checked').length);
if (this.$selectAll.prop('checked')) {
this.options.onCheckAll();
}
},
updateOptGroupSelect: function() {
var $items = this.$selectItems.filter(':visible');
$.each(this.$selectGroups, function(i, val) {
var group = $(val).parent().attr('data-group'),
$children = $items.filter('[data-group="' + group + '"]');
$(val).prop('checked', $children.length &&
$children.length === $children.filter(':checked').length);
});
},
//value or text, default: 'value'
getSelects: function(type) {
var that = this,
texts = [],
values = [];
this.$drop.find('input[' + this.selectItemName + ']:checked').each(function() {
texts.push($(this).parent().text());
values.push($(this).val());
});
if (type === 'text' && this.$selectGroups.length) {
texts = [];
this.$selectGroups.each(function() {
var html = [],
text = $.trim($(this).parent().text()),
group = $(this).parent().data('group'),
$children = that.$drop.find('[' + that.selectItemName + '][data-group="' + group + '"]'),
$selected = $children.filter(':checked');
if ($selected.length === 0) {
return;
}
html.push('[');
html.push(text);
if ($children.length > $selected.length) {
var list = [];
$selected.each(function() {
list.push($(this).parent().text());
});
html.push(': ' + list.join(', '));
}
html.push(']');
texts.push(html.join(''));
});
}
return type === 'text' ? texts : values;
},
setSelects: function(values) {
var that = this;
this.$selectItems.prop('checked', false);
$.each(values, function(i, value) {
that.$selectItems.filter('[value="' + value + '"]').prop('checked', true);
});
this.$selectAll.prop('checked', this.$selectItems.length ===
this.$selectItems.filter(':checked').length);
this.update();
},
enable: function() {
this.$choice.removeClass('disabled');
},
disable: function() {
this.$choice.addClass('disabled');
},
checkAll: function() {
this.$selectItems.prop('checked', true);
this.$selectGroups.prop('checked', true);
this.$selectAll.prop('checked', true);
this.update();
this.options.onCheckAll();
},
uncheckAll: function() {
this.$selectItems.prop('checked', false);
this.$selectGroups.prop('checked', false);
this.$selectAll.prop('checked', false);
this.update();
this.options.onUncheckAll();
},
focus: function() {
this.$choice.focus();
this.options.onFocus();
},
blur: function() {
this.$choice.blur();
this.options.onBlur();
},
refresh: function() {
this.init();
},
filter: function() {
var that = this,
text = $.trim(this.$searchInput.val()).toLowerCase();
if (text.length === 0) {
this.$selectItems.parent().show();
this.$disableItems.parent().show();
this.$selectGroups.parent().show();
} else {
this.$selectItems.each(function() {
var $parent = $(this).parent();
$parent[$parent.text().toLowerCase().indexOf(text) < 0 ? 'hide' : 'show']();
});
this.$disableItems.parent().hide();
this.$selectGroups.each(function() {
var $parent = $(this).parent();
var group = $parent.attr('data-group'),
$items = that.$selectItems.filter(':visible');
$parent[$items.filter('[data-group="' + group + '"]').length === 0 ? 'hide' : 'show']();
});
//Check if no matches found
if (this.$selectItems.filter(':visible').length) {
this.$selectAll.parent().show();
this.$noResults.hide();
} else {
this.$selectAll.parent().hide();
this.$noResults.show();
}
}
this.updateOptGroupSelect();
this.updateSelectAll();
}
};
$.fn.multipleSelect = function() {
var option = arguments[0],
args = arguments,
value,
allowedMethods = [
'getSelects', 'setSelects',
'enable', 'disable',
'checkAll', 'uncheckAll',
'focus', 'blur',
'refresh'
];
this.each(function() {
var $this = $(this),
data = $this.data('multipleSelect'),
options = $.extend({}, $.fn.multipleSelect.defaults,
$this.data(), typeof option === 'object' && option);
if (!data) {
data = new MultipleSelect($this, options);
$this.data('multipleSelect', data);
}
if (typeof option === 'string') {
if ($.inArray(option, allowedMethods) < 0) {
throw "Unknown method: " + option;
}
value = data[option](args[1]);
} else {
data.init();
}
});
return value ? value : this;
};
$.fn.multipleSelect.defaults = {
name: '',
isOpen: false,
placeholder: '',
selectAll: true,
selectAllText: 'Select all',
allSelected: 'All selected',
minumimCountSelected: 3,
countSelected: '# of % selected',
multiple: false,
multipleWidth: 80,
single: false,
filter: false,
width: undefined,
maxHeight: 250,
container: null,
position: 'bottom',
keepOpen: false,
styler: function() {return false;},
onOpen: function() {return false;},
onClose: function() {return false;},
onCheckAll: function() {return false;},
onUncheckAll: function() {return false;},
onFocus: function() {return false;},
onBlur: function() {return false;},
onOptgroupClick: function() {return false;},
onClick: function() {return false;}
};
})(jQuery);

View File

@ -0,0 +1,183 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
*/
.ms-parent {
display: inline-block;
position: relative;
vertical-align: middle;
}
.ms-choice {
display: block;
height: 26px;
padding: 0;
overflow: hidden;
cursor: pointer;
border: 1px solid #aaa;
text-align: left;
white-space: nowrap;
line-height: 26px;
color: #444;
text-decoration: none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
}
.ms-choice.disabled {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
}
.ms-choice > span {
position: absolute;
top: 0;
left: 0;
right: 20px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
padding-left: 8px;
}
.ms-choice > span.placeholder {
color: #999;
}
.ms-choice > div {
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 25px;
background: url('multiple-select.png') right top no-repeat;
}
.ms-choice > div.open {
background: url('multiple-select.png') left top no-repeat;
}
.ms-drop {
overflow: hidden;
display: none;
margin-top: -1px;
padding: 0;
position: absolute;
z-index: 1000;
background: #fff;
color: #000;
border: 1px solid #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.ms-drop.bottom {
top: 100%;
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
}
.ms-drop.top {
bottom: 100%;
-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
-moz-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
}
.ms-search {
display: inline-block;
margin: 0;
min-height: 26px;
padding: 4px;
position: relative;
white-space: nowrap;
width: 100%;
z-index: 10000;
}
.ms-search input {
width: 100%;
height: auto !important;
min-height: 24px;
padding: 0 20px 0 5px;
margin: 0;
outline: 0;
font-family: sans-serif;
font-size: 1em;
border: 1px solid #aaa;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
background: #fff url('multiple-select.png') no-repeat 100% -22px;
background: url('multiple-select.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('multiple-select.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%);
background: url('multiple-select.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%, #eeeeee 99%);
}
.ms-search, .ms-search input {
-webkit-box-sizing: border-box;
-khtml-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ms-drop ul {
overflow: auto;
margin: 0;
padding: 5px 8px;
}
.ms-drop ul > li {
list-style: none;
display: list-item;
background-image: none;
position: static;
}
.ms-drop ul > li .disabled {
opacity: .35;
filter: Alpha(Opacity=35);
}
.ms-drop ul > li.multiple {
display: block;
float: left;
}
.ms-drop ul > li.group {
clear: both;
}
.ms-drop ul > li.multiple label {
width: 100%;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ms-drop ul > li label.optgroup {
font-weight: bold;
}
.ms-drop input[type="checkbox"] {
vertical-align: middle;
}
.ms-drop .ms-no-results {
display: none;
}

View File

@ -0,0 +1,28 @@
{
"name": "multiple-select",
"version": "1.1.0",
"title": "Multiple Select",
"description": "Multiple select is a jQuery plugin to select multiple elements with checkboxes :).",
"author": {
"name": "zhixin wen",
"email": "wenzhixin2010@gmail.com",
"url": "http://wenzhixin.net.cn/"
},
"licenses": [
{
"type": "MIT License",
"url": "http://opensource.org/licenses/MIT"
}
],
"dependencies": {
"jquery": ">=1.7"
},
"keywords": ["multiple.select", "select.list", "multiple.choose", "checkbox"],
"homepage": "http://wenzhixin.net.cn/p/multiple-select/",
"demo": "http://wenzhixin.net.cn/p/multiple-select/#examples",
"bugs": {
"url": "https://github.com/wenzhixin/multiple-select/issues"
},
"docs": "http://wenzhixin.net.cn/p/multiple-select/#documentation",
"download": "https://github.com/wenzhixin/multiple-select/archive/master.zip"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,20 +0,0 @@
Copyright (c) 2009 Michael Aufreiter, http://www.quasipartikel.at
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,31 +0,0 @@
/* Multiselect
----------------------------------*/
.ui-multiselect { border: solid 1px; font-size: 0.8em; }
.ui-multiselect ul { -moz-user-select: none; }
.ui-multiselect li { margin: 0; padding: 0; cursor: default; line-height: 20px; height: 20px; font-size: 11px; list-style: none; padding-right: 18px; overflow: hidden; }
.ui-multiselect li a { color: #999; text-decoration: none; padding: 0; display: block; float: left; cursor: pointer;}
.ui-multiselect li.ui-draggable-dragging { padding-left: 10px; }
.ui-multiselect div.selected { position: relative; padding: 0; margin: 0; border: 0; float:left; }
.ui-multiselect ul.selected { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; position: relative; width: 100%; }
.ui-multiselect div.available { position: relative; padding: 0; margin: 0; border: 0; float:left; }
.ui-multiselect ul.available { position: relative; padding: 0; overflow: auto; overflow-x: hidden; background: #fff; margin: 0; list-style: none; border: 0; width: 100%; }
.ui-multiselect ul.available li { padding-left: 10px; }
.ui-multiselect div.right-column { border-left: 1px solid; }
.ui-multiselect .ui-state-default { border: none; margin-bottom: 1px; position: relative; padding-left: 20px;}
.ui-multiselect .ui-state-hover { border: none; }
.ui-multiselect .ui-widget-header {border: none; font-size: 11px; margin-bottom: 1px;}
.ui-multiselect .add-all { float: right; padding: 7px;}
.ui-multiselect .remove-all { float: right; padding: 7px;}
.ui-multiselect .search { float: left; padding: 4px;}
.ui-multiselect .count { float: left; padding: 7px;}
.ui-multiselect li span.ui-icon-arrowthick-2-n-s { position: absolute; left: 2px; }
.ui-multiselect li a.action { position: absolute; right: 2px; top: 2px; }
.ui-multiselect input.search { height: 14px; padding: 1px; opacity: 0.5; margin: 4px; width: 100px; }

View File

@ -1,480 +0,0 @@
/*
* jQuery UI Multiselect
*
* Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://www.quasipartikel.at/multiselect/
*
*
* Depends:
* ui.core.js
* ui.sortable.js
*
* Optional:
* localization (http://plugins.jquery.com/project/localisation)
* scrollTo (http://plugins.jquery.com/project/ScrollTo)
*
* Todo:
* Make batch actions faster
* Implement dynamic insertion through remote calls
*/
(function($) {
$.widget("ui.multiselect", {
options: {
sortable: true,
dragToAdd: true,
searchable: true,
doubleClickable: true,
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
dividerLocation: 0.6,
selectedContainerOnLeft: true,
width: null,
height: null,
nodeComparator: function(node1,node2) {
var text1 = node1.text(),
text2 = node2.text();
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
},
includeRemoveAll: true,
includeAddAll: true,
pressEnterKeyToAddAll: false
},
_create: function() {
this.element.hide();
this.id = this.element.attr("id");
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
this.count = 0; // number of currently selected options
this.selectedContainer = $('<div class="selected"></div>');
if (this.options.selectedContainerOnLeft) {
this.selectedContainer.appendTo(this.container);
this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
this.availableContainer.addClass('right-column');
}
else
{
this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
this.selectedContainer.appendTo(this.container);
this.selectedContainer.addClass('right-column');
}
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span>'+(this.options.includeRemoveAll?'<a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a>':'<span class="remove-all">&nbsp;</span>')+'</div>').appendTo(this.selectedContainer);
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/>'+(this.options.includeAddAll?'<a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a>':'<span class="add-all">&nbsp;</span>')+'</div>').appendTo(this.availableContainer);
this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
var that = this;
var width = this.options.width;
if (!width) {
width = this.element.width();
}
var height = this.options.height;
if (!height) {
height = this.element.height();
}
// set dimensions
this.container.width(width-2);
if (this.options.selectedContainerOnLeft) {
this.selectedContainer.width(Math.floor(width*this.options.dividerLocation)-1);
this.availableContainer.width(Math.floor(width*(1-this.options.dividerLocation))-2);
}
else
{
this.selectedContainer.width(Math.floor(width*this.options.dividerLocation)-2);
this.availableContainer.width(Math.floor(width*(1-this.options.dividerLocation))-1);
}
// fix list height to match <option> depending on their individual header's heights
this.selectedList.height(Math.max(height-this.selectedActions.height(),1));
this.availableList.height(Math.max(height-this.availableActions.height(),1));
if ( !this.options.animated ) {
this.options.show = 'show';
this.options.hide = 'hide';
}
// init lists
this._populateLists(this.element.find('option'));
// make selection sortable
if (this.options.sortable) {
this.selectedList.sortable({
placeholder: 'ui-state-highlight',
axis: 'y',
update: function(event, ui) {
// apply the new sort order to the original selectbox
that.selectedList.find('li').each(function() {
if ($(this).data('optionLink'))
$(this).data('optionLink').remove().appendTo(that.element);
});
},
beforeStop: function (event, ui) {
// This lets us recognize which item was just added to
// the list in receive, per the workaround for not being
// able to reference the new element.
ui.item.addClass('dropped');
},
receive: function(event, ui) {
ui.item.data('optionLink').attr('selected', true);
// increment count
that.count += 1;
that._updateCount();
// workaround, because there's no way to reference
// the new element, see http://dev.jqueryui.com/ticket/4303
that.selectedList.children('.dropped').each(function() {
$(this).removeClass('dropped');
$(this).data('optionLink', ui.item.data('optionLink'));
$(this).data('idx', ui.item.data('idx'));
that._applyItemState($(this), true);
});
// workaround according to http://dev.jqueryui.com/ticket/4088
setTimeout(function() { ui.item.remove(); }, 1);
},
stop: function (event, ui) { that.element.change(); }
});
}
// set up livesearch
if (this.options.searchable) {
this._registerSearchEvents(this.availableContainer.find('input.search'));
} else {
$('.search').hide();
}
// batch actions
this.container.find(".remove-all").click(function() {
that._populateLists(that.element.find('option').removeAttr('selected'));
that.element.trigger('change');
return false;
});
this.container.find(".add-all").click(function() {
var options = that.element.find('option').not(":selected");
if (that.availableList.children('li:hidden').length > 1) {
that.availableList.children('li').each(function(i) {
if ($(this).is(":visible")) $(options[i-1]).attr('selected', 'selected');
});
} else {
options.attr('selected', 'selected');
}
that._populateLists(that.element.find('option'));
that.element.trigger('change');
if (that.options.pressEnterKeyToAddAll) {
//clear input after add all
$('input.search').val("");
}
return false;
});
},
destroy: function() {
this.element.show();
this.container.remove();
$.Widget.prototype.destroy.apply(this, arguments);
},
addOption: function(option) {
// Append the option
option = $(option);
var select = this.element;
select.append(option);
var item = this._getOptionNode(option).appendTo(option.attr('selected') ? this.selectedList : this.availableList).show();
if (option.attr('selected')) {
this.count += 1;
}
this._applyItemState(item, option.attr('selected'));
item.data('idx', this.count);
// update count
this._updateCount();
this._filter.apply(this.availableContainer.find('input.search'), [this.availableList]);
},
// Redisplay the lists of selected/available options.
// Call this after you've selected/unselected some options programmatically.
// GRIPE This is O(n) where n is the length of the list - seems like
// there must be a smarter way of doing this, but I have not been able
// to come up with one. I see no way to detect programmatic setting of
// the option's selected property, and without that, it seems like we
// can't have a general-case listener that does its thing every time an
// option is selected.
refresh: function() {
// Redisplay our lists.
this._populateLists(this.element.find('option'));
},
_populateLists: function(options) {
this.selectedList.children('.ui-element').remove();
this.availableList.children('.ui-element').remove();
this.count = 0;
var that = this;
var groups = $(this.element).find("optgroup").map(function(i) {
return that._getOptionGroup($(this));
});
groups.appendTo(this.selectedList.add(this.availableList));
var items = $(options.map(function(i) {
var item = that._getOptionNode(this).appendTo(that._getOptionList(this)).show();
if (this.selected) that.count += 1;
that._applyItemState(item, this.selected);
item.data('idx', i);
return item[0];
}));
// update count
this._updateCount();
that._filter.apply(this.availableContainer.find('input.search'), [that.availableList]);
},
_getOptionList: function(option) {
var selected = option.selected;
option = $(option);
var $list = selected ? this.selectedList : this.availableList;
var $group = option.closest("optgroup");
if ($group.length === 0) {
return $list;
} else {
var $groupList = $list.find("ul[title='" + $group.attr("label") + "']");
if ($groupList.length === 0) {
$groupList = $("<ul class='ui-state-default ui-element available' title='" + $group.attr("label") + "'>" + $group.attr("label") + "</ul>").appendTo($list);
}
$groupList.show();
return $groupList;
}
},
_getOptionGroup : function(optgroup) {
var groupNode = $("<ul class='ui-state-default ui-element available' title='" + optgroup.attr("label") + "'>" + optgroup.attr("label") + "</ul>").hide();
return groupNode[0];
},
_updateCount: function() {
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
},
_getOptionNode: function(option) {
option = $(option);
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
node.data('optionLink', option);
return node;
},
// clones an item with associated data
// didn't find a smarter away around this
_cloneWithData: function(clonee) {
var clone = clonee.clone(false,false);
clone.data('optionLink', clonee.data('optionLink'));
clone.data('idx', clonee.data('idx'));
return clone;
},
_setSelected: function(item, selected) {
var temp = item.data('optionLink').attr('selected', selected);
var parent = temp.parent();
temp.detach().appendTo(parent);
this.element.trigger('change');
if (selected) {
var selectedItem = this._cloneWithData(item);
item[this.options.hide](this.options.animated, function() {
if (item.siblings().length === 0) {
item.closest("ul[title]").hide();
}
$(this).remove();
});
// get group to add it to...
var $list = this._getOptionList(selectedItem.data("optionLink")[0]);
selectedItem.appendTo($list).hide()[this.options.show](this.options.animated);
this._applyItemState(selectedItem, true);
return selectedItem;
} else {
// look for successor based on initial option index
var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
// TODO: test needed for dynamic list populating
if ( direction ) {
while (i>=0 && i<items.length) {
direction > 0 ? i++ : i--;
if ( direction != comparator(item, $(items[i])) ) {
// going up, go back one item down, otherwise leave as is
succ = items[direction > 0 ? i : i+1];
var group1 = item.closest("ul[title]"),
group2 = $(succ).closest("ul[title]");
if (group1.length !== 0 && group2.length !== 0) {
if (group1.attr("title") !== group2.attr("title")) {
succ = null;
}
}
break;
}
}
} else {
succ = items[i];
}
var availableItem = this._cloneWithData(item);
var $list = this._getOptionList(availableItem.data("optionLink")[0]);
succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo($list);
item[this.options.hide](this.options.animated, function() {
if (item.siblings().length === 0) {
item.closest("ul[title]").hide();
}
$(this).remove();
});
availableItem.hide()[this.options.show](this.options.animated);
this._applyItemState(availableItem, false);
return availableItem;
}
},
_applyItemState: function(item, selected) {
if (selected) {
if (this.options.sortable)
item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
else
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
this._registerRemoveEvents(item.find('a.action'));
} else {
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
this._registerAddEvents(item.find('a.action'));
}
this._registerDoubleClickEvents(item);
this._registerHoverEvents(item);
},
// taken from John Resig's liveUpdate script
_filter: function(list) {
var input = $(this);
var rows = list.find('li'),
cache = rows.map(function(){
return $(this).text().toLowerCase();
});
var term = $.trim(input.val().toLowerCase()), scores = [];
if (!term) {
rows.show();
} else {
rows.hide();
cache.each(function(i) {
if (this.indexOf(term)>-1) { scores.push(i); }
});
$.each(scores, function() {
$(rows[this]).show();
});
}
},
_registerDoubleClickEvents: function(elements) {
if (!this.options.doubleClickable) return;
elements.dblclick(function() {
elements.find('a.action').click();
});
},
_registerHoverEvents: function(elements) {
elements.removeClass('ui-state-hover');
elements.mouseover(function() {
$(this).addClass('ui-state-hover');
});
elements.mouseout(function() {
$(this).removeClass('ui-state-hover');
});
},
_registerAddEvents: function(elements) {
var that = this;
elements.click(function() {
var item = that._setSelected($(this).parent(), true);
that.count += 1;
that._updateCount();
// Prevent extra clicks from triggering bogus add events, if a user
// tries clicking during the removal process.
$(this).unbind('click');
return false;
});
// make draggable
if (this.options.sortable && this.options.dragToAdd) {
elements.each(function() {
$(this).parent().draggable({
connectToSortable: that.selectedList,
helper: function() {
var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
selectedItem.width($(this).width());
return selectedItem;
},
appendTo: that.container,
containment: that.container,
revert: 'invalid'
});
});
}
},
_registerRemoveEvents: function(elements) {
var that = this;
elements.click(function() {
that._setSelected($(this).parent(), false);
that.count -= 1;
that._updateCount();
// Prevent extra clicks from triggering bogus remove events, if a
// user tries clicking during the removal process.
$(this).unbind('click');
return false;
});
},
_registerSearchEvents: function(input) {
var that = this;
input.focus(function() {
$(this).addClass('ui-state-active');
})
.blur(function() {
$(this).removeClass('ui-state-active');
})
.keypress(function(e) {
if (e.keyCode == 13) {
if (that.options.pressEnterKeyToAddAll) {
//on Enter, if a filter is present add all, then clear the input
var str = $('input.search').val();
if (str !== undefined && str !== null && str !== "") {
$('a.add-all').click();
$('input.search').val("");
}
}
return false;
}
})
.keyup(function() {
that._filter.apply(this, [that.availableList]);
});
}
});
$.extend($.ui.multiselect, {
locale: {
addAll:'Add all',
removeAll:'Remove all',
itemsCount:'items selected'
}
});
})(jQuery);

View File

@ -610,6 +610,21 @@ IMG;
closedir($handle); closedir($handle);
} }
} }
/**
* return the value present on odt in [valuename][/valuename]
* @param string $value name balise in the template
* @return string the value inside the balise
*
*/
public function getvalue($valuename)
{
$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
preg_match($searchreg, $this->contentXml, $matches);
$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
return $matches[1];
}
} }
?> ?>

Some files were not shown because too many files have changed in this diff Show More