Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Florian HENRY 2014-11-10 13:01:33 +01:00
commit efcc1dc8f5
284 changed files with 6165 additions and 4846 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

@ -5,6 +5,10 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* ***** ***** ChangeLog for 3.7 compared to 3.6.* *****
For users: For users:
- New: Agenda export by project #1967.
- New: Increase length of thirdparty to 128 chars.
- New: "Is Order shippable" icon #1975.
- New: statistics on supplier orders and invoices on home page.
- New: Add permissions to read all trips and expenses. - New: Add permissions to read all trips and expenses.
- New: Can filter on date into tab "Referring object" of a project. - New: Can filter on date into tab "Referring object" of a project.
- New: Module notification has been enhanced: - New: Module notification has been enhanced:
@ -95,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
@ -159,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.
@ -306,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

@ -1,74 +1,81 @@
dolibarr (3.6.1-3) unstable; urgency=low dolibarr (3.7.0-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 21 Oct 2014 12:00:00 +0100
dolibarr (3.6.1-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 23 Sep 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 23 Sep 2014 12:00:00 +0100
dolibarr (3.6.0-3) unstable; urgency=low dolibarr (3.6.0-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 15 July 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 15 July 2014 12:00:00 +0100
dolibarr (3.5.5-3) unstable; urgency=low dolibarr (3.5.5-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 8 July 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 8 July 2014 12:00:00 +0100
dolibarr (3.5.4-3) unstable; urgency=low dolibarr (3.5.4-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 1 July 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 1 July 2014 12:00:00 +0100
dolibarr (3.5.3-3) unstable; urgency=low dolibarr (3.5.3-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 2 May 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 2 May 2014 12:00:00 +0100
dolibarr (3.5.2-3) unstable; urgency=low dolibarr (3.5.2-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 14 March 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 14 March 2014 12:00:00 +0100
dolibarr (3.5.1-3) unstable; urgency=low dolibarr (3.5.1-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 7 Feb 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 7 Feb 2014 12:00:00 +0100
dolibarr (3.5.0-3) unstable; urgency=low dolibarr (3.5.0-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* New upstream release. * New upstream release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 31 Jan 2014 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Fri, 31 Jan 2014 12:00:00 +0100
dolibarr (3.4.2-3) unstable; urgency=low dolibarr (3.4.2-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* Maintenance release. * Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 30 Dec 2013 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 30 Dec 2013 12:00:00 +0100
dolibarr (3.4.1-3) unstable; urgency=low dolibarr (3.4.1-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* Maintenance release. * Maintenance release.
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 27 Apr 2013 12:00:00 +0100 -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Mon, 27 Apr 2013 12:00:00 +0100
dolibarr (3.4.0-3) unstable; urgency=low dolibarr (3.4.0-3) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ] [ Laurent Destailleur (eldy) ]
* Maintenance release. * Maintenance release.

View File

@ -17,9 +17,9 @@
; ----- Change this ----- ; ----- Change this -----
AppName=DoliWamp AppName=DoliWamp
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x ; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
AppVerName=DoliWamp-3.6.1 AppVerName=DoliWamp-3.7.0-beta
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x ; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
OutputBaseFilename=DoliWamp-3.6.1 OutputBaseFilename=DoliWamp-3.7.0-beta
; ----- End of change ; ----- End of change
;OutputManifestFile=build\doliwampbuild.log ;OutputManifestFile=build\doliwampbuild.log
; Define full path from which all relative path are defined ; Define full path from which all relative path are defined

View File

@ -61,13 +61,17 @@ If you want to build/test package locally:
- List of series are visible here: https://launchpad.net/dolibarr/+series - List of series are visible here: https://launchpad.net/dolibarr/+series
# To update Dolibarr into launchpad (when repository for sources already exists) # To update Dolibarr into launchpad (when remote repository for sources already exists)
#---------------------------------- #----------------------------------
# create local repository
cd bzr cd bzr
bzr branch lp:~yourlogin/dolibarr/[dev|beta|stable] bzr branch lp:~yourlogin/dolibarr/[develop|beta|stable] dolibarr-[dev|beta|stable]
cd dolibarr-[dev|beta|stable] cd dolibarr-[dev|beta|stable]
# Update
bzr update
-- Update files here. Remove all and overwrite --
bzr status bzr status
-- Update files here -- bzr add *
bzr commit -m "Description of change" bzr commit -m "Description of change"
bzr push bzr push

File diff suppressed because it is too large Load Diff

View File

@ -332,6 +332,9 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 * Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release - Upstream release

View File

@ -568,6 +568,9 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 * Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release - Upstream release

View File

@ -337,6 +337,9 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 * Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release - Upstream release

View File

@ -348,6 +348,9 @@ fi
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
%changelog %changelog
* Wed Oct 29 2014 Laurent Destailleur 3.7.0-0.3
- Upstream release
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3 * Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
- Upstream release - Upstream release

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

@ -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>';
@ -324,16 +322,15 @@ if ($action == 'create') {
print '<td>' . $line->credit . '</td>'; print '<td>' . $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->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";
@ -342,7 +339,7 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
$var = ! $var; $var = ! $var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="action" value="add">' . "\n"; print '<input type="hidden" name="action" value="add">' . "\n";
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n"; print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\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

@ -174,6 +174,8 @@ $message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>'; $message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>'; $message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>'; $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
print info_admin($message); print info_admin($message);
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))

View File

@ -222,6 +222,18 @@ else if ($action == 'set_COMMANDE_FREE_TEXT')
} }
} }
//Activate Set Shippable Icon In List
else if ($action=="setshippableiconinlist") {
$setshippableiconinlist = GETPOST('value','int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
} else {
setEventMessage($langs->trans("Error"), 'errors');
}
}
/* /*
* View * View
@ -548,6 +560,22 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// Shippable Icon in List
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
print '<td>&nbsp</td>';
print '<td align="center">';
if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
}
print '</a></td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24); $taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();
@ -98,6 +98,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason"; $tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp"; $tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource"; $tabname[24]= MAIN_DB_PREFIX."c_type_resource";
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
// Dictionary labels // Dictionary labels
$tablib=array(); $tablib=array();
@ -125,6 +126,7 @@ $tablib[21]= "DictionaryAvailability";
$tablib[22]= "DictionarySource"; $tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp"; $tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType"; $tablib[24]= "DictionaryResourceType";
$tablib[25]= "DictionaryEMailTemplates";
// Requests to extract data // Requests to extract data
$tabsql=array(); $tabsql=array();
@ -152,6 +154,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT t.rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[23]= "SELECT t.rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; $tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates";
// Criteria to sort dictionaries // Criteria to sort dictionaries
$tabsqlsort=array(); $tabsqlsort=array();
@ -179,6 +182,7 @@ $tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC"; $tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="country ASC, taux ASC"; $tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC"; $tabsqlsort[24]="code ASC,label ASC";
$tabsqlsort[25]="label ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire // Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array(); $tabfield=array();
@ -206,6 +210,7 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label"; $tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label"; $tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content";
// Nom des champs d'edition pour modification d'un enregistrement // Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array(); $tabfieldvalue=array();
@ -233,6 +238,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label"; $tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label"; $tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array(); $tabfieldinsert=array();
@ -260,6 +266,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label"; $tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label"; $tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
// Nom du rowid si le champ n'est pas de type autoincrement // Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on // Example: "" if id field is "rowid" and has autoincrement on
@ -288,7 +295,8 @@ $tabrowid[20]= "";
$tabrowid[21]= "rowid"; $tabrowid[21]= "rowid";
$tabrowid[22]= "rowid"; $tabrowid[22]= "rowid";
$tabrowid[23]= ""; $tabrowid[23]= "";
$tabrowid[23]= ""; $tabrowid[24]= "";
$tabrowid[25]= "";
// Condition to show dictionary in setup page // Condition to show dictionary in setup page
$tabcond=array(); $tabcond=array();
@ -316,6 +324,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled)); $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= true; $tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled); $tabcond[24]= ! empty($conf->resource->enabled);
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
// List of help for fields // List of help for fields
$tabhelp=array(); $tabhelp=array();
@ -343,6 +352,7 @@ $tabhelp[21] = array();
$tabhelp[22] = array(); $tabhelp[22] = array();
$tabhelp[23] = array(); $tabhelp[23] = array();
$tabhelp[24] = array(); $tabhelp[24] = array();
$tabhelp[25] = array();
// List of check for fields (NOT USED YET) // List of check for fields (NOT USED YET)
$tabfieldcheck=array(); $tabfieldcheck=array();
@ -370,6 +380,7 @@ $tabfieldcheck[21] = array();
$tabfieldcheck[22] = array(); $tabfieldcheck[22] = array();
$tabfieldcheck[23] = array(); $tabfieldcheck[23] = array();
$tabfieldcheck[24] = array(); $tabfieldcheck[24] = array();
$tabfieldcheck[25] = array();
// Complete all arrays with entries found into modules // Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
@ -442,7 +453,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1; $ok=1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value)
{ {
if ($value == 'country' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
@ -489,7 +500,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/ }*/
} }
if (isset($_POST["country"]) && $_POST["country"]=='0') if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
{ {
if (in_array($tablib[$id],array('DictionaryCompanyType'))) if (in_array($tablib[$id],array('DictionaryCompanyType')))
{ {
@ -533,6 +544,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$sql.= $tabfieldinsert[$id]; $sql.= $tabfieldinsert[$id];
$sql.=",active)"; $sql.=",active)";
$sql.= " VALUES("; $sql.= " VALUES(";
// List of values // List of values
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $newid.","; $sql.= $newid.",";
@ -846,6 +858,13 @@ if ($id)
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($id == 2) // Special cas for state page
{
if ($fieldlist[$field]=='region_id') { $valuetoshow='&nbsp;'; $showfield=1; }
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
}
if ($valuetoshow != '') if ($valuetoshow != '')
{ {
print '<td align="'.$align.'">'; print '<td align="'.$align.'">';
@ -856,12 +875,14 @@ if ($id)
} }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
} }
if ($id == 4) print '<td></td>';
print '<td colspan="4">'; print '<td colspan="4">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '&nbsp;</td>'; print '&nbsp;</td>';
print '</tr>'; print '</tr>';
// Line to type new values // Line to enter new values
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
$obj = new stdClass(); $obj = new stdClass();
@ -880,16 +901,25 @@ if ($id)
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors; $error=$hookmanager->error; $errors=$hookmanager->errors;
if ($id == 3)
{
unset($fieldlist[2]);
}
if (empty($reshook)) fieldList($fieldlist,$obj); if (empty($reshook)) fieldList($fieldlist,$obj);
if ($id == 4) print '<td></td>';
print '<td colspan="3" align="right"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>'; print '<td colspan="3" align="right"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
print "</tr>"; print "</tr>";
$colspan=count($fieldlist)+2;
if ($id == 4) $colspan++;;
if (! empty($alabelisused)) // Si un des champs est un libelle if (! empty($alabelisused)) // Si un des champs est un libelle
{ {
print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>'; print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
} }
print '<tr><td colspan="'.(count($fieldlist)+2).'">&nbsp;</td></tr>'; print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>';
} }
print '</form>'; print '</form>';
@ -965,6 +995,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield)
{ {
@ -1302,7 +1333,7 @@ $db->close();
/** /**
* Show field * Show fields in insert/edit mode
* *
* @param array $fieldlist Array of fields * @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields * @param Object $obj If we show a particular record, obj is filled with record fields
@ -1322,14 +1353,22 @@ function fieldList($fieldlist,$obj='',$tabname='')
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($fieldlist[$field] == 'country') { if ($fieldlist[$field] == 'country') {
if (in_array('region_id',$fieldlist)) { print '<td>'.join(',',$fieldlist).'&nbsp;</td>'; continue; } // For state page, we do not show the country input (we link to region, not country) if (in_array('region_id',$fieldlist))
{
print '<td>';
//print join(',',$fieldlist);
print '</td>';
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '<td>'; print '<td>';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28); print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28);
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'country_id') { elseif ($fieldlist[$field] == 'country_id') {
$country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
print '</td>';
} }
elseif ($fieldlist[$field] == 'region') { elseif ($fieldlist[$field] == 'region') {
print '<td>'; print '<td>';
@ -1338,7 +1377,9 @@ function fieldList($fieldlist,$obj='',$tabname='')
} }
elseif ($fieldlist[$field] == 'region_id') { elseif ($fieldlist[$field] == 'region_id') {
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0); $region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>';
} }
elseif ($fieldlist[$field] == 'lang') { elseif ($fieldlist[$field] == 'lang') {
print '<td>'; print '<td>';
@ -1377,7 +1418,7 @@ function fieldList($fieldlist,$obj='',$tabname='')
print '<input type="text" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">'; print '<input type="text" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'libelle_facture') { elseif (in_array($fieldlist[$field], array('libelle_facture','content'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>'; print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
} }
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {

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

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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
@ -229,10 +229,11 @@ if ($result)
// Description // Description
print '<td>'; print '<td>';
$text=$langs->trans($obj->description); $text=$langs->trans($obj->description);
if (preg_match('/\((.*)\)/i',$obj->description,$reg)) if (preg_match('/\((.*)\)(.*)/i',$obj->description,$reg))
{ {
$val=explode(',',$reg[1]); $val=explode(',',$reg[1]);
$text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:''); $text=$langs->trans($val[0], isset($val[1])?$val[1]:'', isset($val[2])?$val[2]:'', isset($val[3])?$val[3]:'', isset($val[4])?$val[4]:'');
if (! empty($reg[2])) $text.=$reg[2];
} }
print $text; print $text;
print '</td>'; print '</td>';

View File

@ -251,11 +251,11 @@ if ($action == 'add')
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
// Check parameters // Check parameters
if (empty($object->userownerid)) if (empty($object->userownerid) && empty($_SESSION['assignedtouser']))
{ {
$error++; $donotclearsession=1; $error++; $donotclearsession=1;
$action = 'create'; $action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
} }
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
{ {
@ -423,7 +423,7 @@ if ($action == 'update')
{ {
$error++; $donotclearsession=1; $error++; $donotclearsession=1;
$action = 'edit'; $action = 'edit';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
} }
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -790,11 +790,11 @@ if ($id > 0)
{ {
$result1=$object->fetch($id); $result1=$object->fetch($id);
$result2=$object->fetch_thirdparty(); $result2=$object->fetch_thirdparty();
$result2=$object->fetch_contact(); $result3=$object->fetch_contact();
$result3=$object->fetch_userassigned(); $result4=$object->fetch_userassigned();
$result4=$object->fetch_optionals($id,$extralabels); $result5=$object->fetch_optionals($id,$extralabels);
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0) if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{ {
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
exit; exit;

View File

@ -987,6 +987,7 @@ class ActionComm extends CommonObject
if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0); if ($key == 'id') $sql.=" AND a.id=".(is_numeric($value)?$value:0);
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0); if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0); if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
if ($key == 'login') if ($key == 'login')
{ {
$login=$value; $login=$value;

View File

@ -1,258 +0,0 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.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/>.
*/
/**
* \file htdocs/comm/action/contact.php
* \ingroup agenda
* \brief Page for multi-users event
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load("companies");
$langs->load("commercial");
$langs->load("other");
$langs->load("bills");
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$ref = GETPOST('ref');
$confirm = GETPOST('confirm');
$lineid = GETPOST('lineid','int');
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->societe_id > 0)
{
unset($_GET["action"]);
$action='';
}
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
$object = new ActionComm($db);
/*
* Actions
*/
// Add new contact
if ($action == 'addcontact' && $user->rights->action->creer)
{
$result = $object->fetch($id);
if ($object->id > 0)
{
$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
}
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
}
else
{
setEventMessage($object->error, 'errors');
}
}
}
// modification d'un contact. On enregistre le type
if ($action == 'updateline')
{
if ($object->fetch($id))
{
$contact = $object->detail_contact($_POST["line"]);
$type = $_POST["type"];
$statut = $contact->statut;
$result = $object->update_contact($_POST["line"], $statut, $type);
if ($result >= 0)
{
$db->commit();
} else
{
dol_print_error($db, "result=$result");
$db->rollback();
}
}
else
{
setEventMessage($object->error, 'errors');
}
}
// Bascule du statut d'un contact
else if ($action == 'swapstatut')
{
if ($object->id > 0)
{
$result=$object->swapContactStatus(GETPOST('ligne'));
}
}
// Efface un contact
else if ($action == 'deletecontact')
{
$result = $object->delete_contact($lineid);
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
$form = new Form($db);
$formcompany= new FormCompany($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
if ($id > 0 || ! empty($ref))
{
if ($object->fetch($id,$ref) > 0)
{
$head=actions_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans("Action"),0,'action');
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
print '</td></tr>';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
}
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>';
// Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td rowspan="4" align="center" valign="middle" width="180">'."\n";
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
else print dol_print_date($object->datef,'day');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$object->location.'</td></tr>';
print '</table>';
dol_fiche_end();
print '<br>';
// Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
}
}
else
{
print "ErrorRecordNotFound";
}
}
llxFooter();
$db->close();

View File

@ -41,7 +41,7 @@ $langs->load("commercial");
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$objectid = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -53,13 +53,13 @@ if ($user->societe_id > 0)
unset($_GET["action"]); unset($_GET["action"]);
$action=''; $action='';
} }
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
$object = new ActionComm($db); $object = new ActionComm($db);
if ($objectid > 0) if ($id > 0)
{ {
$ret = $object->fetch($objectid); $ret = $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
} }
@ -96,11 +96,25 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
if ($object->id > 0) if ($object->id > 0)
{ {
$result1=$object->fetch($id);
$result2=$object->fetch_thirdparty();
$result3=$object->fetch_contact();
$result4=$object->fetch_userassigned();
$result5=$object->fetch_optionals($id,$extralabels);
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{
dol_print_error($db,$object->error);
exit;
}
if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
$author=new User($db); $author=new User($db);
$author->fetch($object->author->id); $author->fetch($object->author->id);
$object->author=$author; $object->author=$author;
$object->fetch_contact();
$head=actions_prepare_head($object); $head=actions_prepare_head($object);
@ -132,53 +146,15 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>';
// Date start // Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">'; print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
else print dol_print_date($object->datep,'day'); else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td rowspan="5" align="center" valign="middle" width="180">'."\n";
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
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 '</td>';
print '</tr>'; print '</tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
else print dol_print_date($object->datef,'day'); else print dol_print_date($object->datef,'day');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
@ -190,16 +166,38 @@ if ($object->id > 0)
print '</td></tr>'; print '</td></tr>';
// Location // Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$object->location.'</td></tr>'; if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3">'.$object->location.'</td></tr>';
}
// Assigned to // Assigned to
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
if ($object->userownerid > 0) $listofuserid=array();
if (empty($donotclearsession))
{ {
$tmpuser=new User($object->userownerid); if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
print $tmpuser->getNomUrl(1); if (! empty($object->userassigned)) // Now concat assigned users
{
// Restore array with key with same value than param 'id'
$tmplist1=$object->userassigned; $tmplist2=array();
foreach($tmplist1 as $key => $val)
{
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
}
}
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
} }
print '</td></tr>'; else
{
if (!empty($_SESSION['assignedtouser']))
{
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
}
}
print $form->select_dolusers_forevent('view','assignedtouser',1);
if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
print ' </td></tr>';
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';
@ -252,8 +250,20 @@ if ($object->id > 0)
print ($object->priority?$object->priority:''); print ($object->priority?$object->priority:'');
print '</td></tr>'; print '</td></tr>';
// Other attributes
$parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
}
print '</table><br><br><table class="border" width="100%">';
print '</table>';
print '<br><br>';
print '<table class="border" width="100%">';
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@ -266,9 +276,59 @@ 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();
if ($action != 'edit')
{
// Link to agenda views
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 '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
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 '</div>';
print '<div style="clear: both"></div>';
print "<br><br>";
}
$modulepart = 'actions'; $modulepart = 'actions';
$permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create; $permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create;
@ -280,6 +340,7 @@ 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

@ -118,6 +118,23 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
print "<br>"; print "<br>";
} }
// Search contract
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/fichinter/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAnIntervention").'</td></tr>';
print '<tr '.$bc[$var].'>';
print '<td class="nowrap"><label for="search_contract">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_inter" id="search_inter" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="sall" id="sall" size="18"></td>';
print '</tr>';
print "</table></form>\n";
print "<br>";
}
/* /*
* Draft proposals * Draft proposals
*/ */

View File

@ -535,7 +535,7 @@ else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
// Reopen proposal // Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3) { if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
$object->reopen($user, 1); $object->reopen($user, 1);
} }
} }
@ -553,145 +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 . ".\n";
if ($message) {
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$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)
@ -2200,7 +2074,7 @@ if ($action == 'create')
} }
// ReOpen // ReOpen
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) { if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
print '>' . $langs->trans('ReOpen') . '</a></div>'; print '>' . $langs->trans('ReOpen') . '</a></div>';
} }
@ -2367,13 +2241,13 @@ if ($action == 'create')
$formmail->withcancel = 1; $formmail->withcancel = 1;
// Tableau des substitutions // Tableau des substitutions
$formmail->substit ['__PROPREF__'] = $object->ref; $formmail->substit['__PROPREF__'] = $object->ref;
$formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit ['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit ['__CONTACTCIVNAME__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = '';
// Find the good contact adress // Find the good contact adress
$custcontact = ''; $custcontact = '';
@ -2390,15 +2264,15 @@ if ($action == 'create')
} }
if (! empty($custcontact)) { if (! empty($custcontact)) {
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
} }
} }
// Tableau des parametres complementaires // Tableau des parametres complementaires
$formmail->param ['action'] = 'send'; $formmail->param['action'] = 'send';
$formmail->param ['models'] = 'propal_send'; $formmail->param['models'] = 'propal_send';
$formmail->param ['id'] = $object->id; $formmail->param['id'] = $object->id;
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') { if (GETPOST("mode") == 'init') {
$formmail->clear_attached_files(); $formmail->clear_attached_files();

View File

@ -1739,8 +1739,14 @@ class Propal extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='PROPAL_CLOSE_REFUSED';
if ($statut == 2) if ($statut == 2)
{ {
$trigger_name='PROPAL_CLOSE_SIGNED';
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
// The connected company is classified as a client // The connected company is classified as a client
$soc=new Societe($this->db); $soc=new Societe($this->db);
$soc->id = $this->socid; $soc->id = $this->socid;
@ -1752,48 +1758,31 @@ class Propal extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Call trigger
$result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user);
if ($result < 0) { $error++; }
// End call triggers
} }
else if ($statut == 4)
{ {
$trigger_name='PROPAL_CLASSIFY_BILLED';
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Call trigger
$result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user);
if ($result < 0) { $error++; }
// End call triggers
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Call trigger
$result=$this->call_trigger($trigger_name,$user);
if ($result < 0) { $error++; }
// End call triggers
if ( ! $error ) if ( ! $error )
{ {
$this->db->commit(); $this->db->commit();

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,169 +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 . ".\n";
if ($message) {
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$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");
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
$action='presend';
dol_syslog('Recipient email is empty');
}*/
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorCantReadFile', $file), 'errors');
dol_syslog('Failed to read file: ' . $file);
}
} 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

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php';
$langs->load('orders'); $langs->load('orders');
$langs->load('deliveries'); $langs->load('deliveries');
@ -42,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');
@ -68,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'));
@ -80,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
*/ */
@ -127,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)
{ {
@ -187,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)
@ -245,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);
@ -293,54 +290,111 @@ 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;
$subtotal=0; $subtotal=0;
$generic_commande = new Commande($db); $generic_commande = new Commande($db);
while ($i < min($num,$limit)) $generic_product = new Product($db);
{ while ($i < min($num,$limit)) {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td class="nowrap">'; print '<td class="nowrap">';
$generic_commande->id=$objp->rowid; $generic_commande->id=$objp->rowid;
$generic_commande->ref=$objp->ref; $generic_commande->ref=$objp->ref;
$generic_commande->lines=array();
$generic_commande->getLinesArray();
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut)); print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut));
print '</td>'; print '</td>';
// Shippable Icon
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && ! empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
$notshippable=0;
$text_info='';
$nbprod=0;
for ($lig=0; $lig<(count($generic_commande->lines)); $lig++) {
if ($generic_commande->lines[$lig]->product_type==0) {
$nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
$generic_product->load_stock();
// stock order and stock order_supplier
$stock_order=0;
$stock_order_supplier=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
if (! empty($conf->commande->enabled)) {
$generic_product->load_stats_commande(0,'1,2');
$stock_order=$generic_product->stats_commande['qty'];
}
if (! empty($conf->fournisseur->enabled)) {
$generic_product->load_stats_commande_fournisseur(0,'3');
$stock_order_supplier=$generic_product->stats_commande_fournisseur['qty'];
}
}
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
$text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
if ($generic_product->stock_reel<$generic_commande->lines[$lig]->qty) {
$notshippable++;
$text_info.='<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} else {
$text_info.='<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
}
if ($stock_order_supplier>0) {
$text_info.= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier.'<br>';
} else {
$text_info.= '<br>';
}
}
}
if ($notshippable==0) {
$text_icon = img_picto('', 'object_sending');
$text_info = $langs->trans('Shippable').'<br>'.$text_info;
} else {
$text_icon = img_picto('', 'error');
$text_info = $langs->trans('NonShippable').'<br>'.$text_info;
}
if ($nbprod>0) {
print '<td>';
print $form->textwithtooltip('',$text_info,2,1,$text_icon,'',2);
print '</td>';
}
}
// warning late icon
print '<td style="min-width: 20px" class="nobordernopadding nowrap">'; print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay)) if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay))
print img_picto($langs->trans("Late"),"warning"); print img_picto($langs->trans("Late"),"warning");
@ -387,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,196 +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') {
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 . ".\n";
if ($message) {
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$actionmsg .= $message;
}
// $actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
if ($action == 'relance') {
if (dol_strlen($_POST['subject']))
$subject = $_POST['subject'];
else
$subject = $langs->transnoentities('Relance facture ' . $object->ref);
$actiontypecode = 'AC_FAC';
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
if ($message) {
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
$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");
$mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
dol_syslog('Recipient email is empty');
}*/
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorCantReadFile', $file), 'errors');
dol_syslog('Failed to read file: ' . $file);
}
} 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

@ -136,12 +136,13 @@ if ($action == 'presend' && GETPOST('sendmail'))
$message=make_substitutions($message, $substitutionarray); $message=make_substitutions($message, $substitutionarray);
$actiontypecode='AC_FAC'; $actiontypecode='AC_FAC';
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) if ($message)
{ {
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg.=$message; $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message);
} }
// Create form object // Create form object

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))
{ {
@ -223,7 +237,8 @@ if ($resql)
if ($objp->statut == 0) print '</a>'; if ($objp->statut == 0) print '</a>';
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>';
@ -244,7 +244,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
} }
print "</td>"; print "</td>";
} }
// Valeur CA du mois // Valeur CA du mois
print '<td align="right">'; print '<td align="right">';
if ($cum[$case]) if ($cum[$case])
@ -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>';
@ -382,7 +382,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
} }
// Montant total // Montant total
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear))) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear,$maxyear)))
{ {
@ -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

@ -937,7 +937,7 @@ if ($action == 'create')
// Ref Int // Ref Int
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="2"><input type="text" siez="5" name="ref_supplier" id="ref_supplier" value="'.GETPOST('ref_supplier','alpha').'"></td></tr>'; print '<td colspan="2"><input type="text" size="5" name="ref_supplier" id="ref_supplier" value="'.GETPOST('ref_supplier','alpha').'"></td></tr>';
// Customer // Customer
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
@ -74,7 +85,7 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,';
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; $sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " ,c.ref_supplier"; $sql.= " ,c.ref_supplier";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -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);
@ -126,13 +142,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($action == 'send' || $action == 'relance') if ($action == 'send' || $action == 'relance')
{ {
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject']; if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; $actionmsg2=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
if ($message) if ($message)
{ {
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg.=$message; $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message);
} }
} }
@ -171,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

@ -32,9 +32,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$value=GETPOST('value', 'int'); $value=GETPOST('value', 'int');
$field=GETPOST('field', 'alpha');
$element=GETPOST('element', 'alpha');
$object = new GenericObject($db); $object = new GenericObject($db);
/* /*
* View * View
*/ */
@ -44,9 +45,5 @@ top_httphead();
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n"; print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
// Registering new values // Registering new values
if (! empty($action) && ! empty($id) && $user->rights->produit->creer) { if (($action == 'set') && ! empty($id))
if ($action == 'setstatus') $object->setValueFrom($field, $value, $element, $id);
$object->setValueFrom('tosell', $value, 'product', $id);
else if ($action == 'setstatus_buy')
$object->setValueFrom('tobuy', $value, 'product', $id);
}

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

@ -63,7 +63,7 @@ class box_actions extends ModeleBoxes
if ($user->rights->agenda->myactions->read) if ($user->rights->agenda->myactions->read)
{ {
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,";
$sql.= " ta.code,"; $sql.= " ta.code, ta.libelle as type_label,";
$sql.= " s.nom as name, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
$sql.= MAIN_DB_PREFIX."actioncomm AS a)"; $sql.= MAIN_DB_PREFIX."actioncomm AS a)";
@ -96,7 +96,7 @@ class box_actions extends ModeleBoxes
if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late")); if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late"));
//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
$label=$objp->label; $label=empty($objp->label)?$objp->type_label:$objp->label;
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => ("action"), 'logo' => ("action"),

View File

@ -118,10 +118,9 @@ abstract class CommonDocGenerator
'mycompany_idprof5'=>$mysoc->idprof5, 'mycompany_idprof5'=>$mysoc->idprof5,
'mycompany_idprof6'=>$mysoc->idprof6, 'mycompany_idprof6'=>$mysoc->idprof6,
'mycompany_vatnumber'=>$mysoc->tva_intra, 'mycompany_vatnumber'=>$mysoc->tva_intra,
// Only private not exists for "mysoc" // Only private not exists for "mysoc"
'mycompany_note'=>$mysoc->note_private 'mycompany_note_private'=>$mysoc->note_private,
//'mycompany_note_private'=>$mysoc->note_private,
//'mycompany_note_public'=>$mysoc->note_public,
); );
} }
@ -166,6 +165,7 @@ abstract class CommonDocGenerator
'company_customeraccountancycode'=>$object->code_compta, 'company_customeraccountancycode'=>$object->code_compta,
'company_supplieraccountancycode'=>$object->code_compta_fournisseur, 'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
'company_juridicalstatus'=>$object->forme_juridique, 'company_juridicalstatus'=>$object->forme_juridique,
'company_outstanding_limit'=>$object->outstanding_limit,
'company_capital'=>$object->capital, 'company_capital'=>$object->capital,
'company_idprof1'=>$object->idprof1, 'company_idprof1'=>$object->idprof1,
'company_idprof2'=>$object->idprof2, 'company_idprof2'=>$object->idprof2,

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;
} }
@ -2074,7 +2076,8 @@ abstract class CommonObject
if (! $error) if (! $error)
{ {
$trigkey=''; $trigkey='';
if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFYBILLED'; if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';
if ($trigkey) if ($trigkey)
{ {
@ -2522,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
@ -2566,7 +2569,7 @@ abstract class CommonObject
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} }
else else
{ {
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
@ -3009,21 +3012,26 @@ 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">';
print '<td width="30%">'.$langs->trans('Margins').'</td>'; print '<td width="15%">'.$langs->trans('Margins').'</td>';
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>'; print '<td width="15%" align="right">'.$langs->trans('SellingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>'; print '<td width="15%" align="right">'.$langs->trans('BuyingPrice').'</td>';
else else
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>'; print '<td width="15%" align="right">'.$langs->trans('CostPrice').'</td>';
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>'; print '<td width="15%" align="right">'.$langs->trans('Margin').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.$langs->trans('MarginRate').'</td>'; print '<td align="right">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))

View File

@ -111,7 +111,7 @@ class Events // extends CommonObject
$this->description=trim($this->description); $this->description=trim($this->description);
// Check parameters // Check parameters
if (! $this->description) { $this->error='ErrorBadValueForParameter'; return -1; } if (empty($this->description)) { $this->error='ErrorBadValueForParameter'; return -1; }
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."events(";
@ -129,7 +129,7 @@ class Events // extends CommonObject
$sql.= " ".($_SERVER['HTTP_USER_AGENT']?"'".dol_trunc($_SERVER['HTTP_USER_AGENT'],250)."'":'NULL').","; $sql.= " ".($_SERVER['HTTP_USER_AGENT']?"'".dol_trunc($_SERVER['HTTP_USER_AGENT'],250)."'":'NULL').",";
$sql.= " '".$this->db->idate($this->dateevent)."',"; $sql.= " '".$this->db->idate($this->dateevent)."',";
$sql.= " ".($user->id?"'".$user->id."'":'NULL').","; $sql.= " ".($user->id?"'".$user->id."'":'NULL').",";
$sql.= " '".$this->db->escape($this->description)."'"; $sql.= " '".$this->db->escape(dol_trunc($this->description,250))."'";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);

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";
@ -4166,18 +4180,18 @@ class Form
/** /**
* Return an html string with a select combo box to choose yes or no * Return an html string with a select combo box to choose yes or no
* *
* @param string $htmlname Name of html select field * @param string $htmlname Name of html select field
* @param string $value Pre-selected value * @param string $value Pre-selected value
* @param int $option 0 return yes/no, 1 return 1/0 * @param int $option 0 return yes/no, 1 return 1/0
* @param bool $disabled true or false * @param bool $disabled true or false
* @return mixed See option * @param useempty $useempty 1=Add empty line
* @return mixed See option
*/ */
function selectyesno($htmlname,$value='',$option=0,$disabled=false) function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='')
{ {
global $langs; global $langs;
$yes="yes"; $no="no"; $yes="yes"; $no="no";
if ($option) if ($option)
{ {
$yes="1"; $yes="1";
@ -4187,15 +4201,17 @@ class Form
$disabled = ($disabled ? ' disabled="disabled"' : ''); $disabled = ($disabled ? ' disabled="disabled"' : '');
$resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; $resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
if ($useempty) $resultyesno .= '<option value="-1"'.(($value < 0)?' selected="selected"':'').'></option>'."\n";
if (("$value" == 'yes') || ($value == 1)) if (("$value" == 'yes') || ($value == 1))
{ {
$resultyesno .= '<option value="'.$yes.'" selected="selected">'.$langs->trans("Yes").'</option>'."\n"; $resultyesno .= '<option value="'.$yes.'" selected="selected">'.$langs->trans("Yes").'</option>'."\n";
$resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n"; $resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n";
} }
else else
{ {
$selected=($useempty?'':' selected="selected"');
$resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n"; $resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
$resultyesno .= '<option value="'.$no.'" selected="selected">'.$langs->trans("No").'</option>'."\n"; $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
} }
$resultyesno .= '</select>'."\n"; $resultyesno .= '</select>'."\n";
return $resultyesno; return $resultyesno;

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

@ -31,7 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
*/ */
class Interfaces class Interfaces
{ {
var $dir; // Directory with all core and external triggers files var $db;
var $dir; // Directory with all core and external triggers files
var $errors = array(); // Array for errors var $errors = array(); // Array for errors
/** /**

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

@ -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

@ -206,7 +206,7 @@ function show_array_actions_to_do($max=5)
include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,"; $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
$sql.= " c.code, c.libelle,"; $sql.= " c.code, c.libelle as type_label,";
$sql.= " s.nom as sname, s.rowid, s.client"; $sql.= " s.nom as sname, s.rowid, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN "; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN ";
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action"; $sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action";
@ -243,7 +243,7 @@ function show_array_actions_to_do($max=5)
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
$staticaction->type_code=$obj->code; $staticaction->type_code=$obj->code;
$staticaction->libelle=$obj->label; $staticaction->label=($obj->label?$obj->label:$obj->type_label);
$staticaction->id=$obj->id; $staticaction->id=$obj->id;
print '<td>'.$staticaction->getNomUrl(1,34).'</td>'; print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
@ -440,14 +440,6 @@ function actions_prepare_head($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
if (! empty($conf->global->AGENDA_USE_SEVERAL_CONTACTS))
{
$head[$h][0] = DOL_URL_ROOT.'/comm/action/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans("Contacts");
$head[$h][2] = 'contact';
$h++;
}
// Attached files // Attached files
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->agenda->dir_output . "/" . $object->id; $upload_dir = $conf->agenda->dir_output . "/" . $object->id;

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 )
@ -460,35 +461,36 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0,
} }
/** /**
* On/off button for product tosell or tobuy * On/off button for object
* *
* @param int $id Id product to set * @param int $object Id product to set
* @param string $code Name of constant : status or status_buy * @param string $code Name of constant : status or status_buy for product by example
* @param string $field Name of database field : tosell or tobuy for product by example
* @param string $text_on Text if on
* @param string $text_off Text if off
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @return void * @return void
*/ */
function ajax_productonoff($id, $code, $input=array()) function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array())
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; global $langs;
global $conf, $langs, $db;
$object = new Product($db);
$object->fetch($id);
$out= '<script type="text/javascript"> $out= '<script type="text/javascript">
$(function() { $(function() {
var input = '.json_encode($input).'; var input = '.json_encode($input).';
// Set constant // Set constant
$("#set_'.$code.'").click(function() { $("#set_'.$code.'_'.$object->id.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set'.$code.'\', action: \'set\',
field: \''.$field.'\',
value: \'1\', value: \'1\',
id: \''.$id.'\' element: \''.$object->element.'\',
id: \''.$object->id.'\'
}, },
function() { function() {
$("#set_'.$code.'").hide(); $("#set_'.$code.'_'.$object->id.'").hide();
$("#del_'.$code.'").show(); $("#del_'.$code.'_'.$object->id.'").show();
// Enable another element // Enable another element
if (input.disabled && input.disabled.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) { $.each(input.disabled, function(key,value) {
@ -508,15 +510,17 @@ function ajax_productonoff($id, $code, $input=array())
}); });
// Del constant // Del constant
$("#del_'.$code.'").click(function() { $("#del_'.$code.'_'.$object->id.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/productonoff.php", { $.get( "'.DOL_URL_ROOT.'/core/ajax/objectonoff.php", {
action: \'set'.$code.'\', action: \'set\',
field: \''.$field.'\',
value: \'0\', value: \'0\',
id: \''.$id.'\' element: \''.$object->element.'\',
id: \''.$object->id.'\'
}, },
function() { function() {
$("#del_'.$code.'").hide(); $("#del_'.$code.'_'.$object->id.'").hide();
$("#set_'.$code.'").show(); $("#set_'.$code.'_'.$object->id.'").show();
// Disable another element // Disable another element
if (input.disabled && input.disabled.length > 0) { if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) { $.each(input.disabled, function(key,value) {
@ -536,14 +540,9 @@ function ajax_productonoff($id, $code, $input=array())
}); });
}); });
</script>'; </script>';
if ($code=='status') { $out.= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'hideobject':'').'">'.img_picto($langs->trans($text_off),'switch_off').'</span>';
$out.= '<span id="set_'.$code.'" class="linkobject '.($object->$code==1?'hideobject':'').'">'.img_picto($langs->trans("ProductStatusNotOnSell"),'switch_off').'</span>'; $out.= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code==1?'':'hideobject').'">'.img_picto($langs->trans($text_on),'switch_on').'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.($object->$code==1?'':'hideobject').'">'.img_picto($langs->trans("ProductStatusOnSell"),'switch_on').'</span>';
}
if ($code=='status_buy') {
$out.= '<span id="set_'.$code.'" class="linkobject '.($object->$code==1?'hideobject':'').'">'.img_picto($langs->trans("ProductStatusNotOnBuy"),'switch_off').'</span>';
$out.= '<span id="del_'.$code.'" class="linkobject '.($object->$code==1?'':'hideobject').'">'.img_picto($langs->trans("ProductStatusOnBuy"),'switch_on').'</span>';
}
return $out; return $out;
} }

View File

@ -566,9 +566,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$nbFerie = 0; $nbFerie = 0;
// Check to ensure we use correct parameters // Check to ensure we use correct parameters
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hour and be GMT dates'; if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hours and must be GMT dates';
while ($timestampStart < $timestampEnd) // Loop end when equals $i=0;
while ($timestampStart < $timestampEnd && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop)
{ {
$ferie=false; $ferie=false;
$countryfound=0; $countryfound=0;
@ -576,7 +577,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
$jour = date("d", $timestampStart); $jour = date("d", $timestampStart);
$mois = date("m", $timestampStart); $mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart); $annee = date("Y", $timestampStart);
if ($countrycode == 'FR') if ($countrycode == 'FR')
{ {
$countryfound=1; $countryfound=1;
@ -722,8 +722,10 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
if ($ferie) $nbFerie++; if ($ferie) $nbFerie++;
// Increase number of days (on go up into loop) // Increase number of days (on go up into loop)
$jour++; $timestampStart=dol_time_plus_duree($timestampStart, 1, 'd');
$timestampStart=dol_mktime(0,0,0,$mois,$jour,$annee,1); // Generate GMT date for next day //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart);
$i++;
} }
return $nbFerie; return $nbFerie;
@ -764,13 +766,16 @@ 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 $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) function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
{ {
global $langs; global $langs,$mysoc;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday); if (empty($country_code)) $country_code=$mysoc->country_code;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday.' country_code='.$country_code);
// Check parameters // Check parameters
if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day'; if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day';
@ -779,7 +784,9 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday; //print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
if ($timestampStart < $timestampEnd) if ($timestampStart < $timestampEnd)
{ {
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday); $numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code);
$nbOpenDay = $numdays - $numholidays;
$nbOpenDay.= " " . $langs->trans("Days"); $nbOpenDay.= " " . $langs->trans("Days");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));

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;
} }
@ -2862,7 +2879,11 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
$listofcurrenciesbefore=array('USD'); $listofcurrenciesbefore=array('USD');
if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code);
else $cursymbolafter.=$outlangs->getCurrencySymbol($currency_code); else
{
$tmpcur=$outlangs->getCurrencySymbol($currency_code);
$cursymbolafter.=($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur);
}
} }
$output=$cursymbolbefore.$output.$end.$cursymbolafter; $output=$cursymbolbefore.$output.$end.$cursymbolafter;

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
@ -41,12 +42,13 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
* @param date $paymentdatebefore Payment before date (must includes hour) * @param date $paymentdatebefore Payment before date (must includes hour)
* @param int $usestdout Add information onto standard output * @param int $usestdout Add information onto standard output
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template * @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
* @param string $option Suffix to add into file name of generated PDF * @param string $filesuffix Suffix to add into file name of generated PDF
* @param string $paymentbankid Only if payment on this bank account id * @param string $paymentbankid Only if payment on this bank account id
* @param array $thirdpartiesid List of thirdparties id when using filter excludethirdpartiesid or onlythirdpartiesid * @param array $thirdpartiesid List of thirdparties id when using filter excludethirdpartiesid or onlythirdpartiesid
* @param string $fileprefix Prefix to add into filename of generated PDF
* @return int Error code * @return int Error code
*/ */
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='', $thirdpartiesid='') function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf')
{ {
$sql = "SELECT DISTINCT f.rowid, f.facnumber"; $sql = "SELECT DISTINCT f.rowid, f.facnumber";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
@ -220,13 +222,6 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->SetCompression(false); //$pdf->SetCompression(false);
//$pdf->Open();
//$pdf->AddPage();
//$title=$langs->trans("BillsCustomersUnpaid");
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
//$pdf->MultiCell(100, 3, $title, 0, 'J');
// Add all others // Add all others
foreach($files as $file) foreach($files as $file)
{ {
@ -248,9 +243,9 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
dol_mkdir($diroutputpdf); dol_mkdir($diroutputpdf);
// Save merged file // Save merged file
$filename='mergedpdf'; $filename=$fileprefix;
if (empty($filename)) $filename='mergedpdf';
if (! empty($option)) $filename.='_'.$option; if (! empty($filesuffix)) $filename.='_'.$filesuffix;
$file=$diroutputpdf.'/'.$filename.'.pdf'; $file=$diroutputpdf.'/'.$filename.'.pdf';
if (! $error && $pagecount) if (! $error && $pagecount)

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

@ -770,15 +770,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&amp;viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&amp;viewstatut=-3", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); // if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
} }
// 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);
}
} }
// Donations // Donations
if (! empty($conf->don->enabled)) if (! empty($conf->don->enabled))
@ -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

@ -229,6 +229,14 @@ class modAccounting extends DolibarrModules
$this->rights[$r][4] = 'fiscalyear'; $this->rights[$r][4] = 'fiscalyear';
$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();

View File

@ -0,0 +1,121 @@
<?php
/* Copyright (C) 2014 Ion Agorria <ion@agorria.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/>.
*/
/**
* \defgroup webservices Module webservices
* \brief Module to enable client for supplier WebServices
* \file htdocs/core/modules/modSyncSupplierWebServices.class.php
* \ingroup webservices
* \brief File to describe client for supplier webservices module
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/**
* Class to describe a WebServices module
*/
class modSyncSupplierWebServices extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->numero = 2650;
$this->family = "technic";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Enable the client for external supplier web services";
$this->version = 'experimental'; // 'experimental' or 'dolibarr' or version
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 1;
// Name of image file used for this module.
$this->picto='technic';
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages
//-------------
//$this->config_page_url = array("webservices.php@webservices");
// Dependancies
//-------------
$this->depends = array();
$this->requiredby = array();
$this->langfiles = array("other");
// Constantes
//-----------
$this->const = array();
// New pages on tabs
// -----------------
$this->tabs = array();
// Boxes
//------
$this->boxes = array();
// Permissions
//------------
$this->rights = array();
$this->rights_class = 'syncsupplierwebservices';
$r=0;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
//$this->remove($options);
$sql = array();
return $this->_init($sql,$options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql,$options);
}
}

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
@ -13,7 +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/>.
* *
* Need to have following variables defined: * Need to have following variables defined:
* $object (invoice, order, ...) * $object (invoice, order, ...)
* $conf * $conf
@ -48,20 +49,32 @@ 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->propal->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>';
print '<td colspan="5">'; print '<td colspan="5">';
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$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->propal->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="formsoc">'; 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">';
print '<input type="hidden" name="attribute" value="' . $key . '">'; print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';

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>
@ -160,7 +160,7 @@ else {
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done 'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error' 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
); );
$form->select_produits_fournisseurs($object->fourn_id, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1); $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1);
} }
echo '</span>'; echo '</span>';
} }
@ -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) { ?>

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