Merge remote-tracking branch 'Upstream/develop' into develop-loan
This commit is contained in:
commit
25433120e6
@ -278,12 +278,6 @@ source_file = htdocs/langs/en_US/sendings.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.shop]
|
||||
file_filter = htdocs/langs/<lang>/shop.lang
|
||||
source_file = htdocs/langs/en_US/shop.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.sms]
|
||||
file_filter = htdocs/langs/<lang>/sms.lang
|
||||
source_file = htdocs/langs/en_US/sms.lang
|
||||
|
||||
62
COPYRIGHT
62
COPYRIGHT
@ -9,41 +9,41 @@ More information: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
Dolibarr uses some external libraries released under different licenses. This is compatibility summary:
|
||||
|
||||
Component Version License GPL Compatible Usage
|
||||
Component Version License GPL Compatible Usage
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management
|
||||
FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||
PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
||||
AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management
|
||||
FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||
PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.8.2 MIT License Yes JS library
|
||||
jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery UI Multiselect ? GPL and MIT License Yes JS library plugin for sexier multiselect
|
||||
jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
|
||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
||||
jQuery Flot 0.7 MIT License Yes JS library to build graph
|
||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||
jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
|
||||
jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15)
|
||||
jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used)
|
||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
||||
jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
|
||||
jQuery 1.8.2 MIT License Yes JS library
|
||||
jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery multiple-select 1.1.0 MIT License Yes JS library plugin for sexier multiselect
|
||||
jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
|
||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
||||
jQuery Flot 0.7 MIT License Yes JS library to build graph
|
||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||
jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
|
||||
jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15)
|
||||
jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used)
|
||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
||||
jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.fsf.org/licensing/licenses/index_html
|
||||
|
||||
52
ChangeLog
52
ChangeLog
@ -5,6 +5,21 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||
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: Can filter on date into tab "Referring object" of a project.
|
||||
- New: Module notification has been enhanced:
|
||||
EMail use now language of target contact.
|
||||
Can also define a fixed email for notifications.
|
||||
- New: Feature to link manually an order to an invoice does not disappear once
|
||||
link has been done.
|
||||
- New: Can set a color on user card (visible into agenda view).
|
||||
- New: extrafields for projects and tasks are exported to ODT documents.
|
||||
- New: Add number of active notification into tab title (like we do for notes and documents)
|
||||
- New: Can add product into category from category card.
|
||||
- New: PDF event report show project and status of event.
|
||||
- New: Can filter on status on interventions.
|
||||
- New: Add help info of field type into dictionary of payment types.
|
||||
@ -59,9 +74,14 @@ For users:
|
||||
- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture
|
||||
onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals.
|
||||
- New: Add more search field in list of cheque deposits.
|
||||
- New: Add feature to order to invoice on supplier part
|
||||
- New: Add feature to order to invoice on supplier part.
|
||||
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export.
|
||||
- New: Direct invoice creation from predefined invoice.
|
||||
- New: Add dunning into accountancy report.
|
||||
- New: Add favorite button into country dictionary to put value on top select list
|
||||
- Upgrade phpexcel lib to 1.7.8
|
||||
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export
|
||||
- New : Option on extrafields to have them always editable regardless of the document status
|
||||
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
|
||||
- Fix: [ bug #1470, #1472, #1473] User trigger problem
|
||||
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
|
||||
@ -79,9 +99,8 @@ For users:
|
||||
- Fix: [ bug #1506, #1507 ] ECM trigger error problem
|
||||
- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
|
||||
- Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe.
|
||||
- New: Direct invoice creation from predefined invoice
|
||||
- New: Add dunning into accountancy report
|
||||
For users, new experimental module:
|
||||
|
||||
For users, new experimental module (need to set feature level of instance to experimental to see them):
|
||||
- New: Module Accounting Expert to manage accountancy
|
||||
Special Thanks to developpers :
|
||||
Olivier Geffroy
|
||||
@ -95,6 +114,7 @@ For users, new experimental module:
|
||||
Hydroflex 120 euros
|
||||
Asysteo 120 euros
|
||||
Fournisseur médical 120 euros
|
||||
- Removed: unmaintained OScommerce module
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
@ -116,6 +136,8 @@ For developers:
|
||||
- New: renamed table llx_c_pays to llx_c_country & libelle field to label.
|
||||
- New: Added hook "formConfirm" and "doActions" for fichinter card
|
||||
- New: Can search list of thirdparties from web service on part of name.
|
||||
- New: Function getCurrencyAmount is marked as deprecated. Use function price to output a price
|
||||
including currency symbol.
|
||||
- Qual: Renamed table llx_c_civilite into llx_c_civility,
|
||||
field civilite into label in the same table,
|
||||
and field civilite into civility in other table.
|
||||
@ -127,6 +149,9 @@ For developers:
|
||||
WARNING: Following changes may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
|
||||
- If you can't see trips and expenses records, check that you have the new permission "read all
|
||||
trips and expenses".
|
||||
- Deprecated module "oscommerce" were removed.
|
||||
- Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php
|
||||
- Some field into database were renamed from "libelle" to "label".
|
||||
- Table llx_c_pays were renamed into llx_c_country.
|
||||
@ -134,7 +159,18 @@ Dolibarr better:
|
||||
creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead.
|
||||
- A lot of pages called fiche.php were renamed into card.php
|
||||
- A lot of pages called liste.php were renamed into list.php
|
||||
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice
|
||||
- Fix: bug 1588 : relative discount
|
||||
- Fix: label of input method not tranlated.
|
||||
- Fix: box of customer and propsects were not correctly disabled.
|
||||
- Fix: right and error management #1961
|
||||
- Fix: Fix Error when trying to clone an Order #1943
|
||||
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
|
||||
|
||||
***** ChangeLog for 3.6.1 compared to 3.6.* *****
|
||||
For users:
|
||||
- Fix: Can upload files on services.
|
||||
@ -153,7 +189,13 @@ For users:
|
||||
- Fix: Extrafield feature select from table should try to translate multiple column when not needed
|
||||
- Fix: cents for indian ruppes are calle paisa and paise.
|
||||
- Fix: Invoices payments may be older than invoices.
|
||||
- Fix: Withdrawal total amount is double
|
||||
- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
|
||||
- Fix: Web service categorie WDSL declaration is correct
|
||||
- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined
|
||||
- Fix: Category creation failed and no message output
|
||||
- Fix: Lanf for Payment Type
|
||||
- Fix: PHPCheckstyle 1.5.5
|
||||
|
||||
***** ChangeLog for 3.6 compared to 3.5.* *****
|
||||
For users:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="dolibarr" default="hudson" basedir=".">
|
||||
|
||||
fdfds
|
||||
<!-- Exclude/ignore paths -->
|
||||
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
|
||||
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
|
||||
|
||||
@ -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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* New upstream release.
|
||||
|
||||
-- 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) ]
|
||||
* Maintenance release.
|
||||
|
||||
-- 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) ]
|
||||
* Maintenance release.
|
||||
|
||||
-- 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) ]
|
||||
* Maintenance release.
|
||||
|
||||
@ -3,7 +3,7 @@ Section: web
|
||||
Priority: optional
|
||||
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
|
||||
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer
|
||||
Standards-Version: 3.9.4
|
||||
Standards-Version: 3.9.6
|
||||
Homepage: http://www.dolibarr.org
|
||||
Build-Depends: debhelper (>= 9), po-debconf
|
||||
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
|
||||
@ -16,7 +16,8 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, php5-geoip,
|
||||
# Required PHP libraries
|
||||
php-pear, php-mail-mime,
|
||||
# php-tcpdf, libfpdi-php, libfpdf-tpl-php, php-fpdf,
|
||||
# php-tcpdf, libfpdi-php,
|
||||
# libfpdf-tpl-php, php-fpdf,
|
||||
# libphp-adodb,
|
||||
# libnusoap-php,
|
||||
# libphp-pclzip,
|
||||
@ -26,9 +27,10 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
# fonts-dejavu-core | ttf-dejavu-core,
|
||||
xdg-utils,
|
||||
mysql-server,
|
||||
mysql-client,
|
||||
${misc:Depends},
|
||||
${perl:Depends}
|
||||
Recommends: mysql-client, apache2 | lighttpd | httpd
|
||||
Recommends: apache2 | lighttpd | httpd
|
||||
Suggests: www-browser
|
||||
Description: Web based software to manage a company or foundation
|
||||
Dolibarr ERP & CRM is an easy to use open source/free software for small
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: Dolibarr
|
||||
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
Source: http://sourceforge.net/projects/dolibarr/files/
|
||||
Source: http://www.dolibarr.org/files/stable/standard/
|
||||
|
||||
Files: *
|
||||
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
; ----- Change this -----
|
||||
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
|
||||
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
|
||||
OutputBaseFilename=DoliWamp-3.6.1
|
||||
OutputBaseFilename=DoliWamp-3.7.0-beta
|
||||
; ----- End of change
|
||||
;OutputManifestFile=build\doliwampbuild.log
|
||||
; Define full path from which all relative path are defined
|
||||
|
||||
@ -61,13 +61,17 @@ If you want to build/test package locally:
|
||||
|
||||
- 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
|
||||
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]
|
||||
# Update
|
||||
bzr update
|
||||
-- Update files here. Remove all and overwrite --
|
||||
bzr status
|
||||
-- Update files here --
|
||||
bzr add *
|
||||
bzr commit -m "Description of change"
|
||||
bzr push
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -162,7 +162,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/boutique
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
@ -333,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
|
||||
%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
|
||||
- Upstream release
|
||||
|
||||
|
||||
@ -242,7 +242,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/boutique
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
@ -569,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
|
||||
%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
|
||||
- Upstream release
|
||||
|
||||
|
||||
@ -159,7 +159,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/boutique
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
@ -338,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
|
||||
%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
|
||||
- Upstream release
|
||||
|
||||
|
||||
@ -170,7 +170,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/boutique
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
@ -349,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
|
||||
%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
|
||||
- Upstream release
|
||||
|
||||
|
||||
@ -25,4 +25,6 @@ then
|
||||
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
|
||||
chmod a+x ./scripts/*/*.php
|
||||
chmod a+x ./scripts/*/*.sh
|
||||
chmod g-w ./scripts/*/*.php
|
||||
chmod g-w ./scripts/*/*.sh
|
||||
fi
|
||||
|
||||
@ -65,8 +65,7 @@ if ($action == 'delete') {
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
if ($action == 'disable') {
|
||||
$accounting = $accounting->fetch($id);
|
||||
if (! empty($accounting->id)) {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_desactivate($id);
|
||||
}
|
||||
|
||||
@ -75,10 +74,7 @@ if ($action == 'disable') {
|
||||
setEventMessage($accounting->error, 'errors');
|
||||
}
|
||||
} else if ($action == 'enable') {
|
||||
|
||||
$accounting = $accounting->fetch($id);
|
||||
|
||||
if (! empty($accounting->id)) {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_activate($id);
|
||||
}
|
||||
$action = 'update';
|
||||
@ -160,7 +156,7 @@ if ($result) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num, $limit) ) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@ -99,7 +99,7 @@ print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
$var = True;
|
||||
$var = true;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
||||
|
||||
@ -135,7 +135,7 @@ if ($result) {
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="action" value="import">';
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
@ -191,7 +191,7 @@ print "<br>\n";
|
||||
* Define Chart of accounts
|
||||
*/
|
||||
print '<table class="noborder" width="100%">';
|
||||
$var = True;
|
||||
$var = true;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
@ -211,7 +211,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id;
|
||||
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@ -89,7 +89,7 @@ if ($resql) {
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num, 250) ) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 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
|
||||
@ -67,7 +68,7 @@ class AccountingAccount
|
||||
{
|
||||
if ($rowid || $account_number)
|
||||
{
|
||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, labe, fk_user_author, fk_user_modifn active";
|
||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
||||
if ($rowid) {
|
||||
$sql .= " rowid = '" . $rowid . "'";
|
||||
|
||||
@ -227,9 +227,8 @@ if ($result) {
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print '<tr><td colspan="8"> </td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -208,10 +208,8 @@ if ($result) {
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print '<tr><td colspan="8"> </td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventiler") . '"></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -108,7 +108,7 @@ if ($rowid)
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('membercard'));
|
||||
$hookmanager->initHooks(array('membercard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -159,7 +159,7 @@ if ($conf->use_javascript_ajax)
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
|
||||
print '<tr><td align="center">';
|
||||
print '<tr '.$bc[0].'><td align="center" colspan="2">';
|
||||
|
||||
$SommeA=0;
|
||||
$SommeB=0;
|
||||
|
||||
@ -70,7 +70,7 @@ if (GETPOST('button_removefilter'))
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('membertypecard'));
|
||||
$hookmanager->initHooks(array('membertypecard','globalcard'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -154,7 +154,7 @@ print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
|
||||
print '</tr>'."\n";
|
||||
// Show each trigger
|
||||
// Show each trigger (list is in c_action_trigger)
|
||||
if (! empty($triggers))
|
||||
{
|
||||
foreach ($triggers as $trigger)
|
||||
|
||||
@ -142,7 +142,7 @@ print "</center>";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
@ -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("AgendaUrlOptions3",$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);
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
|
||||
@ -65,8 +65,9 @@ if ($action == 'add')
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user_param";
|
||||
$sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -227,8 +228,8 @@ $actives = array();
|
||||
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,";
|
||||
$sql.= " bd.rowid as boxid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
|
||||
$sql.= " WHERE b.entity = ".$conf->entity;
|
||||
$sql.= " AND b.box_id = bd.rowid";
|
||||
$sql.= " WHERE b.box_id = bd.rowid";
|
||||
$sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
|
||||
$sql.= " AND b.fk_user=0";
|
||||
$sql.= " ORDER by b.position, b.box_order";
|
||||
|
||||
@ -237,6 +238,8 @@ $resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Check record to know if we must recalculate sort order
|
||||
$i = 0;
|
||||
$decalage=0;
|
||||
$var=false;
|
||||
@ -310,7 +313,6 @@ if ($resql)
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
|
||||
// Available boxes to activate
|
||||
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
||||
|
||||
@ -372,7 +374,7 @@ print '</table>';
|
||||
|
||||
// Activated boxes
|
||||
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
||||
|
||||
//var_dump($boxactivated);
|
||||
print "<br>\n\n";
|
||||
print_titre($langs->trans("BoxesActivated"));
|
||||
|
||||
|
||||
@ -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
|
||||
@ -548,6 +560,22 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Shippable Icon in List
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
|
||||
print '<td> </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 '<br>';
|
||||
|
||||
@ -117,7 +117,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
}
|
||||
else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING);
|
||||
else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING);
|
||||
}
|
||||
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
||||
{
|
||||
@ -133,9 +133,10 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorOnlyPngJpgSupported"),'errors');
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,7 +159,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Local taxes
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
|
||||
|
||||
|
||||
if($_POST["optionlocaltax1"]=="localtax1on")
|
||||
{
|
||||
if(!isset($_REQUEST['lt1']))
|
||||
@ -226,13 +227,15 @@ if ($action == 'addthumb')
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors');
|
||||
dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING);
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
|
||||
dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors');
|
||||
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
|
||||
}
|
||||
@ -601,7 +604,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
||||
@ -1003,7 +1006,7 @@ else
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
|
||||
{
|
||||
@ -1016,7 +1019,7 @@ else
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
@ -1054,7 +1057,7 @@ else
|
||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
||||
{
|
||||
@ -1068,7 +1071,7 @@ else
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// 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.
|
||||
$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
|
||||
$tabname=array();
|
||||
@ -98,6 +98,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
|
||||
$tabname[22]= MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -125,13 +126,14 @@ $tablib[21]= "DictionaryAvailability";
|
||||
$tablib[22]= "DictionarySource";
|
||||
$tablib[23]= "DictionaryRevenueStamp";
|
||||
$tablib[24]= "DictionaryResourceType";
|
||||
$tablib[25]= "DictionaryEMailTemplates";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
|
||||
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[4] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$tabsql[4] = "SELECT rowid as rowid, code, label, active, favorite FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
|
||||
@ -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[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[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -179,6 +182,7 @@ $tabsqlsort[21]="code ASC, label ASC";
|
||||
$tabsqlsort[22]="code ASC, label ASC";
|
||||
$tabsqlsort[23]="country ASC, taux ASC";
|
||||
$tabsqlsort[24]="code ASC,label ASC";
|
||||
$tabsqlsort[25]="label ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -206,6 +210,7 @@ $tabfield[21]= "code,label";
|
||||
$tabfield[22]= "code,label";
|
||||
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[24]= "code,label";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -233,6 +238,7 @@ $tabfieldvalue[21]= "code,label";
|
||||
$tabfieldvalue[22]= "code,label";
|
||||
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[24]= "code,label";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -260,6 +266,7 @@ $tabfieldinsert[21]= "code,label";
|
||||
$tabfieldinsert[22]= "code,label";
|
||||
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$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
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -288,7 +295,8 @@ $tabrowid[20]= "";
|
||||
$tabrowid[21]= "rowid";
|
||||
$tabrowid[22]= "rowid";
|
||||
$tabrowid[23]= "";
|
||||
$tabrowid[23]= "";
|
||||
$tabrowid[24]= "";
|
||||
$tabrowid[25]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -316,6 +324,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
|
||||
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
|
||||
$tabcond[23]= true;
|
||||
$tabcond[24]= ! empty($conf->resource->enabled);
|
||||
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -343,6 +352,7 @@ $tabhelp[21] = array();
|
||||
$tabhelp[22] = array();
|
||||
$tabhelp[23] = array();
|
||||
$tabhelp[24] = array();
|
||||
$tabhelp[25] = array();
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -370,6 +380,7 @@ $tabfieldcheck[21] = array();
|
||||
$tabfieldcheck[22] = array();
|
||||
$tabfieldcheck[23] = array();
|
||||
$tabfieldcheck[24] = array();
|
||||
$tabfieldcheck[25] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
||||
@ -387,13 +398,14 @@ if ($id == 11)
|
||||
$langs->load("bills");
|
||||
$langs->load("interventions");
|
||||
$elementList = array(
|
||||
'proposal' => $langs->trans('Proposal'),
|
||||
'order' => $langs->trans('Order'),
|
||||
'invoice' => $langs->trans('Bill'),
|
||||
'' => '',
|
||||
// 'proposal' => $langs->trans('Proposal'),
|
||||
// 'order' => $langs->trans('Order'),
|
||||
// 'invoice' => $langs->trans('Bill'),
|
||||
'invoice_supplier' => $langs->trans('SupplierBill'),
|
||||
'order_supplier' => $langs->trans('SupplierOrder'),
|
||||
'intervention' => $langs->trans('InterventionCard'),
|
||||
'contract' => $langs->trans('Contract'),
|
||||
// 'intervention' => $langs->trans('InterventionCard'),
|
||||
// 'contract' => $langs->trans('Contract'),
|
||||
'project' => $langs->trans('Project'),
|
||||
'project_task' => $langs->trans('Task'),
|
||||
'agenda' => $langs->trans('Agenda'),
|
||||
@ -402,10 +414,11 @@ if ($id == 11)
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'commande' => $langs->trans('Order'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
|
||||
asort($elementList);
|
||||
$sourceList = array(
|
||||
'internal' => $langs->trans('Internal'),
|
||||
'external' => $langs->trans('External')
|
||||
@ -440,7 +453,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
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 == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
@ -487,7 +500,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$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')))
|
||||
{
|
||||
@ -531,6 +544,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
@ -677,6 +691,46 @@ if ($action == $acts[1])
|
||||
}
|
||||
}
|
||||
|
||||
// favorite
|
||||
if ($action == 'activate_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($_GET["code"]) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// disable favorite
|
||||
if ($action == 'disable_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
}
|
||||
elseif ($_GET["code"]) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -709,6 +763,7 @@ if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
/*
|
||||
* Show a dictionary
|
||||
@ -803,6 +858,13 @@ if ($id)
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
|
||||
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
|
||||
}
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
@ -813,12 +875,14 @@ if ($id)
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
print '<td colspan="3">';
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td colspan="4">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print ' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to type new values
|
||||
// Line to enter new values
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
$obj = new stdClass();
|
||||
@ -837,16 +901,25 @@ if ($id)
|
||||
$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;
|
||||
|
||||
if ($id == 3)
|
||||
{
|
||||
unset($fieldlist[2]);
|
||||
}
|
||||
|
||||
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 "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+2;
|
||||
if ($id == 4) $colspan++;;
|
||||
|
||||
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).'"> </td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
@ -922,14 +995,18 @@ if ($id)
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
print '<td colspan="2" class="liste_titre"> </td>';
|
||||
// Favorite - Only activated on country dictionary
|
||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
print '<td colspan="3" class="liste_titre"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lines with values
|
||||
@ -1142,6 +1219,16 @@ if ($id)
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
// Only activated on country dictionary
|
||||
if ($id == 4)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
|
||||
else print $langs->trans("AlwaysActive");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($isdisable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
@ -1246,7 +1333,7 @@ $db->close();
|
||||
|
||||
|
||||
/**
|
||||
* Show field
|
||||
* Show fields in insert/edit mode
|
||||
*
|
||||
* @param array $fieldlist Array of fields
|
||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||
@ -1266,14 +1353,22 @@ function fieldList($fieldlist,$obj='',$tabname='')
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
if (in_array('region_id',$fieldlist)) { print '<td>'.join(',',$fieldlist).' </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 $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id') {
|
||||
$country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region') {
|
||||
print '<td>';
|
||||
@ -1282,7 +1377,9 @@ function fieldList($fieldlist,$obj='',$tabname='')
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id') {
|
||||
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang') {
|
||||
print '<td>';
|
||||
@ -1321,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 '</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>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
|
||||
@ -219,6 +219,10 @@ if (function_exists("ldap_connect"))
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
|
||||
// Get a gid number for objectclass PosixGroup
|
||||
if(in_array('posixGroup',$info['objectclass']))
|
||||
$info['gidNumber'] = $ldap->getNextGroupGid();
|
||||
|
||||
$result1=$ldap->delete($dn); // To be sure to delete existing records
|
||||
$result2=$ldap->add($dn,$info,$user); // Now the test
|
||||
$result3=$ldap->delete($dn); // Clean what we did
|
||||
|
||||
@ -32,6 +32,7 @@ $langs->load("other");
|
||||
$langs->load("orders");
|
||||
$langs->load("propal");
|
||||
$langs->load("bills");
|
||||
$langs->load("errors");
|
||||
|
||||
// Security check
|
||||
if (!$user->admin)
|
||||
@ -39,19 +40,32 @@ if (!$user->admin)
|
||||
|
||||
$action = GETPOST("action");
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity);
|
||||
if ($result >= 0)
|
||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue;
|
||||
//print $key.' - '.$val.'<br>';
|
||||
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
setEventMessage($langs->trans("Error"),'errors');
|
||||
}
|
||||
}
|
||||
@ -67,7 +81,7 @@ llxHeader();
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup');
|
||||
|
||||
print $langs->trans("NotificationsDesc").'<br><br>';
|
||||
print $langs->trans("NotificationsDesc").'<br><br>';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -83,19 +97,13 @@ print "</tr>\n";
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("NotificationEMailFrom").'</td><td>';
|
||||
print '<input size="32" type="text" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
|
||||
if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail"));
|
||||
print '<input size="32" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
|
||||
if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -103,6 +111,7 @@ print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Load array of available notifications
|
||||
@ -123,10 +132,21 @@ foreach($listofnotifiedevents as $notifiedevent)
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
|
||||
print '<td><input type="email" size="32" name="'.$param.'" value="'.dol_escape_htmltag(GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param).'">';
|
||||
if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/admin/osc-languages.php
|
||||
* \ingroup boutique
|
||||
* \brief Page d'administration/configuration du module Boutique
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
if (! dol_strlen(OSC_DB_NAME))
|
||||
{
|
||||
print "Non dispo";
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(p.label),p.price";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
print_barre_liste("Liste des langues oscommerce", $page, "osc-languages.php");
|
||||
|
||||
$sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."languages as l";
|
||||
$sql.= $db->plimit($limit, $offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>id</td>";
|
||||
print "<td>Name</td>";
|
||||
print "<td>Code</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<TD>$objp->languages_id</TD>\n";
|
||||
print "<TD>$objp->name</TD>\n";
|
||||
print "<TD>$objp->code</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,5 +1,5 @@
|
||||
<?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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -229,10 +229,11 @@ if ($result)
|
||||
// Description
|
||||
print '<td>';
|
||||
$text=$langs->trans($obj->description);
|
||||
if (preg_match('/\((.*)\)/i',$obj->description,$reg))
|
||||
if (preg_match('/\((.*)\)(.*)/i',$obj->description,$reg))
|
||||
{
|
||||
$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]:'');
|
||||
if (! empty($reg[2])) $text.=$reg[2];
|
||||
}
|
||||
print $text;
|
||||
print '</td>';
|
||||
|
||||
@ -1,204 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 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/boutique/admin/boutique.php
|
||||
* \ingroup boutique
|
||||
* \brief Page d'administration/configuration du module OsCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("oscommerce");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('save','alpha'))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$i=0;
|
||||
|
||||
$i+=dolibarr_set_const($db,'OSC_DB_HOST',trim(GETPOST('oscommerce_dbhost','alpha')),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'OSC_DB_NAME',trim(GETPOST('oscommerce_dbname','alpha')),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'OSC_DB_USER',trim(GETPOST('oscommerce_dbuser','alpha')),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'OSC_DB_PASS',trim(GETPOST('oscommerce_dbpass','alpha')),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim(GETPOST('oscommerce_db_table_prefix','alpha')),'chaine',0,'',$conf->entity);
|
||||
$i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity);
|
||||
|
||||
if ($i >= 4)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("OSCommerceSetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif (GETPOST('test','alpha'))
|
||||
{
|
||||
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
|
||||
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
|
||||
|
||||
// Test de la connexion a la database webcalendar
|
||||
$conf->oscommerce->db->type=$dolibarr_main_db_type;
|
||||
$conf->oscommerce->db->host=GETPOST('oscommerce_dbhost','alpha');
|
||||
$conf->oscommerce->db->port=GETPOST('oscommerce_dbport','alpha');
|
||||
$conf->oscommerce->db->name=GETPOST('oscommerce_dbname','alpha');
|
||||
$conf->oscommerce->db->user=GETPOST('oscommerce_dbuser','alpha');
|
||||
$conf->oscommerce->db->pass=GETPOST('oscommerce_dbpass','alpha');
|
||||
|
||||
$oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port);
|
||||
|
||||
if ($oscommercedb->connected == 1 && $oscommercedb->database_selected == 1)
|
||||
{
|
||||
// Verifie si bonne base par requete sur une table OSCommerce
|
||||
$sql ="SELECT configuration_value";
|
||||
$sql.=" FROM ".$_POST["oscommerce_db_table_prefix"]."configuration";
|
||||
$sql.=" WHERE configuration_key='STORE_NAME'";
|
||||
$resql=$oscommercedb->query($sql);
|
||||
if ($resql) {
|
||||
$mesg = $langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha'));
|
||||
setEventMessage($mesg);
|
||||
}
|
||||
else {
|
||||
$mesg = $langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration");
|
||||
setEventMessage($mesg, 'errors');
|
||||
}
|
||||
|
||||
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
|
||||
}
|
||||
elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
|
||||
{
|
||||
$mesg = $langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'));
|
||||
$mesg.="<br>".$oscommercedb->error();
|
||||
|
||||
setEventMessage($mesg, 'errors');
|
||||
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = $langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha'));
|
||||
$mesg.="<br>".$oscommercedb->error();
|
||||
setEventMessage($mesg, 'errors');
|
||||
}
|
||||
|
||||
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
|
||||
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("OSCommerceSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
$var=true;
|
||||
print '<form name="oscommerceconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td width=\"40%\">".$langs->trans("Parameter")."</td>";
|
||||
print "<td>".$langs->trans("Value")."</td>";
|
||||
print "<td>".$langs->trans("Examples")."</td>";
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("OSCommerceServer")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". (GETPOST('oscommerce_dbhost','alpha')?GETPOST('oscommerce_dbhost','alpha'):$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>";
|
||||
print "<td>localhost";
|
||||
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("OSCommerceDatabaseName")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". (GETPOST('oscommerce_dbname','alpha')?GETPOST('oscommerce_dbname','alpha'):$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>";
|
||||
print "<td>oscommerce";
|
||||
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("OSCommercePrefix")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". (GETPOST('oscommerce_db_table_prefix','alpha')?GETPOST('oscommerce_db_table_prefix','alpha'):$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>";
|
||||
print "<td>osc_";
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("OSCommerceUser")."</td>";
|
||||
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". (GETPOST('oscommerce_dbuser','alpha')?GETPOST('oscommerce_dbuser','alpha'):$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>";
|
||||
print "<td>oscommerceuser";
|
||||
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("Password")."</td>";
|
||||
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . (GETPOST('oscommerce_dbpass','alpha')?GETPOST('oscommerce_dbpass','alpha'):$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>";
|
||||
print '<td>';
|
||||
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
|
||||
print ' </td>';
|
||||
print "</tr>";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$langs->trans("PasswordRetype")."</td>";
|
||||
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . (GETPOST('oscommerce_dbpass2','alpha')?GETPOST('oscommerce_dbpass2','alpha'):$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>";
|
||||
print '<td>';
|
||||
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
|
||||
print ' </td>';
|
||||
print "</tr>";
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '<br><center>';
|
||||
print "<input type=\"submit\" name=\"test\" class=\"button\" value=\"".$langs->trans("TestConnection")."\">";
|
||||
print " ";
|
||||
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
|
||||
print "</center>";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/client/card.php
|
||||
* \ingroup boutique
|
||||
* \brief Page fiche client OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/boutique/client/class/boutiqueclient.class.php';
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$client = new BoutiqueClient($dbosc);
|
||||
$result = $client->fetch($id);
|
||||
if ( $result )
|
||||
{
|
||||
print '<div class="titre">'.$langs->trans("CustomerCard").': '.$client->name.'</div><br>';
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<tr>";
|
||||
print '<td width="20%">Nom</td><td width="80%">'.$client->name.'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Commandes
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_id, date_purchased, t.value as total";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE o.customers_id = " . $client->id;
|
||||
$sql .= " AND o.orders_id = t.orders_id AND t.class = 'ot_total'";
|
||||
//echo $sql;
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="50%">';
|
||||
print "<tr class=\"liste_titre\"><td>Commandes</td>";
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/boutique/commande/card.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche"> ';
|
||||
|
||||
print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour')."</a>\n";
|
||||
print $objp->total . "</a></TD>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>ERROR 1</p>\n";
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>ERROR 1</p>\n";
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>ERROR 1</p>\n";
|
||||
print "Error";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
// Pas d'action
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/boutique/client/class/boutiqueclient.class.php
|
||||
* \brief Classe permettant de gerer des clients de la boutique online
|
||||
* \author Rodolphe Quiedeville
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class BoutiqueClient
|
||||
* \brief Classe permettant de gerer des clients de la boutique online
|
||||
*/
|
||||
class BoutiqueClient
|
||||
{
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $nom;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction permettant de recuperer les informations d'un clients de la boutique
|
||||
*
|
||||
* @param int $id Id du client
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = ".$id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
|
||||
$this->id = $result["customers_id"];
|
||||
$this->name = $result["customers_firstname"] . " " . $result["customers_lastname"];
|
||||
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/client/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion client OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(c.customers_lastname)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des clients", $page, $_SERVER["PHP_SELF"]);
|
||||
|
||||
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c";
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname");
|
||||
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname");
|
||||
print '<td>'.$langs->trans("EMail").'</td><td align="center">'.$langs->trans("Newsletter").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
|
||||
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_lastname."</a></td>\n";
|
||||
print "<td>$objp->customers_email_address</td>\n";
|
||||
print "<td align=\"center\">$objp->customers_newsletter</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/commande/ca.php
|
||||
* \ingroup boutique
|
||||
* \brief Page ca commandes du module OsCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="date_purchased";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des commandes", $page, "ca.php");
|
||||
|
||||
print '<table class="noborder" cellspacing="0" cellpadding="3">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Lastname").'</td></tr>';
|
||||
|
||||
$sql = "SELECT sum(t.value) as value";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal'";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
|
||||
$var=True;
|
||||
if ($num > 0)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>Somme des commandes</td>';
|
||||
print '<td align="right">'.price($objp->value).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$sql = "SELECT sum(t.value) as value";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE t.class = 'ot_shipping'";
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
|
||||
$var=True;
|
||||
if ($num > 0)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>Somme des frais de port</td>';
|
||||
print '<td align="right">'.price($objp->value).'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,155 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/commande/card.php
|
||||
* \ingroup boutique
|
||||
* \brief Page fiche commande OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$commande = new BoutiqueCommande($db);
|
||||
$result = $commande->fetch($id);
|
||||
if ($result)
|
||||
{
|
||||
print '<div class="titre">'.$langs->trans("OrderCard").': '.$commande->id.'</div><br>';
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr><td width="20%">Date</td><td width="80%" colspan="2">'.$commande->date.'</td></tr>';
|
||||
print '<td width="20%">Client</td><td width="80%" colspan="2"><a href="'.DOL_URL_ROOT.'/boutique/client/card.php?id='.$commande->client_id.'">'.$commande->client_name.'</a></td></tr>';
|
||||
|
||||
print '<td width="20%">Paiement</td><td width="80%" colspan="2">'.$commande->payment_method.'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("Address")."</td><td>".$langs->trans("Delivery")."</td><td>".$langs->trans("Invoice")."</td></tr>";
|
||||
|
||||
print "<td> </td><td>".$commande->delivery_adr->name."<br>".$commande->delivery_adr->street."<br>".$commande->delivery_adr->zip."<br>".$commande->delivery_adr->city."<br>".$commande->delivery_adr->country."</td>";
|
||||
print "<td>".$commande->billing_adr->name."<br>".$commande->billing_adr->street."<br>".$commande->billing_adr->zip."<br>".$commande->billing_adr->city."<br>".$commande->billing_adr->country."</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
* Produits
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT orders_id, products_id, products_model, products_name, products_price, final_price, products_quantity";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_products";
|
||||
$sql .= " WHERE orders_id = " . $commande->id;
|
||||
//$commande->id;
|
||||
// echo $sql;
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td align="left" width="40%">'.$langs->trans("Products").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Number").'</td><td align="right">'.$langs->trans("Price").'</td><td align="right">Prix final</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="left" width="40%">';
|
||||
print '<a href="card.php?id='.$objp->products_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" width="16" height="16" alt="Fiche livre"></a>';
|
||||
|
||||
print '<a href="card.php?id='.$objp->products_id.'">'.$objp->products_name.'</a>';
|
||||
print "</td>";
|
||||
|
||||
print '<td align="center"><a href="card.php?id='.$objp->rowid."\">$objp->products_quantity</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"card.php?id=$objp->rowid\">".price($objp->products_price)."</a></TD>\n";
|
||||
print "<td align=\"right\"><a href=\"card.php?id=$objp->rowid\">".price($objp->final_price)."</a></TD>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $dbosc->error();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "<br>";
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<tr>";
|
||||
print '<td width="20%">Frais d\'expeditions</td><td width="80%">'.price($commande->total_ot_shipping).' EUR</td></tr>';
|
||||
print '<td width="20%">'.$langs->trans("Lastname").'</td><td width="80%">'.price($commande->total_ot_total).' EUR</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Fetch failed";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,138 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/commande/class/boutiquecommande.class.php
|
||||
* \ingroup osc
|
||||
* \brief Fichier de la classe des commandes de la boutique online
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage orders OSC
|
||||
*/
|
||||
class BoutiqueCommande
|
||||
{
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $nom;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->billing_adr = new Address();
|
||||
$this->delivry_adr = new Address();
|
||||
|
||||
$this->total_ot_subtotal = 0;
|
||||
$this->total_ot_shipping = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object and lines from database
|
||||
*
|
||||
* @param int $id id of object to load
|
||||
* @param string $ref Ref of order
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function fetch($id,$ref='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_zipcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_zipcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value";
|
||||
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
|
||||
$sql.= " WHERE orders_id = ".$id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$array = $this->db->fetch_array($result);
|
||||
|
||||
$this->id = $array["orders_id"];
|
||||
$this->client_id = $array["customers_id"];
|
||||
$this->client_name = $array["customers_name"];
|
||||
|
||||
$this->payment_method = $array["payment_method"];
|
||||
|
||||
$this->date = $this->db->jdate($array["date_purchased"]);
|
||||
|
||||
$this->delivery_adr->name = $array["delivery_name"];
|
||||
$this->delivery_adr->street = $array["delivery_street_address"];
|
||||
$this->delivery_adr->zip = $array["delivery_zipcode"];
|
||||
$this->delivery_adr->city = $array["delivery_city"];
|
||||
$this->delivery_adr->country = $array["delivery_country"];
|
||||
|
||||
$this->billing_adr->name = $array["billing_name"];
|
||||
$this->billing_adr->street = $array["billing_street_address"];
|
||||
$this->billing_adr->zip = $array["billing_zipcode"];
|
||||
$this->billing_adr->city = $array["billing_city"];
|
||||
$this->billing_adr->country = $array["billing_country"];
|
||||
|
||||
$this->db->free();
|
||||
|
||||
/*
|
||||
* Totaux
|
||||
*/
|
||||
$sql = "SELECT value, class ";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$array = $this->db->fetch_array($result);
|
||||
if ($array["class"] == 'ot_total')
|
||||
{
|
||||
$this->total_ot_total = $array["value"];
|
||||
}
|
||||
if ($array["class"] == 'ot_shipping')
|
||||
{
|
||||
$this->total_ot_shipping = $array["value"];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/commande/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion commandes OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="date_purchased";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des commandes", $page, "commande.php");
|
||||
|
||||
$sql = "SELECT o.orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value, t.value";
|
||||
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql .= " WHERE o.orders_id = t.orders_id AND t.class = 'ot_total'";
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Ref")."</td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print_liste_field_titre("Client","commande.php", "customers_name");
|
||||
print '<td align="right">'.$langs->trans("Total").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td><a href="card.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche"> ';
|
||||
print $objp->orders_id ."</a></td><td>";
|
||||
print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour').'</td>';
|
||||
print '<td><a href="../client/card.php?id='.$objp->customers_id.'">'.$objp->customers_name."</a></TD>\n";
|
||||
print '<td align="right">'.price($objp->value).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,97 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/critiques/bestproduct.php
|
||||
* \ingroup boutique
|
||||
* \brief Page affichage meilleures critiques OS Commerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="rat";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
print_barre_liste("Liste des produits classes par critiques", $page, "bestproduct.php");
|
||||
|
||||
$sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p ";
|
||||
$sql .= " WHERE r.products_id = p.products_id";
|
||||
$sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status";
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\"><td>".$langs->trans("Ref");
|
||||
print '</td><TD align="center">Indice critiques</TD>';
|
||||
print '</td><td align="center">Quantite';
|
||||
print '</td><td align="center">Status</TD>';
|
||||
print "</TR>\n";
|
||||
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<TD><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_model.'</a></TD>';
|
||||
print '<TD align="center">'.$objp->rat."</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_status."</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/critiques/card.php
|
||||
* \ingroup boutique
|
||||
* \brief Page fiche critique OS Commerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
$id=$_GET["id"];
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
|
||||
$critique = new Critique($dbosc);
|
||||
$result = $critique->fetch($id);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
|
||||
print '<div class="titre">Fiche Critique</div><br>';
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<tr>";
|
||||
print '<td width="20%">Produit</td><td width="80%">'.$critique->product_name.'</td></tr>';
|
||||
|
||||
print '<tr><td width="20%">Texte</td><td width="80%">'.nl2br($critique->text).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Fetch failed";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/boutique/critiques/class/critique.class.php
|
||||
* \ingroup osc
|
||||
* \brief Fichier de la classe des critiques OSCommerce
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Classe permettant la gestion des critiques OSCommerce
|
||||
*/
|
||||
class Critique
|
||||
{
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $nom;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load instance
|
||||
*
|
||||
* @param int $id Id to load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch ($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name";
|
||||
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d";
|
||||
$sql .= " ,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
|
||||
|
||||
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
|
||||
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " AND r.reviews_id=$id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array($result);
|
||||
|
||||
$this->id = $result["reviews_id"];
|
||||
$this->product_name = stripslashes($result["products_name"]);
|
||||
$this->text = stripslashes($result["reviews_text"]);
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->lasterror();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/critiques/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion critiques OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="date_added";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Critiques", $page, "index.php");
|
||||
|
||||
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
|
||||
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
|
||||
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print "<td>Produit</td>";
|
||||
print "<td>Critique</td>";
|
||||
print "<td align=\"center\">Note</td>";
|
||||
print "<TD align=\"right\"></TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql) {
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<TD>".substr($objp->products_name, 0, 30)."</TD>\n";
|
||||
print '<TD><a href="card.php?id='.$objp->reviews_id.'">'.substr($objp->reviews_text, 0, 40)." ...</a></td>\n";
|
||||
print "<td align=\"center\">$objp->reviews_rating</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Main page of shop zone
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
$langs->load("shop");
|
||||
$langs->load("orders");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
llxHeader("",$langs->trans("OSCommerceShop"),"");
|
||||
|
||||
print_fiche_titre($langs->trans("OSCommerceShop"));
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td valign="top" width="40%" class="notopnoleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Turnover
|
||||
*/
|
||||
|
||||
print_titre($langs->trans('SalesTurnover'));
|
||||
|
||||
print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Month").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Total").'</td></tr>';
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT SUM(t.value) as value, MONTH(o.date_purchased) as month";
|
||||
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
|
||||
$sql.= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
|
||||
//$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")";
|
||||
$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR('".$db->idate($now)."')";
|
||||
$sql.= " GROUP BY month";
|
||||
$sql.= " ORDER BY month";
|
||||
//print $sql;exit;
|
||||
|
||||
$result=$dbosc->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $dbosc->num_rows($result);
|
||||
|
||||
$var=True;
|
||||
$i=0;
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="left">'.$objp->mois.'</td>';
|
||||
print '<td align="right">'.price($objp->value).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</td><td valign="top" width="60%" class="notopnoleftnoright">';
|
||||
print_titre($langs->trans("Orders"));
|
||||
|
||||
/*
|
||||
* Last 5 successful commands
|
||||
select o.orders_id, o.customers_id, o.customers_name, o.date_purchased, o.payement_method, o.status, t.value
|
||||
from orders_total as t
|
||||
join orders as o on o.orders_id = t.orders_id where t.class = 'ot_subtotal' order by o.date_purchased desc
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' ORDER BY o.date_purchased desc";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("LastOrders").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>".$obj->orders_id."</td><td>".$obj->customers_name."</td><td>".price($obj->value)."</td><td>".$obj->payment_method."</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Last 5 orders on hold
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 5 order by o.date_purchased desc";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("En Attente").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Commands to treat
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 2 order by o.date_purchased desc";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("TreatmentInProgress").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr><tr>';
|
||||
/*
|
||||
* Last customers who ordered
|
||||
*/
|
||||
$sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
|
||||
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1";
|
||||
$sql .= " WHERE t.class = 'ot_subtotal' order by o.date_purchased desc";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$num = $dbosc->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="7">'.$langs->trans("Derniers clients").'</td></tr>';
|
||||
|
||||
$num = min($num,OSC_MAXNBCOM);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $dbosc->fetch_object($resql);
|
||||
print "<tr><td>$obj->date_purchased</td><td>$obj->customers_name</td><td>$obj->delivery_country</td><td>".price($obj->value)."</td><td>$obj->payment_method</td><td>$obj->orders_id</td><td>$obj->statut</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$dbosc->close();
|
||||
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/notification/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion notification OS Commerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
$langs->load("products");
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(c.customers_lastname)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des notifications", $page, "index.php");
|
||||
|
||||
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, p.products_name, p.products_id";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
|
||||
$sql .= ",".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c";
|
||||
$sql .= " WHERE n.customers_id = c.customers_id AND p.products_id=n.products_id";
|
||||
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre("Client",$_SERVER["PHP_SELF"], "c.customers_lastname");
|
||||
print '<td>'.$langs->trans("Product").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td width='70%'><a href=\"card.php?id=$objp->rowid\">$objp->customers_firstname $objp->customers_lastname</a></TD>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_name."</a></td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/notification/produits.php
|
||||
* \ingroup boutique
|
||||
* \brief Page fiche notification produits OS Commerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(p.products_name)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des produits suivis", $page, "produits.php");
|
||||
|
||||
$sql = "SELECT p.products_name, p.products_id, count(p.products_id) as nb";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
|
||||
$sql .= " WHERE p.products_id=n.products_id";
|
||||
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " GROUP BY p.products_name, p.products_id";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print '<td>Produit</td><td align="center">Nb.</td>';
|
||||
print "<td></td>";
|
||||
print "<td></td>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_name."</a></td>";
|
||||
print '<td align="center">'.$objp->nb.'</td>';
|
||||
|
||||
print '<td align="center"><a href="index.php?products_id='.$objp->products_id.'">Voir les clients</td>';
|
||||
print '<td align="center"><a href="newsletter?products_id='.$objp->products_id.'">Envoyer une news</a></td>';
|
||||
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/osc_master.inc.php
|
||||
* \brief File of preparation of the environment Dolibarr for OSCommerce
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Creation objet $dbosc
|
||||
*/
|
||||
$dbosc=getDoliDBInstance($conf->db->type,$conf->global->OSC_DB_HOST,$conf->global->OSC_DB_USER,$conf->global->OSC_DB_PASS,$conf->global->OSC_DB_NAME,$conf->global->OSC_DB_PORT);
|
||||
|
||||
if (! $dbosc->connected)
|
||||
{
|
||||
dol_syslog($dbosc,"host=".$conf->global->OSC_DB_HOST.", user=".$conf->global->OSC_DB_USER.", databasename=".$conf->global->OSC_DB_NAME.", ".$db->error,LOG_ERR);
|
||||
|
||||
llxHeader("",$langs->trans("OSCommerceShop"),"");
|
||||
print '<div class="error">'.$langs->trans('FailedConnectDBCheckModuleSetup').'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/produits/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion produits du module OsCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(c.customers_lastname)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des clients", $page, $_SERVER["PHP_SELF"]);
|
||||
|
||||
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter";
|
||||
$sql .= " FROM ".DB_NAME_OSC.".customers as c";
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname");
|
||||
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname");
|
||||
print '<td>'.$langs->trans("EMail").'</td><td align="center">'.$langs->trans("Newsletter").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
|
||||
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_lastname."</a></td>\n";
|
||||
print "<td>$objp->customers_email_address</td>\n";
|
||||
print "<td align=\"center\">$objp->customers_newsletter</td>\n";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$dbosc->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/produits/osc-list.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion produits du module OsCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="p.label,p.price";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
print_barre_liste("Liste des produits oscommerce", $page, "osc-list.php");
|
||||
|
||||
$sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, d.products_name, m.manufacturers_name, m.manufacturers_id";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."manufacturers as m";
|
||||
$sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . $conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " AND p.manufacturers_id=m.manufacturers_id";
|
||||
if ($reqstock=='epuise')
|
||||
{
|
||||
$sql .= " AND p.products_quantity <= 0";
|
||||
}
|
||||
|
||||
//$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $dbosc->plimit($limit,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>id</td>";
|
||||
print "<td>Ref</td>";
|
||||
print "<td>Titre</td>";
|
||||
print "<td>Groupe</td>";
|
||||
print '<td align="center">Stock</td>';
|
||||
print '<td align="center">Status</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<TD>$objp->products_id</TD>\n";
|
||||
print "<TD>$objp->products_model</TD>\n";
|
||||
print "<TD>$objp->products_name</TD>\n";
|
||||
print "<TD>$objp->manufacturers_name</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_status."</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
@ -1,213 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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/boutique/promotion/class/promotion.class.php
|
||||
* \brief File of class to manage discounts on online shop
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class Promotion
|
||||
* \brief Class to manage discounts on online shop
|
||||
*/
|
||||
class Promotion
|
||||
{
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $parent_id;
|
||||
var $oscid;
|
||||
var $ref;
|
||||
var $titre;
|
||||
var $description;
|
||||
var $price;
|
||||
var $status;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create promotion
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $pid Pid
|
||||
* @param int $percent Percent
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $pid, $percent)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT products_price ";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p";
|
||||
$sql .= " WHERE p.products_id = ".$pid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array($result);
|
||||
$this->price_init = $result["products_price"];
|
||||
}
|
||||
|
||||
$newprice = $percent * $this->price_init;
|
||||
|
||||
$date_exp = "2003-05-01"; // TODO ????
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials ";
|
||||
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
|
||||
$sql .= " VALUES ($pid, $newprice, '".$this->db->idate($now)."', NULL, '".$this->db->idate($now+3600*24*365)."', NULL, 1)";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$id = $this->db->last_insert_id(OSC_DB_NAME.".specials");
|
||||
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
*
|
||||
* @param int $id id
|
||||
* @param User $user Object user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($id, $user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."album ";
|
||||
$sql .= " SET title = '" . trim($this->titre) ."'";
|
||||
$sql .= ",description = '" . trim($this->description) ."'";
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
*
|
||||
* @param int $id id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_active($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials";
|
||||
$sql .= " SET status = 1";
|
||||
|
||||
$sql .= " WHERE products_id = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set inactive
|
||||
*
|
||||
* @param int $id id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_inactive($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials";
|
||||
$sql .= " SET status = 0";
|
||||
|
||||
$sql .= " WHERE products_id = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch datas
|
||||
*
|
||||
* @param int $id id
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories as c,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories_description as cd";
|
||||
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " AND c.categories_id = ".$id;
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ( $result ) {
|
||||
$result = $this->db->fetch_array($result);
|
||||
|
||||
$this->id = $result["categories_id"];
|
||||
$this->parent_id = $result["parent_id"];
|
||||
$this->name = $result["categories_name"];
|
||||
$this->titre = $result["title"];
|
||||
$this->description = $result["description"];
|
||||
$this->oscid = $result["osc_id"];
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc ";
|
||||
|
||||
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_to_categories WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description WHERE products_id = $idosc";
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/boutique/promotion/index.php
|
||||
* \ingroup boutique
|
||||
* \brief Page gestion promotions OSCommerce
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($action == "inactive")
|
||||
{
|
||||
$promotion = new Promotion($dbosc);
|
||||
$promotion->set_inactive($id);
|
||||
}
|
||||
if ($action == "active")
|
||||
{
|
||||
$promotion = new Promotion($dbosc);
|
||||
$promotion->set_active($id);
|
||||
}
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="pd.products_name";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des promotions", $page, "index.php", "",$sortfield, $sortorder);
|
||||
|
||||
$urladd = "&sortorder=$sortorder&sortfield=$sortfield";
|
||||
|
||||
$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price, p.products_model, s.status, p.products_id,";
|
||||
$sql.= " expires_date as fin";
|
||||
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials as s,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as pd,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p";
|
||||
$sql.= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $dbosc->plimit($limit,$offset);
|
||||
|
||||
$resql=$dbosc->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $dbosc->num_rows($resql);
|
||||
$i = 0;
|
||||
print '<table class=\"noborder width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model");
|
||||
print_liste_field_titre("Titre","index.php", "pd.products_name");
|
||||
print "<td> </td><td> </td><td>Fin</td>";
|
||||
print '<td align="right">Prix initial</td>';
|
||||
print '<td align="right">Prix remise</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $dbosc->fetch_object($i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$objp->products_model."</td>";
|
||||
print '<td>'.$objp->products_name."</td>";
|
||||
|
||||
if ($objp->status == 1)
|
||||
{
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_green.png" border="0" alt="actif"></td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=inactive&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_red_light.png" border="0"></a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=active&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_green_light.png" border="0"></a></td>';
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_red.png" border="0" alt="inactif"></td>';
|
||||
}
|
||||
print "<td>".dol_print_date($dbosc->jdate($objp->fin),'day')."</td>";
|
||||
print '<td align="right">'.price($objp->products_price)."</td>";
|
||||
print '<td align="right">'.price($objp->specials_new_products_price)."</td>";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$dbosc->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($dbosc);
|
||||
}
|
||||
$dbosc->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -43,15 +43,9 @@ else
|
||||
$obj_facturation = new Facturation();
|
||||
}
|
||||
|
||||
print '<div class="liste_articles">';
|
||||
|
||||
require ('tpl/liste_articles.tpl.php');
|
||||
|
||||
$obj_facturation->prixTotalHt($lst_total_ht);
|
||||
$obj_facturation->prixTotalTtc($lst_total_ttc);
|
||||
|
||||
print '</div>';
|
||||
|
||||
// Left area with selected articles (shopping cart)
|
||||
print '<div class="principal">';
|
||||
|
||||
$page=GETPOST('menu','alpha');
|
||||
@ -75,4 +69,18 @@ else
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Right area with selected articles (shopping cart)
|
||||
print '<div class="liste_articles">';
|
||||
|
||||
require ('tpl/liste_articles.tpl.php');
|
||||
$obj_facturation->prixTotalHt($lst_total_ht);
|
||||
$obj_facturation->prixTotalTtc($lst_total_ttc);
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
|
||||
|
||||
@ -30,23 +30,24 @@ p {
|
||||
.conteneur {
|
||||
background: #fff;
|
||||
text-align: left;
|
||||
width: 770px;
|
||||
max-width: 770px;
|
||||
margin: 10px auto;
|
||||
border: 2px solid #000;
|
||||
}
|
||||
|
||||
.conteneur_img_gauche {
|
||||
background: url("../img/bg_conteneur_gauche.png") top left repeat-y;
|
||||
/* background: url("../img/bg_conteneur_gauche.png") top left repeat-y; */
|
||||
}
|
||||
|
||||
.conteneur_img_droite {
|
||||
background: url("../img/bg_conteneur_droite.png") top right repeat-y;
|
||||
/* background: url("../img/bg_conteneur_droite.png") top right repeat-y; */
|
||||
}
|
||||
|
||||
/* ------------------- Header ------------------- */
|
||||
.entete {
|
||||
height: 15px;
|
||||
margin: 0;
|
||||
background: url('../img/bg_entete.png') no-repeat left top;
|
||||
/* background: url('../img/bg_entete.png') no-repeat left top; */
|
||||
}
|
||||
|
||||
.entete span {
|
||||
@ -57,7 +58,6 @@ p {
|
||||
.menu_principal {
|
||||
margin: 0 20px 20px 15px;
|
||||
font-size: 14px;
|
||||
width: 735px;
|
||||
height: 84px;
|
||||
background: #CCCCCC;
|
||||
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
|
||||
@ -80,20 +80,21 @@ p {
|
||||
|
||||
.menu li {
|
||||
float: left;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.menu_choix1,.menu_choix2 {
|
||||
font-size: 1.4em;
|
||||
text-align: left;
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.menu_choix1 a,.menu_choix2 a {
|
||||
display: block;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
width: 100px;
|
||||
padding-top: 18px;
|
||||
padding-left: 54px;
|
||||
font-size: 14px;
|
||||
height: 48px;
|
||||
background: url('../img/new.png') top left no-repeat;
|
||||
}
|
||||
@ -115,7 +116,6 @@ p {
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
width: 340px;
|
||||
display: block;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
@ -126,11 +126,13 @@ p {
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li.menu_choix0 {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* ------------------- R<>capitulatif des articles ------------------- */
|
||||
.liste_articles {
|
||||
width: 215px;
|
||||
min-width: 215px;
|
||||
float: right;
|
||||
margin-top: 8px;
|
||||
margin-right: 20px;
|
||||
@ -219,7 +221,7 @@ p.titre {
|
||||
float: left;
|
||||
margin: 0 15px;
|
||||
padding: 0;
|
||||
width: 495px;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.titre1 {
|
||||
@ -237,7 +239,6 @@ p.titre {
|
||||
.cadre_facturation {
|
||||
border: 2px solid #ddd;
|
||||
margin-bottom: 15px;
|
||||
padding: 10px 10px;
|
||||
}
|
||||
|
||||
.principal p {
|
||||
@ -374,7 +375,7 @@ p.titre {
|
||||
.pied {
|
||||
clear: both;
|
||||
height: 15px;
|
||||
background: url('../img/bg_pied.png') no-repeat bottom left;
|
||||
/* background: url('../img/bg_pied.png') no-repeat bottom left; */
|
||||
}
|
||||
|
||||
/* ------------------- Param<61>tres communs (messages d'erreur, informations, etc...) ------------------- */
|
||||
|
||||
@ -158,9 +158,9 @@ $sql = "SELECT t.rowid, t.taux";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql.= " WHERE t.fk_pays = c.rowid";
|
||||
$sql.= " AND c.active = 1";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND c.code = '".$mysoc->country_code."'";
|
||||
//print $request;
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -111,8 +111,9 @@ $langs->load("cashdesk");
|
||||
<td>
|
||||
<input class="texte1_off" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled="disabled" />
|
||||
</td>
|
||||
<!-- Affichage du prix unitaire -->
|
||||
<td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" disabled="disabled" /></td>
|
||||
<!-- Show unit price -->
|
||||
<?php // TODO Remove the disabled and use this value when adding product into cart ?>
|
||||
<td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled="disabled" /></td>
|
||||
<td><?php echo $conf->currency; ?></td>
|
||||
<!-- Choix de la remise -->
|
||||
<td><input class="texte1" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
|
||||
@ -122,9 +123,9 @@ $langs->load("cashdesk");
|
||||
<td><input class="texte1_off" type="text" name="txtTotal" value="" disabled="disabled" /></td><td><?php echo $conf->currency; ?></td>
|
||||
<!-- Choix du taux de TVA -->
|
||||
<td class="select_tva">
|
||||
<?php //var_dump($tab_tva); ?>
|
||||
<select name="selTva" onchange="javascript: modif();" >
|
||||
<?php
|
||||
|
||||
$tva_tx = $obj_facturation->tva();
|
||||
$tab_tva_size=count($tab_tva);
|
||||
for($i=0;$i < $tab_tva_size;$i++) {
|
||||
@ -132,12 +133,10 @@ $langs->load("cashdesk");
|
||||
if ( $tva_tx == $tab_tva[$i]['taux'] )
|
||||
$selected = 'selected="selected"';
|
||||
else
|
||||
$selected = '';
|
||||
$selected = '';
|
||||
|
||||
echo ('<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
@ -144,6 +144,10 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
||||
$action = 'confirmed';
|
||||
$_POST["addcat"] = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('categorycard'));
|
||||
$hookmanager->initHooks(array('categorycard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
@ -207,8 +207,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($cat->error,'errors');
|
||||
setEventMessage($cat->errors,'errors');
|
||||
setEventMessages($cat->error,$this->errors,'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,32 +621,32 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
|
||||
if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort");
|
||||
if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort");
|
||||
|
||||
$linktocreate='';
|
||||
if ($showclassifyform && $user->rights->categorie->creer)
|
||||
{
|
||||
$linktocreate='<a href="'.DOL_URL_ROOT.'/categories/card.php?action=create&origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid).'">';
|
||||
$linktocreate.=$langs->trans("CreateCat").' ';
|
||||
$linktocreate.=img_picto($langs->trans("Create"),'filenew');
|
||||
$linktocreate.="</a>";
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print_fiche_titre($title,'','');
|
||||
print_fiche_titre($title,$linktocreate,'');
|
||||
|
||||
// Form to add record into a category
|
||||
if ($showclassifyform)
|
||||
{
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php">';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="40%">';
|
||||
print $langs->trans("ClassifyInCategory").' ';
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("ClassifyInCategory").' </span>';
|
||||
print $form->select_all_categories($typeid,'auto');
|
||||
print '</td><td>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/categories/card.php?action=create&origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid).'">';
|
||||
print $langs->trans("CreateCat").' ';
|
||||
print img_picto($langs->trans("Create"),'filenew');
|
||||
print "</a>";
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
@ -680,10 +679,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Categorie
|
||||
print "<td>";
|
||||
//$c->id=;
|
||||
//print $c->getNomUrl(1);
|
||||
print img_object('','category').' '.$way."</td>";
|
||||
print "<td>".img_object('','category').' '.$way."</td>";
|
||||
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
|
||||
@ -171,7 +171,7 @@ $nbofentries=(count($data) - 1);
|
||||
|
||||
if ($nbofentries > 0)
|
||||
{
|
||||
print '<tr><td colspan="3">';
|
||||
print '<tr '.$bc[0].'><td colspan="3">';
|
||||
tree_recur($data,$data[0],0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ $type=GETPOST('type');
|
||||
$action=GETPOST('action');
|
||||
$confirm=GETPOST('confirm');
|
||||
$removeelem = GETPOST('removeelem','int');
|
||||
$elemid=GETPOST('elemid');
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
@ -120,6 +121,33 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
||||
}
|
||||
}
|
||||
|
||||
if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$newobject = new Product($db);
|
||||
$result = $newobject->fetch($elemid);
|
||||
$elementtype = 'product';
|
||||
|
||||
// TODO Add into categ
|
||||
$result=$object->add_type($newobject,$elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error,$object->errors,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -144,6 +172,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category');
|
||||
/*
|
||||
* Confirmation suppression
|
||||
*/
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||
@ -251,10 +280,9 @@ else
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
// List of products
|
||||
// List of products or services (type is type of category)
|
||||
if ($object->type == 0)
|
||||
{
|
||||
|
||||
$prods = $object->getObjectsInCateg("product");
|
||||
if ($prods < 0)
|
||||
{
|
||||
@ -262,6 +290,29 @@ if ($object->type == 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
$showclassifyform=1; $typeid=0;
|
||||
|
||||
// Form to add record into a category
|
||||
if ($showclassifyform)
|
||||
{
|
||||
print '<br>';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="addintocategory">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="40%">';
|
||||
print $langs->trans("AddProductServiceIntoCategory").' ';
|
||||
print $form->select_produits('','elemid','',0,0,-1,2,'',1);
|
||||
print '</td><td>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||
|
||||
@ -81,7 +81,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
//var_dump($_POST);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('actioncard'));
|
||||
$hookmanager->initHooks(array('actioncard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
@ -218,13 +218,7 @@ if ($action == 'add')
|
||||
{
|
||||
if ($i == 0) // First entry
|
||||
{
|
||||
$usertodo=new User($db);
|
||||
if ($value['id'] > 0)
|
||||
{
|
||||
$usertodo->fetch($value['id']);
|
||||
$object->userownerid = $usertodo->id;
|
||||
}
|
||||
$object->usertodo = $usertodo;
|
||||
if ($value['id'] > 0) $object->userownerid=$value['id'];
|
||||
$object->transparency = (GETPOST("transparency")=='on'?1:0);
|
||||
}
|
||||
|
||||
@ -236,13 +230,7 @@ if ($action == 'add')
|
||||
|
||||
if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||
{
|
||||
$userdone=new User($db);
|
||||
if ($_POST["doneby"] > 0)
|
||||
{
|
||||
$userdone->fetch($_POST["doneby"]);
|
||||
$object->userdoneid = $userdone->id;
|
||||
}
|
||||
$object->userdone = $userdone;
|
||||
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int");
|
||||
}
|
||||
|
||||
$object->note = trim($_POST["note"]);
|
||||
@ -263,11 +251,11 @@ if ($action == 'add')
|
||||
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
|
||||
|
||||
// Check parameters
|
||||
if (empty($object->usertodo))
|
||||
if (empty($object->userownerid) && empty($_SESSION['assignedtouser']))
|
||||
{
|
||||
$error++; $donotclearsession=1;
|
||||
$action = 'create';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
|
||||
}
|
||||
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
|
||||
{
|
||||
@ -299,19 +287,22 @@ if ($action == 'add')
|
||||
{
|
||||
unset($_SESSION['assignedtouser']);
|
||||
|
||||
$moreparam='';
|
||||
if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
|
||||
|
||||
$db->commit();
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
dol_syslog("Back to ".$backtopage);
|
||||
header("Location: ".$backtopage);
|
||||
dol_syslog("Back to ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):''));
|
||||
header("Location: ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):''));
|
||||
}
|
||||
elseif($idaction)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction);
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam?'&'.$moreparam:''));
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php');
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:''));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
@ -389,8 +380,6 @@ if ($action == 'update')
|
||||
|
||||
// Users
|
||||
$listofuserid=array();
|
||||
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
|
||||
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
|
||||
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
|
||||
{
|
||||
// Restore array with key with same value than param 'id'
|
||||
@ -400,21 +389,23 @@ if ($action == 'update')
|
||||
if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
|
||||
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
|
||||
}
|
||||
|
||||
$object->userassigned=array(); // Clear old content
|
||||
$object->userassigned=array(); $object->userownerid=0; // Clear old content
|
||||
$i=0;
|
||||
foreach($listofuserid as $key => $val)
|
||||
{
|
||||
if ($i == 0) $object->userownerid = $val['id'];
|
||||
$object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : ''));
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||
{
|
||||
$userdone=new User($db);
|
||||
if ($_POST["doneby"])
|
||||
{
|
||||
$userdone->fetch($_POST["doneby"]);
|
||||
}
|
||||
$object->userdone = $userdone;
|
||||
if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int");
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@ -428,11 +419,11 @@ if ($action == 'update')
|
||||
{
|
||||
$result=$cactioncomm->fetch(GETPOST('actioncode'));
|
||||
}
|
||||
if (empty($object->usertodo))
|
||||
if (empty($object->userownerid))
|
||||
{
|
||||
$error++; $donotclearsession=1;
|
||||
$action = 'edit';
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -799,11 +790,11 @@ if ($id > 0)
|
||||
{
|
||||
$result1=$object->fetch($id);
|
||||
$result2=$object->fetch_thirdparty();
|
||||
$result2=$object->fetch_contact();
|
||||
$result3=$object->fetch_userassigned();
|
||||
$result4=$object->fetch_optionals($id,$extralabels);
|
||||
$result3=$object->fetch_contact();
|
||||
$result4=$object->fetch_userassigned();
|
||||
$result5=$object->fetch_optionals($id,$extralabels);
|
||||
|
||||
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0)
|
||||
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
exit;
|
||||
@ -812,9 +803,6 @@ if ($id > 0)
|
||||
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; }
|
||||
|
||||
if ($object->userownerid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userownerid); $object->usertodo=$tmpuser; }
|
||||
if ($object->userdoneid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdoneid); $object->userdone=$tmpuser; }
|
||||
|
||||
|
||||
/*
|
||||
* Show tabs
|
||||
@ -1088,7 +1076,7 @@ if ($id > 0)
|
||||
$listofuserid=array();
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
if (is_object($object->usertodo)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
||||
if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
||||
if (! empty($object->userassigned)) // Now concat assigned users
|
||||
{
|
||||
// Restore array with key with same value than param 'id'
|
||||
@ -1115,7 +1103,12 @@ if ($id > 0)
|
||||
if ($conf->global->AGENDA_ENABLE_DONEBY)
|
||||
{
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
|
||||
if ($object->userdoneid > 0) print $object->userdone->getNomUrl(1);
|
||||
if ($object->userdoneid > 0)
|
||||
{
|
||||
$tmpuser=new User($db);
|
||||
$tmpuser->fetch($object->userdoneid);
|
||||
print $tmpuser->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1248,46 +1241,48 @@ if ($id > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// 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>';
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ class ActionComm extends CommonObject
|
||||
var $note; // Description
|
||||
|
||||
var $userassigned = array(); // Array of user ids
|
||||
var $userownerid; // Id of user owner
|
||||
var $userownerid; // Id of user owner
|
||||
var $userdoneid; // Id of user done
|
||||
var $usertodo; // Object user of owner // deprecated
|
||||
var $userdone; // Object user that did action // deprecated
|
||||
@ -99,10 +99,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
//$this->author = new stdClass();
|
||||
//$this->usermod = new stdClass();
|
||||
//$this->usertodo = new stdClass();
|
||||
//$this->userdone = new stdClass();
|
||||
$this->societe = new stdClass(); // deprecated
|
||||
$this->contact = new stdClass(); // deprecated
|
||||
}
|
||||
@ -142,8 +138,8 @@ class ActionComm extends CommonObject
|
||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||
|
||||
$userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility
|
||||
$userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility
|
||||
$userownerid=$this->userownerid;
|
||||
$userdoneid=$this->userdoneid;
|
||||
|
||||
if (! $this->type_id || ! $this->type_code)
|
||||
{
|
||||
@ -361,15 +357,16 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->authorid = $obj->fk_user_author;
|
||||
$this->usermodid = $obj->fk_user_mod;
|
||||
|
||||
if (!is_object($this->author)) $this->author = new stdClass(); // For avoid warning
|
||||
$this->author->id = $obj->fk_user_author; // deprecated
|
||||
$this->author->firstname = $obj->firstname; // deprecated
|
||||
$this->author->lastname = $obj->lastname; // deprecated
|
||||
if (!is_object($this->usermod)) $this->usermod = new stdClass(); // For avoid warning
|
||||
$this->usermod->id = $obj->fk_user_mod; // deprecated
|
||||
|
||||
$this->userownerid = $obj->fk_user_action;
|
||||
$this->userdoneid = $obj->fk_user_done;
|
||||
$this->usertodo->id = $obj->fk_user_action; // deprecated
|
||||
$this->userdone->id = $obj->fk_user_done; // deprecated
|
||||
$this->priority = $obj->priority;
|
||||
$this->fulldayevent = $obj->fulldayevent;
|
||||
$this->location = $obj->location;
|
||||
@ -419,7 +416,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql2))
|
||||
{
|
||||
$this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||
if ($obj->fk_element > 0) $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
|
||||
if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this)
|
||||
}
|
||||
|
||||
@ -525,7 +522,7 @@ class ActionComm extends CommonObject
|
||||
if ($this->fk_project < 0) $this->fk_project = 0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->percentage == 0 && $this->userdone->id > 0)
|
||||
if ($this->percentage == 0 && $this->userdoneid > 0)
|
||||
{
|
||||
$this->error="ErrorCantSaveADoneUserWithZeroPercentage";
|
||||
return -1;
|
||||
@ -533,8 +530,8 @@ class ActionComm extends CommonObject
|
||||
|
||||
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
|
||||
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
|
||||
$userownerid=($this->userownerid?$this->userownerid:((isset($this->usertodo->id) && $this->usertodo->id > 0) ? $this->usertodo->id : 0));
|
||||
$userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0));
|
||||
$userownerid=($this->userownerid?$this->userownerid:0);
|
||||
$userdoneid=($this->userdoneid?$this->userdoneid:0);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -546,9 +543,9 @@ class ActionComm extends CommonObject
|
||||
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||
$sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated
|
||||
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
|
||||
$sql.= ", fk_soc =". ($this->socid > 0 ? "'".$this->socid."'":"null");
|
||||
$sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null");
|
||||
$sql.= ", fk_contact =". ($contactid > 0 ? "'".$this->contactid."'":"null");
|
||||
$sql.= ", fk_soc =". ($socid > 0 ? "'".$socid."'":"null");
|
||||
$sql.= ", fk_contact =". ($contactid > 0 ? "'".$contactid."'":"null");
|
||||
$sql.= ", priority = '".$this->priority."'";
|
||||
$sql.= ", fulldayevent = '".$this->fulldayevent."'";
|
||||
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
|
||||
@ -856,8 +853,8 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie nom clicable (avec eventuellement le picto)
|
||||
* Utilise $this->id, $this->code et $this->label
|
||||
* Return URL of event
|
||||
* Use $this->id, $this->type_code, $this->label and $this->type_label
|
||||
*
|
||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* @param int $maxlength Nombre de caracteres max dans libelle
|
||||
@ -868,39 +865,34 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='')
|
||||
{
|
||||
global $langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$result='';
|
||||
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'">';
|
||||
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
$label=$this->label;
|
||||
if (empty($label)) $label=$this->libelle; // Fro backward compatibility
|
||||
//print 'rrr'.$this->libelle;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||
|
||||
if ($withpicto == 2)
|
||||
{
|
||||
$libelle=$label;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code);
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code);
|
||||
$libelleshort='';
|
||||
}
|
||||
else if (empty($this->libelle))
|
||||
{
|
||||
$libelle=$label;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code);
|
||||
$libelleshort=dol_trunc($label, $maxlength);
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelle=$label;
|
||||
$libelleshort=dol_trunc($label,$maxlength);
|
||||
$libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:''));
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
$libelleshort=dol_trunc($libelle,$maxlength);
|
||||
}
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // Add code into ()
|
||||
{
|
||||
$libelle.=(($this->type_code && $libelle!=$langs->trans("Action".$this->type_code) && $langs->trans("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->trans("Action".$this->type_code).')':'');
|
||||
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
|
||||
}
|
||||
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle,($overwritepicto?$overwritepicto:'action')).$lienfin;
|
||||
}
|
||||
@ -995,6 +987,7 @@ class ActionComm extends CommonObject
|
||||
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 == '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')
|
||||
{
|
||||
$login=$value;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -41,7 +41,7 @@ $langs->load("commercial");
|
||||
$langs->load("other");
|
||||
$langs->load("bills");
|
||||
|
||||
$objectid = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
@ -53,13 +53,13 @@ if ($user->societe_id > 0)
|
||||
unset($_GET["action"]);
|
||||
$action='';
|
||||
}
|
||||
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
|
||||
|
||||
$object = new ActionComm($db);
|
||||
|
||||
if ($objectid > 0)
|
||||
if ($id > 0)
|
||||
{
|
||||
$ret = $object->fetch($objectid);
|
||||
$ret = $object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
@ -96,12 +96,25 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$result1=$object->fetch($id);
|
||||
$result2=$object->fetch_thirdparty();
|
||||
$result3=$object->fetch_contact();
|
||||
$result4=$object->fetch_userassigned();
|
||||
$result5=$object->fetch_optionals($id,$extralabels);
|
||||
|
||||
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
|
||||
if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
|
||||
|
||||
$author=new User($db);
|
||||
$author->fetch($object->author->id);
|
||||
$object->author=$author;
|
||||
|
||||
if ($object->contact->id > 0) $object->fetch_contact($object->contact->id);
|
||||
if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; }
|
||||
|
||||
$head=actions_prepare_head($object);
|
||||
|
||||
@ -133,53 +146,15 @@ if ($object->id > 0)
|
||||
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">';
|
||||
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
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="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>';
|
||||
|
||||
// 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');
|
||||
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"));
|
||||
@ -191,12 +166,38 @@ if ($object->id > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// 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
|
||||
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
|
||||
$listofuserid=array();
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
||||
if (! empty($object->userassigned)) // Now concat assigned users
|
||||
{
|
||||
// Restore array with key with same value than param 'id'
|
||||
$tmplist1=$object->userassigned; $tmplist2=array();
|
||||
foreach($tmplist1 as $key => $val)
|
||||
{
|
||||
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
|
||||
}
|
||||
}
|
||||
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
|
||||
}
|
||||
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%">';
|
||||
|
||||
@ -249,8 +250,20 @@ if ($object->id > 0)
|
||||
print ($object->priority?$object->priority:'');
|
||||
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
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
@ -263,7 +276,8 @@ if ($object->id > 0)
|
||||
|
||||
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 '</table>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -271,6 +285,52 @@ if ($object->id > 0)
|
||||
$permission = $user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print "<br>";
|
||||
|
||||
// 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>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -46,6 +46,11 @@ $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filt
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -214,10 +219,10 @@ if (empty($action) || $action=='show_month')
|
||||
|
||||
$max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month
|
||||
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month
|
||||
// tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday)
|
||||
$tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
|
||||
// tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
|
||||
$tmpday = -date("w",dol_mktime(12,0,0,$month,1,$year,true))+2; // date('w') is 0 fo sunday
|
||||
$tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
|
||||
if ($tmpday >= 1) $tmpday -= 7;
|
||||
if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
|
||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
|
||||
$next_day=7 - ($max_day_in_month+1-$tmpday) % 7;
|
||||
@ -409,7 +414,7 @@ $sql.= ' a.percent,';
|
||||
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
|
||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql.= ' a.fk_soc, a.fk_contact,';
|
||||
$sql.= ' ca.code';
|
||||
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
||||
@ -478,20 +483,25 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Discard auto action if option is on
|
||||
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a new object action
|
||||
$event=new ActionComm($db);
|
||||
$event->id=$obj->id;
|
||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
||||
$event->datef=$db->jdate($obj->datep2);
|
||||
$event->type_code=$obj->code;
|
||||
$event->type_code=$obj->type_code;
|
||||
$event->type_label=$obj->type_label;
|
||||
$event->libelle=$obj->label;
|
||||
$event->percentage=$obj->percent;
|
||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
//$event->usertodo->id=$obj->fk_user_action; // user id of owner
|
||||
//$event->userdone->id=$obj->fk_user_done; // deprecated
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
@ -874,6 +884,7 @@ if (count($listofextcals))
|
||||
$maxnbofchar=18;
|
||||
$cachethirdparties=array();
|
||||
$cachecontacts=array();
|
||||
$cacheusers=array();
|
||||
|
||||
// Define theme_datacolor array
|
||||
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
|
||||
@ -916,7 +927,7 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
echo " <tr>\n";
|
||||
for ($iter_day = 0; $iter_day < 7; $iter_day++)
|
||||
{
|
||||
/* Show days before the beginning of the current month (previous month) */
|
||||
/* Show days before the beginning of the current month (previous month) */
|
||||
if ($tmpday <= 0)
|
||||
{
|
||||
$style='cal_other_month cal_past';
|
||||
@ -929,21 +940,20 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
elseif ($tmpday <= $max_day_in_month)
|
||||
{
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
|
||||
|
||||
$style='cal_current_month';
|
||||
if ($iter_day == 6) $style.=' cal_current_month_right';
|
||||
$today=0;
|
||||
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
|
||||
if ($today) $style='cal_today';
|
||||
if ($curtime < $todaytms) $style.=' cal_past';
|
||||
|
||||
//var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
|
||||
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
|
||||
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||
echo " </td>\n";
|
||||
}
|
||||
/* Show days after the current month (next month) */
|
||||
else
|
||||
{
|
||||
{
|
||||
$style='cal_other_month';
|
||||
if ($iter_day == 6) $style.=' cal_other_month_right';
|
||||
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
|
||||
@ -1027,7 +1037,7 @@ else // View by day
|
||||
$today=0;
|
||||
$todayarray=dol_getdate($now,'fast');
|
||||
if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
|
||||
if ($today) $style='cal_today';
|
||||
//if ($today) $style='cal_today';
|
||||
|
||||
$timestamp=dol_mktime(12,0,0,$month,$day,$year);
|
||||
$arraytimestamp=dol_getdate($timestamp);
|
||||
@ -1073,7 +1083,7 @@ $db->close();
|
||||
* @param int $year Year
|
||||
* @param int $monthshown Current month shown in calendar view
|
||||
* @param string $style Style to use for this day
|
||||
* @param array $eventarray Array of events
|
||||
* @param array $eventarray Array of events
|
||||
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
|
||||
* @param int $maxnbofchar Nb of characters to show for event line
|
||||
* @param string $newparam Parameters on current URL
|
||||
@ -1086,7 +1096,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
global $user, $conf, $langs;
|
||||
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
|
||||
global $theme_datacolor;
|
||||
global $cachethirdparties, $cachecontacts, $colorindexused;
|
||||
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
||||
|
||||
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
||||
|
||||
@ -1145,11 +1155,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if (in_array($user->id, $keysofuserassigned))
|
||||
{
|
||||
$nummytasks++; $cssclass='family_mytasks';
|
||||
// TODO Set a color using user color
|
||||
// Must defined rule to choose color of who to use.
|
||||
// event->ownerid will still contains user id of owner
|
||||
// event->userassigned will be an array in future.
|
||||
// $color=$user->color;
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
}
|
||||
else if ($event->type_code == 'ICALEVENT')
|
||||
{
|
||||
@ -1170,6 +1186,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
else
|
||||
{
|
||||
$numother++; $cssclass='family_other';
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
}
|
||||
if ($color == -1) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
@ -1290,7 +1317,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print "<br>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ($showinfo)
|
||||
{
|
||||
print $langs->trans("EventOnFullDay")."<br>\n";
|
||||
|
||||
@ -44,6 +44,8 @@ $status=GETPOST("status",'alpha');
|
||||
$type=GETPOST('type');
|
||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
||||
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear'));
|
||||
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear'));
|
||||
|
||||
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
@ -56,6 +58,12 @@ $filterd = GETPOST("userdone","int",3)?GETPOST("userdone","int",3):GETPOST("filt
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
@ -98,6 +106,7 @@ $hookmanager->initHooks(array('agendalist'));
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||
{
|
||||
$param='';
|
||||
@ -116,13 +125,19 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$nav='';
|
||||
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
|
||||
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav.='</form>';
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
// Define list of all external calendars
|
||||
$listofextcals=array();
|
||||
|
||||
@ -141,10 +156,10 @@ if ($type) $param.="&type=".$type;
|
||||
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
|
||||
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,";
|
||||
$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " c.code as type_code, c.libelle as type_label,";
|
||||
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
|
||||
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
|
||||
$sql.= " ud.login as logindone, ud.rowid as useriddone,";
|
||||
//$sql.= " ud.login as logindone, ud.rowid as useriddone,";
|
||||
$sql.= " sp.lastname, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.'user as u,';
|
||||
@ -154,7 +169,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON a.fk_user_author = ua.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid";
|
||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ud ON a.fk_user_done = ud.rowid";
|
||||
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= ' AND a.fk_user_author = u.rowid';
|
||||
@ -181,8 +196,9 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
|
||||
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||
$sql.= ")";
|
||||
}
|
||||
//if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1).'"';
|
||||
if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1)."'";
|
||||
if ($dateselect > 0) $sql.= " AND a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'";
|
||||
if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
|
||||
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
@ -229,7 +245,7 @@ if ($resql)
|
||||
}
|
||||
*/
|
||||
|
||||
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,'');
|
||||
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, 0, '', 0, $nav);
|
||||
//print '<br>';
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?'.$param.'">'."\n";
|
||||
@ -243,8 +259,8 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AffectedTo"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
@ -252,12 +268,14 @@ if ($resql)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
|
||||
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1);
|
||||
print '</td>';
|
||||
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"></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 ' ';
|
||||
@ -274,6 +292,13 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Discard auto action if option is on
|
||||
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
@ -281,7 +306,8 @@ if ($resql)
|
||||
// Action (type)
|
||||
print '<td>';
|
||||
$actionstatic->id=$obj->id;
|
||||
$actionstatic->type_code=$obj->acode;
|
||||
$actionstatic->type_code=$obj->type_code;
|
||||
$actionstatic->type_label=$obj->type_label;
|
||||
$actionstatic->libelle=$obj->label;
|
||||
print $actionstatic->getNomUrl(1,28);
|
||||
print '</td>';
|
||||
@ -330,6 +356,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// User author
|
||||
/*
|
||||
print '<td align="left">';
|
||||
if ($obj->useridauthor)
|
||||
{
|
||||
@ -340,6 +367,7 @@ if ($resql)
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
// User to do
|
||||
print '<td align="left">';
|
||||
|
||||
@ -47,6 +47,11 @@ $usergroup = GETPOST("usergroup","int",3);
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = 0;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -390,6 +395,13 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Discard auto action if option is on
|
||||
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a new object action
|
||||
$event=new ActionComm($db);
|
||||
$event->id=$obj->id;
|
||||
@ -404,7 +416,6 @@ if ($resql)
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
//$event->userdone->id=$obj->fk_user_done; // deprecated
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
@ -557,30 +568,63 @@ while ($i < 7)
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
// Define $usernames
|
||||
$usernames = array(); //init
|
||||
/* Use this to have list of users only if users have events
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
$usernamesid = array();
|
||||
/* Use this to have list of users only if users have events */
|
||||
if (! empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW))
|
||||
{
|
||||
$annee = date('Y',$daykey);
|
||||
$mois = date('m',$daykey);
|
||||
$jour = date('d',$daykey);
|
||||
//if ($day==$jour && $month==$mois && $year==$annee)
|
||||
//{
|
||||
//Tout les events à la même date :
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$myuser = new User($db);
|
||||
$user_id = $event->usertodo->id;
|
||||
$myuser->fetch($user_id);
|
||||
$username = $myuser->getFullName($langs);
|
||||
if (! in_array($username, $usernames))
|
||||
{
|
||||
$usernames[] = $username;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}*/
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
// Get all assigned users for each event
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
$event->fetch_userassigned();
|
||||
$listofuserid=$event->userassigned;
|
||||
foreach($listofuserid as $userid => $tmp)
|
||||
{
|
||||
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Use this list to have for all users */
|
||||
else
|
||||
{
|
||||
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user').")";
|
||||
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
|
||||
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$usernamesid[$obj->rowid]=$obj->rowid;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
//var_dump($usernamesid);
|
||||
foreach($usernamesid as $id)
|
||||
{
|
||||
$tmpuser=new User($db);
|
||||
$result=$tmpuser->fetch($id);
|
||||
$usernames[]=$tmpuser;
|
||||
}
|
||||
|
||||
/*
|
||||
if ($filtert > 0)
|
||||
{
|
||||
$tmpuser = new User($db);
|
||||
@ -598,15 +642,17 @@ else
|
||||
$tmpgroup = new UserGroup($db);
|
||||
//$tmpgroup->fetch($usergroup); No fetch, we want all users for all groups
|
||||
$usernames = $tmpgroup->listUsersForGroup();
|
||||
}
|
||||
}*/
|
||||
|
||||
// Load array of colors by type
|
||||
$colorsbytype=array();
|
||||
$sql="SELECT code, color FROM ".MAIN_DB_PREFIX."c_actioncomm";
|
||||
$labelbytype=array();
|
||||
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
|
||||
$resql=$db->query($sql);
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$colorsbytype[$obj->code]=$obj->color;
|
||||
$labelbytype[$obj->code]=$obj->libelle;
|
||||
}
|
||||
|
||||
// Loop on each user to show calendar
|
||||
@ -652,6 +698,32 @@ foreach ($usernames as $username)
|
||||
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
print '<br>'.$langs->trans("Legend").': <br>';
|
||||
foreach($colorsbytype as $code => $color)
|
||||
{
|
||||
if ($color)
|
||||
{
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color?'background: #'.$color.';':'').'width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code];
|
||||
//print $code;
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
//$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]);
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Other");
|
||||
print '</div>';
|
||||
/* TODO Show this if at least one cumulated event
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #222222; width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("SeveralEvents");
|
||||
print '</div>';
|
||||
*/
|
||||
}
|
||||
|
||||
// Add js code to manage click on a box
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@ -674,7 +746,7 @@ jQuery(document).ready(function() {
|
||||
else if (ids.indexOf(",") > -1) /* There is several events */
|
||||
{
|
||||
/* alert(\'several events\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+dateselectday;
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
window.location.href = url;
|
||||
}
|
||||
else /* One event */
|
||||
@ -896,7 +968,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
//$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases1[$h]) > 1) $title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
$string1=' ';
|
||||
$style1='peruser_notbusy';
|
||||
if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style1='peruser_notbusy';
|
||||
else $style1='peruser_busy';
|
||||
foreach($cases1[$h] as $id => $ev)
|
||||
{
|
||||
if ($ev['busy']) $style1='peruser_busy';
|
||||
@ -907,7 +980,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
//$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases2[$h]) > 1) $title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
$string2=' ';
|
||||
$style2='peruser_notbusy';
|
||||
if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style2='peruser_notbusy';
|
||||
else $style2='peruser_busy';
|
||||
foreach($cases2[$h] as $id => $ev)
|
||||
{
|
||||
if ($ev['busy']) $style2='peruser_busy';
|
||||
|
||||
@ -68,7 +68,7 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="nom";
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('commcard'));
|
||||
$hookmanager->initHooks(array('commcard','globalcard'));
|
||||
|
||||
$object = new Societe($db);
|
||||
|
||||
|
||||
@ -118,6 +118,23 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
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
|
||||
*/
|
||||
|
||||
@ -52,7 +52,7 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('mailingcard'));
|
||||
$hookmanager->initHooks(array('mailingcard','globalcard'));
|
||||
|
||||
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
|
||||
$object->substitutionarray=array(
|
||||
|
||||
@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('propalcard'));
|
||||
$hookmanager->initHooks(array('propalcard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
@ -111,10 +111,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes') {
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) {
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$result = $object->createFromClone($socid);
|
||||
if ($result > 0) {
|
||||
@ -129,7 +133,8 @@ if ($action == 'confirm_clone' && $confirm == 'yes') {
|
||||
}
|
||||
|
||||
// Delete proposal
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer) {
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php');
|
||||
@ -141,7 +146,8 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
|
||||
}
|
||||
|
||||
// Remove line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer) {
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer)
|
||||
{
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result)
|
||||
@ -164,19 +170,29 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
||||
}
|
||||
|
||||
// Validation
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider) {
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
if ($result >= 0) {
|
||||
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') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'propal'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
@ -185,8 +201,9 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdate' && $user->rights->propal->creer) {
|
||||
$datep = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']);
|
||||
else if ($action == 'setdate' && $user->rights->propal->creer)
|
||||
{
|
||||
$datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
|
||||
if (empty($datep)) {
|
||||
$error ++;
|
||||
@ -198,23 +215,29 @@ else if ($action == 'setdate' && $user->rights->propal->creer) {
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
} else if ($action == 'setecheance' && $user->rights->propal->creer) {
|
||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST ['echmonth'], $_POST ['echday'], $_POST ['echyear']));
|
||||
}
|
||||
else if ($action == 'setecheance' && $user->rights->propal->creer)
|
||||
{
|
||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
} else if ($action == 'setdate_livraison' && $user->rights->propal->creer) {
|
||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST ['liv_month'], $_POST ['liv_day'], $_POST ['liv_year']));
|
||||
}
|
||||
else if ($action == 'setdate_livraison' && $user->rights->propal->creer)
|
||||
{
|
||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Positionne ref client
|
||||
else if ($action == 'set_ref_client' && $user->rights->propal->creer) {
|
||||
$object->set_ref_client($user, $_POST ['ref_client']);
|
||||
else if ($action == 'set_ref_client' && $user->rights->propal->creer)
|
||||
{
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -296,11 +319,11 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
|
||||
for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++)
|
||||
{
|
||||
if ($_POST ['idprod' . $i]) {
|
||||
if ($_POST['idprod' . $i]) {
|
||||
$xid = 'idprod' . $i;
|
||||
$xqty = 'qty' . $i;
|
||||
$xremise = 'remise' . $i;
|
||||
$object->add_product($_POST [$xid], $_POST [$xqty], $_POST [$xremise]);
|
||||
$object->add_product($_POST[$xid], $_POST[$xqty], $_POST[$xremise]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,19 +487,26 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
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') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) {
|
||||
$tmp=getListOfModels($db, 'propal'); $keys=array_keys($tmp); $model=$keys[0];
|
||||
}
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) dol_print_error($db,$result);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
exit();
|
||||
@ -505,7 +535,7 @@ else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||
// Reopen proposal
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == 2 || $object->statut == 3) {
|
||||
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||
$object->reopen($user, 1);
|
||||
}
|
||||
}
|
||||
@ -544,7 +574,7 @@ if (GETPOST('removedfile')) {
|
||||
$upload_dir_tmp = $vardir . '/temp';
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process($_POST ['removedfile'], 0);
|
||||
dol_remove_file_process($_POST['removedfile'], 0);
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
@ -555,43 +585,44 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
$langs->load('mails');
|
||||
|
||||
if ($object->id > 0) {
|
||||
if ($_POST ['sendto']) {
|
||||
if ($_POST['sendto']) {
|
||||
// Le destinataire a ete fourni via le champ libre
|
||||
$sendto = $_POST ['sendto'];
|
||||
$sendto = $_POST['sendto'];
|
||||
$sendtoid = 0;
|
||||
} elseif ($_POST ['receiver'] != '-1') {
|
||||
} elseif ($_POST['receiver'] != '-1') {
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST ['receiver'] == 'thirdparty') // Id of third party
|
||||
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'];
|
||||
$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'];
|
||||
$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'];
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
|
||||
if (dol_strlen($_POST ['subject']))
|
||||
$subject = $_POST ['subject'];
|
||||
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";
|
||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
|
||||
if ($message) {
|
||||
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
|
||||
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
|
||||
$actionmsg .= $message;
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
$actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
|
||||
|
||||
@ -683,9 +714,9 @@ if ($action == 'modif' && $user->rights->propal->creer)
|
||||
}
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
||||
if ($_POST ["remise_id"]) {
|
||||
if ($_POST["remise_id"]) {
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST ["remise_id"]);
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
@ -723,7 +754,7 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
if (is_array($extralabelsline)) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST ["options_" . $key]);
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,12 +801,12 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
// On defini prix unitaire
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
|
||||
{
|
||||
$pu_ht = $prod->multiprices [$object->thirdparty->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min [$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level];
|
||||
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -895,23 +926,23 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['prod_entry_mode']);
|
||||
unset($_POST['prod_entry_mode']);
|
||||
|
||||
unset($_POST ['qty']);
|
||||
unset($_POST ['type']);
|
||||
unset($_POST ['remise_percent']);
|
||||
unset($_POST ['price_ht']);
|
||||
unset($_POST ['price_ttc']);
|
||||
unset($_POST ['tva_tx']);
|
||||
unset($_POST ['product_ref']);
|
||||
unset($_POST ['product_label']);
|
||||
unset($_POST ['product_desc']);
|
||||
unset($_POST ['fournprice']);
|
||||
unset($_POST ['buying_price']);
|
||||
unset($_POST ['np_marginRate']);
|
||||
unset($_POST ['np_markRate']);
|
||||
unset($_POST ['dp_desc']);
|
||||
unset($_POST ['idprod']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
unset($_POST['product_label']);
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
unset($_POST['np_marginRate']);
|
||||
unset($_POST['np_markRate']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['idprod']);
|
||||
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
@ -966,7 +997,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
|
||||
if (is_array($extralabelsline)) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST ["options_" . $key]);
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1023,18 +1054,18 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['qty']);
|
||||
unset($_POST ['type']);
|
||||
unset($_POST ['productid']);
|
||||
unset($_POST ['remise_percent']);
|
||||
unset($_POST ['price_ht']);
|
||||
unset($_POST ['price_ttc']);
|
||||
unset($_POST ['tva_tx']);
|
||||
unset($_POST ['product_ref']);
|
||||
unset($_POST ['product_label']);
|
||||
unset($_POST ['product_desc']);
|
||||
unset($_POST ['fournprice']);
|
||||
unset($_POST ['buying_price']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
unset($_POST['product_label']);
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
@ -1091,17 +1122,17 @@ else if ($action == 'remove_file' && $user->rights->propal->creer) {
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||
$object->setProject($_POST ['projectid']);
|
||||
$object->setProject($_POST['projectid']);
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
||||
$result = $object->availability($_POST ['availability_id']);
|
||||
$result = $object->availability($_POST['availability_id']);
|
||||
}
|
||||
|
||||
// Origine de la propale
|
||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
||||
$result = $object->demand_reason($_POST ['demand_reason_id']);
|
||||
$result = $object->demand_reason($_POST['demand_reason_id']);
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
@ -1110,11 +1141,11 @@ else if ($action == 'setconditions' && $user->rights->propal->creer) {
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
|
||||
$result = $object->set_remise_percent($user, $_POST ['remise_percent']);
|
||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
|
||||
$result = $object->set_remise_absolue($user, $_POST ['remise_absolue']);
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Mode de reglement
|
||||
@ -1200,11 +1231,13 @@ else if ($action == 'down' && $user->rights->propal->creer) {
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) {
|
||||
if ($action == 'addcontact') {
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $object->add_contact($contactid, $_POST ["type"], $_POST ["source"]);
|
||||
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0) {
|
||||
@ -2006,62 +2039,9 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes (TODO Move this into an include)
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
$parameters = array('colspan' => ' colspan="3"');
|
||||
$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))
|
||||
{
|
||||
foreach ($extrafields->attribute_label as $key => $label)
|
||||
{
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
$value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = $object->array_options ["options_" . $key];
|
||||
}
|
||||
if ($extrafields->attribute_type [$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
|
||||
print '>' . $label . '</td><td colspan="5">';
|
||||
// Convert date into timestamp format
|
||||
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]);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer && GETPOST('attribute') == $key)
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="attribute" value="' . $key . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print $extrafields->showInputField($key, $value);
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $extrafields->showOutputField($key, $value);
|
||||
if ($object->statut == 0 && $user->rights->propal->creer)
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>';
|
||||
@ -2221,7 +2201,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) {
|
||||
if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
|
||||
print '>' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
@ -2388,13 +2368,13 @@ if ($action == 'create')
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit ['__PROPREF__'] = $object->ref;
|
||||
$formmail->substit ['__SIGNATURE__'] = $user->signature;
|
||||
$formmail->substit ['__REFCLIENT__'] = $object->ref_client;
|
||||
$formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name;
|
||||
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||
$formmail->substit ['__PERSONALIZED__'] = '';
|
||||
$formmail->substit ['__CONTACTCIVNAME__'] = '';
|
||||
$formmail->substit['__PROPREF__'] = $object->ref;
|
||||
$formmail->substit['__SIGNATURE__'] = $user->signature;
|
||||
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
|
||||
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
|
||||
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||
$formmail->substit['__PERSONALIZED__'] = '';
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = '';
|
||||
|
||||
// Find the good contact adress
|
||||
$custcontact = '';
|
||||
@ -2411,15 +2391,15 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact;
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param ['action'] = 'send';
|
||||
$formmail->param ['models'] = 'propal_send';
|
||||
$formmail->param ['id'] = $object->id;
|
||||
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'propal_send';
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
|
||||
@ -186,7 +186,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
@ -199,13 +199,12 @@ elseif (file_exists($fileimagebis))
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -802,7 +802,10 @@ class Propal extends CommonObject
|
||||
$fk_parent_line,
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->date_start,
|
||||
$this->lines[$i]->date_end,
|
||||
$this->lines[$i]->array_options
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
@ -932,6 +935,10 @@ class Propal extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
foreach($this->lines as $line)
|
||||
$line->fetch_optionals($line->rowid);
|
||||
|
||||
// Load source object
|
||||
$objFrom = dol_clone($this);
|
||||
|
||||
@ -1070,7 +1077,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
else $sql.= " AND p.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -1319,67 +1326,77 @@ class Propal extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET ref = '".$num."',";
|
||||
$sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
|
||||
dol_syslog(get_class($this).'::valid', LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
dol_syslog(get_class($this)."::valid", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Trigger calls
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PROPAL_VALIDATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PROPAL_VALIDATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
$this->oldref = $this->ref;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->propal->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->propal->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->propal->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->propal->dir_output.'/'.$newref;
|
||||
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
if (file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||
foreach($listoffiles as $fileentry)
|
||||
{
|
||||
$dirsource=$fileentry['name'];
|
||||
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
||||
$dirsource=$fileentry['path'].'/'.$dirsource;
|
||||
$dirdest=$fileentry['path'].'/'.$dirdest;
|
||||
@rename($dirsource, $dirdest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Deleting old PDF in new rep
|
||||
dol_delete_file($conf->propal->dir_output.'/'.$newref.'/'.$oldref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->ref=$num;
|
||||
$this->brouillon=0;
|
||||
$this->statut = 1;
|
||||
$this->user_valid_id=$user->id;
|
||||
$this->datev=$now;
|
||||
|
||||
$this->ref=$num;
|
||||
$this->brouillon=0;
|
||||
$this->statut = 1;
|
||||
$this->user_valid_id=$user->id;
|
||||
$this->datev=$now;
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1722,8 +1739,14 @@ class Propal extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
|
||||
$trigger_name='PROPAL_CLOSE_REFUSED';
|
||||
|
||||
if ($statut == 2)
|
||||
{
|
||||
$trigger_name='PROPAL_CLOSE_SIGNED';
|
||||
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
|
||||
|
||||
// The connected company is classified as a client
|
||||
$soc=new Societe($this->db);
|
||||
$soc->id = $this->socid;
|
||||
@ -1735,48 +1758,31 @@ class Propal extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
else
|
||||
if ($statut == 4)
|
||||
{
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
$trigger_name='PROPAL_CLASSIFY_BILLED';
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
$this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger($trigger_name,$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if ( ! $error )
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
@ -206,7 +206,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
@ -219,13 +219,12 @@ elseif (file_exists($fileimagebis))
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('ordercard'));
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
@ -600,10 +600,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
|
||||
// multiprix
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
|
||||
{
|
||||
$pu_ht = $prod->multiprices [$object->thirdparty->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min [$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level];
|
||||
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
|
||||
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
@ -616,14 +618,20 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
|
||||
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
|
||||
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
if (count($prodcustprice->lines) > 0) {
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
{
|
||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($prodcustprice->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// if price ht is forced (ie: calculated by margin rate and cost price)
|
||||
@ -900,20 +908,23 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
||||
|
||||
if (! $error) {
|
||||
$result = $object->valid($user, $idwarehouse);
|
||||
if ($result >= 0) {
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'order'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,21 +957,23 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
||||
|
||||
if (! $error) {
|
||||
$result = $object->set_draft($user, $idwarehouse);
|
||||
if ($result >= 0) {
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$ret = $object->fetch($object->id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'order'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1140,7 +1153,7 @@ else if ($action == 'update_extras') {
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
*/
|
||||
if (GETPOST('addfile')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
@ -1154,7 +1167,7 @@ if (GETPOST('addfile')) {
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
*/
|
||||
if (GETPOST('removedfile')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
@ -1169,7 +1182,7 @@ if (GETPOST('removedfile')) {
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
*/
|
||||
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
|
||||
$langs->load('mails');
|
||||
|
||||
@ -1212,11 +1225,12 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
else
|
||||
$subject = $langs->transnoentities('Order') . ' ' . $object->ref;
|
||||
$actiontypecode = 'AC_COM';
|
||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
|
||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
|
||||
if ($message) {
|
||||
$actionmsg .= $langs->transnoentities('MailTopic') . ": " . $subject . "\n";
|
||||
$actionmsg .= $langs->transnoentities('TextUsedInTheMessageBody') . ":\n";
|
||||
$actionmsg .= $message;
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
$actionmsg2 = $langs->transnoentities('Action' . $actiontypecode);
|
||||
}
|
||||
@ -1282,18 +1296,10 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
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);
|
||||
$langs->load("other");
|
||||
setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
|
||||
dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
@ -1875,9 +1881,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
|
||||
// Local taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
$nbrow ++;
|
||||
$nbrow++;
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 )
|
||||
$nbrow ++;
|
||||
$nbrow++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -2122,60 +2128,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes (TODO Move this into an include)
|
||||
$parameters = array('colspan' => ' colspan="3"');
|
||||
$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))
|
||||
{
|
||||
foreach ($extrafields->attribute_label as $key => $label)
|
||||
{
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
$value = (isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$value = $object->array_options["options_" . $key];
|
||||
}
|
||||
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
|
||||
print '>' . $label . '</td><td colspan="5">';
|
||||
// Convert date into timestamp format
|
||||
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]);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key)
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="attribute" value="' . $key . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print $extrafields->showInputField($key, $value);
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $extrafields->showOutputField($key, $value);
|
||||
if ($object->statut == 0 && $user->rights->commande->creer)
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
$rowspan = 4;
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
|
||||
@ -2529,7 +2484,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
||||
foreach ($contactarr as $contact) {
|
||||
if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
@ -2537,15 +2492,15 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact;
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param ['action'] = 'send';
|
||||
$formmail->param ['models'] = 'order_send';
|
||||
$formmail->param ['orderid'] = $object->id;
|
||||
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'order_send';
|
||||
$formmail->param['orderid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -183,9 +183,10 @@ class Commande extends CommonOrder
|
||||
*
|
||||
* @param User $user User making status change
|
||||
* @param int $idwarehouse Id of warehouse to use for stock decrease
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
|
||||
* @return int <=0 if OK, >0 if KO
|
||||
*/
|
||||
function valid($user, $idwarehouse=0)
|
||||
function valid($user, $idwarehouse=0, $notrigger=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -223,9 +224,10 @@ class Commande extends CommonOrder
|
||||
$num = $this->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
@ -273,43 +275,49 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_VALIDATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldref='';
|
||||
$this->oldref = $this->ref;
|
||||
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref)
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref)
|
||||
// in order not to lose the attachments
|
||||
$comref = dol_sanitizeFileName($this->ref);
|
||||
$snum = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->commande->dir_output.'/'.$comref;
|
||||
$dirdest = $conf->commande->dir_output.'/'.$snum;
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->commande->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->commande->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
$this->oldref = $comref;
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'*.*');
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||
foreach($listoffiles as $fileentry)
|
||||
{
|
||||
$dirsource=$fileentry['name'];
|
||||
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
||||
$dirsource=$fileentry['path'].'/'.$dirsource;
|
||||
$dirdest=$fileentry['path'].'/'.$dirdest;
|
||||
@rename($dirsource, $dirdest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_VALIDATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// Set new ref and current status
|
||||
if (! $error)
|
||||
{
|
||||
@ -323,7 +331,7 @@ class Commande extends CommonOrder
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -726,7 +734,8 @@ class Commande extends CommonOrder
|
||||
$fk_parent_line,
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->array_options
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -863,6 +872,10 @@ class Commande extends CommonOrder
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// get extrafields so they will be clone
|
||||
foreach($this->lines as $line)
|
||||
$line->fetch_optionals($line->rowid);
|
||||
|
||||
// Load source object
|
||||
$objFrom = dol_clone($this);
|
||||
|
||||
@ -893,6 +906,13 @@ class Commande extends CommonOrder
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
|
||||
// Set ref
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
|
||||
$obj = $conf->global->COMMANDE_ADDON;
|
||||
$modCommande = new $obj;
|
||||
$this->ref = $modCommande->getNextValue($objsoc,$this);
|
||||
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
@ -146,7 +146,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
$var=true;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
|
||||
@ -187,7 +187,7 @@ if (! empty($conf->commande->enabled))
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -238,7 +238,7 @@ if ($resql)
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -308,7 +308,7 @@ if (! empty($conf->commande->enabled))
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -379,7 +379,7 @@ if (! empty($conf->commande->enabled))
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -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.formother.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('deliveries');
|
||||
@ -325,22 +326,77 @@ if ($resql)
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">';
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
while ($i < min($num,$limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$generic_commande->id=$objp->rowid;
|
||||
$generic_commande->ref=$objp->ref;
|
||||
$generic_commande->id=$objp->rowid;
|
||||
$generic_commande->ref=$objp->ref;
|
||||
$generic_commande->lines=array();
|
||||
$generic_commande->getLinesArray();
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut));
|
||||
print '</td>';
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut));
|
||||
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.' '.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').' : '.$text_stock_reel.'</span>';
|
||||
} else {
|
||||
$text_info.='<span class="ok">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
}
|
||||
if ($stock_order_supplier>0) {
|
||||
$text_info.= ' '.$langs->trans('SupplierOrder').' : '.$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">';
|
||||
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");
|
||||
|
||||
@ -622,7 +622,7 @@ if (($action != 'create' && $action != 'add') || !$error)
|
||||
print '</form>';
|
||||
|
||||
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
|
||||
$var=True;
|
||||
$var=true;
|
||||
$generic_commande = new Commande($db);
|
||||
|
||||
while ($i < $num)
|
||||
|
||||
@ -233,7 +233,11 @@ foreach ($accounts as $key=>$type)
|
||||
$total[$acc->currency_code] += $solde;
|
||||
}
|
||||
}
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
if (! $found)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
|
||||
@ -112,7 +112,7 @@ if ($conf->salaries->enabled)
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
|
||||
@ -145,7 +145,7 @@ if ($conf->salaries->enabled)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
@ -175,7 +175,7 @@ if ($conf->tax->enabled)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -305,7 +305,7 @@ if ($conf->tax->enabled)
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
@ -338,7 +338,7 @@ if ($conf->tax->enabled)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
|
||||
@ -177,7 +177,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
$var=true;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
|
||||
@ -47,7 +47,7 @@ $confirm = GETPOST('confirm','alpha');
|
||||
$object = new Deplacement($db);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('tripsandexpensescard'));
|
||||
$hookmanager->initHooks(array('tripsandexpensescard','globalcard'));
|
||||
|
||||
$permissionnote=$user->rights->deplacement->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class DeplacementStats extends Stats
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $socid Id third party
|
||||
* @param int $userid Id user for filter
|
||||
* @param mixed $userid Id user for filter or array of user ids
|
||||
* @return void
|
||||
*/
|
||||
function __construct($db, $socid=0, $userid=0)
|
||||
@ -66,7 +66,8 @@ class DeplacementStats extends Stats
|
||||
{
|
||||
$this->where.=" AND fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid;
|
||||
if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',',$this->userid).')';
|
||||
else if ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -54,6 +54,9 @@ $limit = $conf->liste_limit;
|
||||
|
||||
$tripandexpense_static=new Deplacement($db);
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
//$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones';
|
||||
$help_url='';
|
||||
llxHeader('',$langs->trans("ListOfFees"),$help_url);
|
||||
@ -64,6 +67,7 @@ $totalnb=0;
|
||||
$sql = "SELECT count(d.rowid) as nb, sum(d.km) as km, d.type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql.= " WHERE d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
||||
$sql.= " GROUP BY d.type";
|
||||
$sql.= " ORDER BY d.type";
|
||||
|
||||
@ -134,6 +138,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND d.fk_soc = ".$socid;
|
||||
$sql.= $db->order("d.tms","DESC");
|
||||
|
||||
@ -58,6 +58,9 @@ $search_ref=GETPOST('search_ref','alpha');
|
||||
$tripandexpense_static=new Deplacement($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
|
||||
@ -70,6 +73,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE d.fk_user = u.rowid";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if (trim($search_ref) != '')
|
||||
@ -167,6 +171,7 @@ else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -45,6 +45,18 @@ if ($user->societe_id > 0)
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'deplacement', $id,'');
|
||||
|
||||
// Other security check
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
if ($userid > 0)
|
||||
{
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous) && ! in_array($userid, $childids))
|
||||
{
|
||||
accessforbidden();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$nowyear=strftime("%Y", dol_now());
|
||||
$year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
//$startyear=$year-2;
|
||||
@ -60,6 +72,7 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$title=$langs->trans("TripsAndExpensesStatistics");
|
||||
@ -69,7 +82,14 @@ print_fiche_titre($title, $mesg);
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
$stats = new DeplacementStats($db, $socid, $userid);
|
||||
$useridtofilter=$userid; // Filter from parameters
|
||||
if (empty($useridtofilter))
|
||||
{
|
||||
$useridtofilter=$childids;
|
||||
if (! empty($user->rights->deplacement->readall) || ! empty($user->rights->deplacement->lire_tous)) $useridtofilter=0;
|
||||
}
|
||||
|
||||
$stats = new DeplacementStats($db, $socid, $useridtofilter);
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
@ -220,7 +240,9 @@ print $form->select_company($socid,'socid',$filter,1,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_dolusers($userid,'userid',1);
|
||||
$include='';
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $include='hierarchy';
|
||||
print $form->select_dolusers($userid,'userid',1,'',0,$include);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
|
||||
@ -50,7 +50,7 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
|
||||
$result = restrictedArea($user, 'don', $id);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('doncard'));
|
||||
$hookmanager->initHooks(array('doncard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -101,7 +101,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('invoicecard'));
|
||||
$hookmanager->initHooks(array('invoicecard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
@ -406,21 +406,25 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) dol_print_error($db,$result);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
||||
else setEventMessage($object->error, 'errors');
|
||||
}
|
||||
@ -483,20 +487,22 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
||||
$result=$object->set_draft($user, $idwarehouse);
|
||||
if ($result<0) setEventMessage($object->error,'errors');
|
||||
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1158,7 +1164,11 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if ($qty < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
|
||||
$ret = $object->fetch($id);
|
||||
if ($ret < 0) {
|
||||
@ -1201,8 +1211,8 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
//$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
//$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -1304,23 +1314,26 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
||||
// Insert line
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option);
|
||||
|
||||
if ($result > 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = GETPOST('lang_id', 'alpha');
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$model=$object->modelpdf;
|
||||
if (empty($model)) { $tmp=getListOfModels($db, 'invoice'); $keys=array_keys($tmp); $model=$keys[0]; }
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['prod_entry_mode']);
|
||||
unset($_POST['prod_entry_mode']);
|
||||
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
@ -1359,9 +1372,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel')) {
|
||||
if (! $object->fetch($id) > 0)
|
||||
dol_print_error($db);
|
||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel'))
|
||||
{
|
||||
if (! $object->fetch($id) > 0) dol_print_error($db);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Clean parameters
|
||||
@ -1372,6 +1385,7 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$qty = GETPOST('qty');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -1428,10 +1442,15 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
if ($qty < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
// Update line
|
||||
if (! $error) {
|
||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option);
|
||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option);
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -1463,6 +1482,8 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
unset($_POST['np_marginRate']);
|
||||
unset($_POST['np_markRate']);
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
@ -1594,8 +1615,9 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$sendtoid = $_POST['receiver'];
|
||||
}
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto)) {
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>';
|
||||
@ -1605,31 +1627,19 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
|
||||
if ($action == 'send') {
|
||||
if ($action == 'send' || $action == 'relance')
|
||||
{
|
||||
if (dol_strlen($_POST['subject']))
|
||||
$subject = $_POST['subject'];
|
||||
else
|
||||
$subject = $langs->transnoentities('Bill') . ' ' . $object->ref;
|
||||
$actiontypecode = 'AC_FAC';
|
||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto . ".\n";
|
||||
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
|
||||
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;
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
// $actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||
}
|
||||
@ -1639,9 +1649,9 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$attachedfiles = $formmail->get_attached_files();
|
||||
$filepath = $attachedfiles ['paths'];
|
||||
$filename = $attachedfiles ['names'];
|
||||
$mimetype = $attachedfiles ['mimes'];
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Send mail
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
@ -1694,17 +1704,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
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);
|
||||
$langs->load("other");
|
||||
setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors');
|
||||
dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
|
||||
}
|
||||
} else {
|
||||
$langs->load("other");
|
||||
@ -1775,8 +1778,10 @@ else if ($action == 'print_file' and $user->rights->printipp->read) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
||||
if ($action == 'addcontact') {
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0) {
|
||||
@ -3322,51 +3327,9 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes (TODO Move this into an include)
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
$parameters = array('colspan' => ' colspan="2"');
|
||||
$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)) {
|
||||
|
||||
foreach ($extrafields->attribute_label as $key => $label) {
|
||||
if ($action == 'edit_extras') {
|
||||
$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options ["options_" . $key]);
|
||||
} else {
|
||||
$value = $object->array_options ["options_" . $key];
|
||||
}
|
||||
if ($extrafields->attribute_type [$key] == 'separate') {
|
||||
print $extrafields->showSeparator($key);
|
||||
} else {
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required [$key]))
|
||||
print ' class="fieldrequired"';
|
||||
print '>' . $label . '</td><td colspan="5">';
|
||||
// Convert date into timestamp format
|
||||
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]);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->facture->creer && GETPOST('attribute') == $key) {
|
||||
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="attribute" value="' . $key . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print $extrafields->showInputField($key, $value);
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $extrafields->showOutputField($key, $value);
|
||||
if ($object->statut == 0 && $user->rights->facture->creer)
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Other attributes
|
||||
$cols = 5;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
@ -3619,21 +3582,24 @@ if ($action == 'create')
|
||||
// Linked object block
|
||||
$somethingshown = $object->showLinkedObjectBlock();
|
||||
|
||||
if (empty($somethingshown) && ! empty($conf->commande->enabled))
|
||||
$linktoelem='';
|
||||
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
print '<br><a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linktoorder").click(function() {
|
||||
jQuery("#commande").toggle();
|
||||
jQuery("#orderlist").toggle();
|
||||
jQuery("#linktoorder").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<div id="commande" style="display:none">';
|
||||
print '<div id="orderlist" style="display:none">';
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
|
||||
@ -3641,11 +3607,12 @@ if ($action == 'create')
|
||||
$sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . '';
|
||||
|
||||
$resqlorderlist = $db->query($sql);
|
||||
if ($resqlorderlist) {
|
||||
if ($resqlorderlist)
|
||||
{
|
||||
$num = $db->num_rows($resqlorderlist);
|
||||
$i = 0;
|
||||
|
||||
print '<form action="" method="POST" name="LinkedOrder">';
|
||||
print '<br><form action="" method="POST" name="LinkedOrder">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
@ -3654,7 +3621,8 @@ if ($action == 'create')
|
||||
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
while ($i < $num) {
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resqlorderlist);
|
||||
if ($objp->socid == $soc->id) {
|
||||
$var = ! $var;
|
||||
@ -3672,7 +3640,7 @@ if ($action == 'create')
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><center><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"></center>';
|
||||
print '<br><center><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></center>';
|
||||
print '</form>';
|
||||
$db->free($resqlorderlist);
|
||||
} else {
|
||||
@ -3682,6 +3650,9 @@ if ($action == 'create')
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Show link to elements
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
|
||||
@ -398,7 +398,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Si fichier png PDF d'1 page trouve
|
||||
if (file_exists($fileimage))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
|
||||
}
|
||||
// Si fichier png PDF de plus d'1 page trouve
|
||||
elseif (file_exists($fileimagebis))
|
||||
@ -411,12 +411,12 @@ elseif (file_exists($fileimagebis))
|
||||
|
||||
if (file_exists($dir_output.$preview))
|
||||
{
|
||||
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user