Merge branch 'develop' into Bookkeeping-V6
This commit is contained in:
commit
c5267154b9
@ -11,7 +11,7 @@ php:
|
|||||||
- '5.3'
|
- '5.3'
|
||||||
- '5.4'
|
- '5.4'
|
||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6.29'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
- nightly
|
- nightly
|
||||||
@ -305,6 +305,9 @@ script:
|
|||||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
|
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||||
|
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||||
|
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||||
cd -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
|
|||||||
@ -53,6 +53,7 @@ jQuery Tiptip 1.3 GPL and MIT License Yes
|
|||||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
||||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||||
|
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
|
|
||||||
For licenses compatibility informations:
|
For licenses compatibility informations:
|
||||||
http://www.gnu.org/licenses/licenses.en.html
|
http://www.gnu.org/licenses/licenses.en.html
|
||||||
|
|||||||
122
ChangeLog
122
ChangeLog
@ -2,12 +2,134 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||||
|
|
||||||
|
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||||
|
NEW: Add a payment module for Stripe.
|
||||||
|
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||||
|
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
||||||
|
NEW: Add a tracking id into mass emailing.
|
||||||
|
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
|
||||||
|
NEW: Add calculation function for Loan schedule
|
||||||
|
NEW: Add "depends on" and "required by" into module informations
|
||||||
|
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
||||||
|
NEW: Add key __USERID__ and __ENTITYID__ as key for dynamic filters.
|
||||||
|
NEW: Add last activation author and ip of modules
|
||||||
|
NEW: Add mass actions (pdf merge and delete) for interventions
|
||||||
|
NEW: Add module resources import/export
|
||||||
|
NEW: Add option PROJECT_THIRDPARTY_REQUIRED
|
||||||
|
NEW: Add page statistics for project tasks
|
||||||
|
NEW: add property to show warnings when activating modules
|
||||||
|
NEW: add rapport file for supplier paiement
|
||||||
|
NEW: Add statistics on supplier tab.
|
||||||
|
NEW: Add tooltip help on shipment weight and volume calculation
|
||||||
|
NEW: An external module can hook and add mass actions
|
||||||
|
NEW: Better reponsive design
|
||||||
|
NEW: Bookmarks are into a combo list.
|
||||||
|
NEW: Bulk actions available on supplier orders
|
||||||
|
NEW: Can add a background image on login page
|
||||||
|
NEW: Can change customer from POS
|
||||||
|
NEW: Can clone expense report on another user
|
||||||
|
NEW: Can control constants values into file integrity checker
|
||||||
|
NEW: Can define default values for create forms.
|
||||||
|
NEW: Can define default filters for list pages.
|
||||||
|
NEW: Can define default sort order for list pages.
|
||||||
|
NEW: Can deploy an external module from the module setup area.
|
||||||
|
NEW: Can disable all overwrote translations in one click.
|
||||||
|
NEW: Can edit background color for odd and even lines in tables
|
||||||
|
NEW: Can filter on code in dictionnaries
|
||||||
|
NEW: Can filter on year and product tags on the product statistic page
|
||||||
|
NEW: Can import users
|
||||||
|
NEW: Can read time spent of others (hierarchy only or all if granted)
|
||||||
|
NEW: Can send an email to a user from its card.
|
||||||
|
NEW: Can send email to multiple destinaries from the mailform combo list.
|
||||||
|
NEW: Can set margins of PDFs
|
||||||
|
NEW: Can set number of dump to keep with job "local database backup"
|
||||||
|
NEW: Can sort customer balance summary on date.
|
||||||
|
NEW: Can sort thumbs visible on product card.
|
||||||
|
NEW: Can use a credit note into a "down payment/deposit".
|
||||||
|
NEW: Can use dol_fiche_end without showing bottom border.
|
||||||
|
NEW: Can use translations into all substitutions (watermark, freetext...)
|
||||||
|
NEW: Change to allow a specific numbering rule for invoice with POS module.
|
||||||
|
NEW: convert exceiss received to reduc
|
||||||
|
NEW: custom dir is enabled dy default on first install.
|
||||||
|
NEW: Description of feature of a module visible into a dedicated popup.
|
||||||
|
NEW: Direct open of card after a search if one record only found.
|
||||||
|
NEW: download button
|
||||||
|
NEW: Enable bulk actions delete on supplier invoices.
|
||||||
|
NEW: Extrafields support formulas to be computed using PHP expressions.
|
||||||
|
NEW: Feature to crop/resize images available on user and expense reports.
|
||||||
|
NEW: Filechecker can include custom dir and report added files.
|
||||||
|
NEW: fix listview class and add a demo for product list
|
||||||
|
NEW: [FP17] Accountancy - Add select field in list of accounts
|
||||||
|
NEW: get amount base on hourly rate for ficheinter
|
||||||
|
NEW: hidden Easter egg to display commitstrip strip on login page
|
||||||
|
NEW: Include an hourglass icon when we click on online payment button
|
||||||
|
NEW: Index upload files into database.
|
||||||
|
NEW: Introduce mass action on product list ('delete' for the moment)
|
||||||
|
NEW: Introduce mass actions on contacts
|
||||||
|
NEW: Introduce option MAIN_HTTP_CONTENT_SECURITY_POLICY
|
||||||
|
NEW: It's easier to switch between sandbox and live for paypal
|
||||||
|
NEW: Mass action delete available on project and tasks
|
||||||
|
NEW: Move login information on home page into a widget
|
||||||
|
NEW: new demo entry page
|
||||||
|
NEW: No external check of version without explicit click in about page.
|
||||||
|
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
|
||||||
|
NEW: odt usergroup
|
||||||
|
NEW: On invoices generated by template, we save if invoice come from a source template.
|
||||||
|
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
|
||||||
|
NEW: PDF with numbertoword
|
||||||
|
NEW: Permit multiple file upload in linked documents
|
||||||
|
NEW: PHP 7.1 compatibility
|
||||||
|
NEW: Reduce memory usage by removing deprecated constant loading.
|
||||||
|
NEW: Report page and menu for suppliers paiements
|
||||||
|
NEW: Show by default README.md file found into root dir of ext module.
|
||||||
|
NEW: Show company into combo list of projects
|
||||||
|
NEW: show files in the bank statement + download
|
||||||
|
NEW: Show local taxes in facture list
|
||||||
|
NEW: Show local taxes in supplier facture list
|
||||||
|
NEW: Small PDF template for products
|
||||||
|
NEW: Option SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT
|
||||||
|
NEW: The substitution keys available for emailing edition are now visible into a popup.
|
||||||
|
NEW: Uniformize behaviour: Action to make order is an action button.
|
||||||
|
NEW: Use autocompletion on the "Add widget list".
|
||||||
|
NEW: Use html5 type "number" on select field for year and duration.
|
||||||
|
NEW: Can use pdktk to concat mass pdf because tcpdf generate avoid to split large file into multiple smaller file (all have same size) encounter issue with mailer provider virtual delivery service
|
||||||
|
NEW: Default theme of v6 is cleaner.
|
||||||
|
NEW: When down payment is entered, discount to reuse into final invoice is automatically created. This save one click into invoice workflow.
|
||||||
|
NEW: Add UI to configure MEMBER_NEWFORM_FORCETYPE
|
||||||
|
NEW: #2763 Go to document block after clicking in Generate document button
|
||||||
|
NEW: #6280: Generate PDF after creating an invoice from a customer order
|
||||||
|
NEW: #6915 Simplest change.
|
||||||
|
NEW: Uniformize the look and feel with v6 new look.
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
|
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
|
||||||
NEW: Big refactorization of multicompany transverse mode.
|
NEW: Big refactorization of multicompany transverse mode.
|
||||||
NEW: getEntity function use true $shared value by default.
|
NEW: getEntity function use true $shared value by default.
|
||||||
|
NEW: Add font-awesome css.
|
||||||
|
NEW: Add function ajax_autoselect
|
||||||
|
NEW: Add function dolMd2Html
|
||||||
|
NEW: Add hook doUpgrade2
|
||||||
|
NEW: Add hook "formatNotificationMessage"
|
||||||
|
NEW: Add index and constraints keys on supplier proposal detail table
|
||||||
|
NEW: Add phpunit to check the engine is defined into sql create files.
|
||||||
|
NEW: Add project and Hook to Loan
|
||||||
|
NEW: Add REST API to push a file.
|
||||||
|
NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list
|
||||||
|
NEW: Architecture to manage search criteria persistance (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links)
|
||||||
|
NEW: data files are now also parsed by phpunit for sql syntax
|
||||||
|
NEW: Hook to allow inserting custom product head #6001
|
||||||
|
NEW: Introduce fields that can be computed during export in export profiles.
|
||||||
|
NEW: Introduce function dol_compress_dir
|
||||||
|
NEW: Removed commande_pdf_create, contract_pdf_create,expedition_pdf_create, facture_pdf_create, delivery_order_pdf_create, task_pdf_create, project_pdf_create, propale_pdf_create, supplier_invoice_pdf_create, supplier_order_pdf_create, supplier_proposal_pdf_create deprecated functions
|
||||||
|
NEW: tooltip can be on hover or on click with textwithpicto function.
|
||||||
|
NEW: Upgrade jquery to 3.3.1 and jquery-ui to 1.12
|
||||||
|
|
||||||
WARNING:
|
WARNING:
|
||||||
|
|
||||||
|
|||||||
@ -353,8 +353,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
// TODO Copy file or ask to install package ?
|
// TODO Copy file or ask to install package ?
|
||||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||||
end;
|
end;
|
||||||
|
// Pb seems similar with msvcp110.dll
|
||||||
|
//vcredist_x64.exe
|
||||||
|
|
||||||
|
|
||||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
|
|||||||
@ -592,6 +592,8 @@ if ($nboftargetok) {
|
|||||||
print "Remove subdir of custom dir\n";
|
print "Remove subdir of custom dir\n";
|
||||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
|
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
|
||||||
|
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
|
||||||
|
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build package for each target
|
# Build package for each target
|
||||||
@ -972,9 +974,11 @@ if ($nboftargetok) {
|
|||||||
$ret=`$cmd`;
|
$ret=`$cmd`;
|
||||||
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
||||||
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
|
||||||
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_myobject.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject_api_class.class.php`;
|
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
||||||
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
|
||||||
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`;
|
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`;
|
||||||
|
|||||||
@ -162,6 +162,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/api
|
%_datadir/dolibarr/htdocs/api
|
||||||
%_datadir/dolibarr/htdocs/asterisk
|
%_datadir/dolibarr/htdocs/asterisk
|
||||||
%_datadir/dolibarr/htdocs/barcode
|
%_datadir/dolibarr/htdocs/barcode
|
||||||
|
%_datadir/dolibarr/htdocs/blockedlog
|
||||||
%_datadir/dolibarr/htdocs/bookmarks
|
%_datadir/dolibarr/htdocs/bookmarks
|
||||||
%_datadir/dolibarr/htdocs/cashdesk
|
%_datadir/dolibarr/htdocs/cashdesk
|
||||||
%_datadir/dolibarr/htdocs/categories
|
%_datadir/dolibarr/htdocs/categories
|
||||||
|
|||||||
@ -242,6 +242,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/api
|
%_datadir/dolibarr/htdocs/api
|
||||||
%_datadir/dolibarr/htdocs/asterisk
|
%_datadir/dolibarr/htdocs/asterisk
|
||||||
%_datadir/dolibarr/htdocs/barcode
|
%_datadir/dolibarr/htdocs/barcode
|
||||||
|
%_datadir/dolibarr/htdocs/blockedlog
|
||||||
%_datadir/dolibarr/htdocs/bookmarks
|
%_datadir/dolibarr/htdocs/bookmarks
|
||||||
%_datadir/dolibarr/htdocs/cashdesk
|
%_datadir/dolibarr/htdocs/cashdesk
|
||||||
%_datadir/dolibarr/htdocs/categories
|
%_datadir/dolibarr/htdocs/categories
|
||||||
|
|||||||
@ -159,6 +159,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/api
|
%_datadir/dolibarr/htdocs/api
|
||||||
%_datadir/dolibarr/htdocs/asterisk
|
%_datadir/dolibarr/htdocs/asterisk
|
||||||
%_datadir/dolibarr/htdocs/barcode
|
%_datadir/dolibarr/htdocs/barcode
|
||||||
|
%_datadir/dolibarr/htdocs/blockedlog
|
||||||
%_datadir/dolibarr/htdocs/bookmarks
|
%_datadir/dolibarr/htdocs/bookmarks
|
||||||
%_datadir/dolibarr/htdocs/cashdesk
|
%_datadir/dolibarr/htdocs/cashdesk
|
||||||
%_datadir/dolibarr/htdocs/categories
|
%_datadir/dolibarr/htdocs/categories
|
||||||
|
|||||||
@ -170,6 +170,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/api
|
%_datadir/dolibarr/htdocs/api
|
||||||
%_datadir/dolibarr/htdocs/asterisk
|
%_datadir/dolibarr/htdocs/asterisk
|
||||||
%_datadir/dolibarr/htdocs/barcode
|
%_datadir/dolibarr/htdocs/barcode
|
||||||
|
%_datadir/dolibarr/htdocs/blockedlog
|
||||||
%_datadir/dolibarr/htdocs/bookmarks
|
%_datadir/dolibarr/htdocs/bookmarks
|
||||||
%_datadir/dolibarr/htdocs/cashdesk
|
%_datadir/dolibarr/htdocs/cashdesk
|
||||||
%_datadir/dolibarr/htdocs/categories
|
%_datadir/dolibarr/htdocs/categories
|
||||||
|
|||||||
@ -5,7 +5,7 @@ in Dolibarr root.
|
|||||||
|
|
||||||
ALL:
|
ALL:
|
||||||
----
|
----
|
||||||
Check "DOL_CHANGE"
|
Check "@CHANGE"
|
||||||
|
|
||||||
|
|
||||||
CKEDITOR (4.6.2):
|
CKEDITOR (4.6.2):
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
||||||
Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109
|
Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109
|
||||||
Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109
|
Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109
|
||||||
Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109
|
Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109
|
||||||
|
|||||||
@ -1 +1,4 @@
|
|||||||
http://www.taxrates.cc/index.html
|
http://www.taxrates.cc/index.html
|
||||||
|
|
||||||
|
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# vim:ft=sh:ts=3:sts=3:sw=3:et:
|
|
||||||
|
|
||||||
###
|
|
||||||
# Strips the closing php tag `?>` and any following blank lines from the
|
|
||||||
# end of any PHP file in the current working directory and sub-directories. Files
|
|
||||||
# with non-whitespace characters following the closing tag will not be affected.
|
|
||||||
#
|
|
||||||
# Author: Bryan C. Geraghty <bryan@ravensight.org>
|
|
||||||
# Date: 2009-10-28
|
|
||||||
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
|
|
||||||
##
|
|
||||||
|
|
||||||
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
|
|
||||||
|
|
||||||
for MATCH in $FILES;
|
|
||||||
do
|
|
||||||
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
|
|
||||||
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
|
|
||||||
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
|
|
||||||
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
|
|
||||||
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
|
|
||||||
done;
|
|
||||||
@ -12,3 +12,6 @@ Balance ?? Net profit
|
|||||||
Subledger account Subledger account ??
|
Subledger account Subledger account ??
|
||||||
|
|
||||||
|
|
||||||
|
Proposal ?? Quotation Proposal is ok but proposition looks better (proposal is for a detailed proposition). We can say also "business proposition or business proposal".
|
||||||
|
Indian are using "Quotation".
|
||||||
|
|
||||||
|
|||||||
@ -288,7 +288,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||||||
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^LT[0-9]/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||||
|
|||||||
@ -303,6 +303,8 @@ foreach($filesToProcess as $fileToProcess)
|
|||||||
|
|
||||||
// ----- Process output now -----
|
// ----- Process output now -----
|
||||||
|
|
||||||
|
//print "Found primary key = ".$key."\n";
|
||||||
|
|
||||||
// Key not in other file
|
// Key not in other file
|
||||||
if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
|
if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
|
||||||
{
|
{
|
||||||
@ -321,7 +323,7 @@ foreach($filesToProcess as $fileToProcess)
|
|||||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
|
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
|
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";
|
||||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_account = "";
|
$search_account = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
|
|||||||
@ -46,7 +46,7 @@ if ($cat_id == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ $rowid=GETPOST('rowid','alpha');
|
|||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
// Security access
|
// Security access
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ $langs->load("salaries");
|
|||||||
$langs->load("loan");
|
$langs->load("loan");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ $langs->load("admin");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount))
|
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,7 +266,7 @@ if (! empty($user->admin))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Param a user $user->rights->accountancy->chartofaccount can access
|
// Param a user $user->rights->accounting->chartofaccount can access
|
||||||
foreach ($list as $key)
|
foreach ($list as $key)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
|
|||||||
@ -41,7 +41,7 @@ $rowid=GETPOST('rowid','alpha');
|
|||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
// Security access
|
// Security access
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -134,6 +134,7 @@ $elementList = array();
|
|||||||
'2' => $langs->trans('AccountingJournalType2'),
|
'2' => $langs->trans('AccountingJournalType2'),
|
||||||
'3' => $langs->trans('AccountingJournalType3'),
|
'3' => $langs->trans('AccountingJournalType3'),
|
||||||
'4' => $langs->trans('AccountingJournalType4'),
|
'4' => $langs->trans('AccountingJournalType4'),
|
||||||
|
'5' => $langs->trans('AccountingJournalType5'),
|
||||||
'9' => $langs->trans('AccountingJournalType9')
|
'9' => $langs->trans('AccountingJournalType9')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
|
|||||||
@ -98,7 +98,7 @@ if (! empty($search_accountancy_code_end)) {
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,13 +17,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/bookkeeping/card.php
|
* \file htdocs/accountancy/bookkeeping/card.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show book-entry
|
* \brief Page to show book-entry
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
@ -38,7 +40,7 @@ if ($user->societe_id > 0) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$mode = GETPOST('mode');
|
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
||||||
$piece_num = GETPOST("piece_num");
|
$piece_num = GETPOST("piece_num");
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
@ -53,29 +55,41 @@ $label_operation= GETPOST('label_operation');
|
|||||||
$debit = price2num(GETPOST('debit'));
|
$debit = price2num(GETPOST('debit'));
|
||||||
$credit = price2num(GETPOST('credit'));
|
$credit = price2num(GETPOST('credit'));
|
||||||
|
|
||||||
$save = GETPOST('save');
|
$save = GETPOST('save','alpha');
|
||||||
if (! empty($save)) {
|
if (! empty($save)) $action = 'add';
|
||||||
$action = 'add';
|
$update = GETPOST('update','alpha');
|
||||||
}
|
if (! empty($update)) $action = 'confirm_update';
|
||||||
$update = GETPOST('update');
|
|
||||||
if (! empty($update)) {
|
|
||||||
$action = 'confirm_update';
|
|
||||||
}
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
if ($action == "confirm_update") {
|
if ($action == "confirm_update") {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
$error++;
|
||||||
$error ++;
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
|
$action='update';
|
||||||
}
|
}
|
||||||
|
if (empty($account_number) || $account_number == '-1')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
|
$action='update';
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error)) {
|
if (! $error)
|
||||||
|
{
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id, null, $mode);
|
$result = $book->fetch($id, null, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
@ -98,7 +112,14 @@ if ($action == "confirm_update") {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,12 +129,20 @@ if ($action == "confirm_update") {
|
|||||||
else if ($action == "add") {
|
else if ($action == "add") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
{
|
||||||
$error ++;
|
$error++;
|
||||||
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
if (empty($account_number) || $account_number == '-1')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error)) {
|
if (! $error) {
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
@ -144,7 +173,14 @@ else if ($action == "add") {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,6 +208,11 @@ else if ($action == "confirm_create") {
|
|||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
|
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||||
|
$action='create';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
if (! GETPOST('next_num_mvt'))
|
if (! GETPOST('next_num_mvt'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
||||||
@ -196,7 +237,10 @@ else if ($action == "confirm_create") {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
$action = 'update';
|
$action = 'update';
|
||||||
$id=$book->id;
|
$id=$book->id;
|
||||||
$piece_num = $book->piece_num;
|
$piece_num = $book->piece_num;
|
||||||
@ -210,39 +254,43 @@ if ($action == 'setdate') {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setjournal') {
|
if ($action == 'setjournal') {
|
||||||
$journaldoc = trim(GETPOST('code_journal'));
|
$journaldoc = trim(GETPOST('code_journal'));
|
||||||
if (!empty($journaldoc)) {
|
|
||||||
$journaldoc='\''.$journaldoc.'\'';
|
|
||||||
}
|
|
||||||
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdocref') {
|
if ($action == 'setdocref') {
|
||||||
$refdoc = trim(GETPOST('doc_ref'));
|
$refdoc = trim(GETPOST('doc_ref'));
|
||||||
if (!empty($refdoc)) {
|
$result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode);
|
||||||
$refdoc='\''.$refdoc.'\'';
|
|
||||||
}
|
|
||||||
$result = $object->updateByMvt(doc_ref,'code_journal',$refdoc,$mode);
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
if ($mode != '_tmp')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate transaction
|
||||||
if ($action == 'valid') {
|
if ($action == 'valid') {
|
||||||
$result = $object->transformTransaction(0,$piece_num);
|
$result = $object->transformTransaction(0,$piece_num);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -253,14 +301,17 @@ if ($action == 'valid') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
llxHeader();
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accountjournal = new AccountingJournal($db);
|
$accountjournal = new AccountingJournal($db);
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans("CreateMvts"));
|
||||||
|
|
||||||
// Confirmation to delete the command
|
// Confirmation to delete the command
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||||
@ -300,7 +351,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
|
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
|
||||||
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,0,array(),1,1) . '</td>';
|
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,1,array(),1,1) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -328,29 +379,45 @@ if ($action == 'create') {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($book->piece_num)) {
|
if (! empty($book->piece_num)) {
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
$backlink = '<a href="list.php">' . $langs->trans('BackToList') . '</a>';
|
||||||
|
|
||||||
dol_fiche_head();
|
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||||
|
|
||||||
|
$head=array();
|
||||||
|
$h=0;
|
||||||
|
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:'');
|
||||||
|
$head[$h][1] = $langs->trans("Transaction");
|
||||||
|
$head[$h][2] = 'transaction';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'transaction', '', -1);
|
||||||
|
|
||||||
|
|
||||||
|
//dol_banner_tab($book, '', $backlink);
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// account movement
|
// account movement
|
||||||
print '<tr class="pair">';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||||
print '<td>' . $book->piece_num . '</td>';
|
print '<td>' . $book->piece_num . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// date
|
// date
|
||||||
print '<tr class="impair"><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docdate');
|
print $langs->trans('Docdate');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdate')
|
if ($action != 'editdate')
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editdate') {
|
if ($action == 'editdate') {
|
||||||
@ -361,18 +428,18 @@ if ($action == 'create') {
|
|||||||
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//journal
|
//journal
|
||||||
print '<tr class="pair"><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Codejournal');
|
print $langs->trans('Codejournal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editjournal')
|
if ($action != 'editjournal')
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editjournal') {
|
if ($action == 'editjournal') {
|
||||||
@ -389,12 +456,12 @@ if ($action == 'create') {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//docref
|
//docref
|
||||||
print '<tr class="impair"><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docref');
|
print $langs->trans('Docref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdocref')
|
if ($action != 'editdocref')
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editdocref') {
|
if ($action == 'editdocref') {
|
||||||
@ -410,21 +477,25 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//doctype
|
|
||||||
print '<tr class="pair">';
|
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
|
||||||
print '<td>' . $book->doc_type . '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
|
// Doc type
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||||
|
print '<td>' . $book->doc_type . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
print '<tr class="pair">';
|
/*
|
||||||
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (empty($book->validated)) {
|
if (empty($book->validated)) {
|
||||||
@ -438,10 +509,12 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
// check data
|
// check data
|
||||||
print '<tr class="impair">';
|
|
||||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
|
||||||
/*
|
/*
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||||
if ($book->doc_type == 'customer_invoice')
|
if ($book->doc_type == 'customer_invoice')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT rowid as ref';
|
$sqlmid = 'SELECT rowid as ref';
|
||||||
@ -457,14 +530,19 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
print '<td>' . $ref .'</td>';
|
print '<td>' . $ref .'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
*/
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</div>';
|
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<div style="clear:both"></div>';
|
print '<div style="clear:both"></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
@ -490,11 +568,11 @@ if ($action == 'create') {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||||
print_liste_field_titre($langs->trans("Subledger_account"));
|
print_liste_field_titre($langs->trans("SubledgerAccount"));
|
||||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||||
print_liste_field_titre($langs->trans("Labeloperation"));
|
print_liste_field_titre($langs->trans("Label"));
|
||||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"');
|
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -506,15 +584,24 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($action == 'update' && $line->id == $id) {
|
if ($action == 'update' && $line->id == $id) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
|
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||||
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
||||||
@ -528,10 +615,14 @@ if ($action == 'create') {
|
|||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . price($line->credit) . '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a> ';
|
print '</a> ';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
|
||||||
|
$actiontodelete='detele';
|
||||||
|
if ($mode == '_tmp') $actiontodelete='confirm_delete';
|
||||||
|
|
||||||
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?action='.$actiontodelete.'&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
|
|
||||||
print '</a>';
|
print '</a>';
|
||||||
@ -548,22 +639,46 @@ if ($action == 'create') {
|
|||||||
if ($action == "" || $action == 'add') {
|
if ($action == "" || $action == 'add') {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="subledger_account" value="">';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
|
||||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
if ($mode=='_tmp' && $total_debit == $total_credit && $action=='') {
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
if ($mode=='_tmp' && $action=='')
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
print '<div class="center">';
|
||||||
|
if ($total_debit == $total_credit)
|
||||||
|
{
|
||||||
|
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||||
|
}
|
||||||
|
|
||||||
|
print ' ';
|
||||||
|
print '<a class="button" href="' . DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,6 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +111,7 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
|||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_mvt_num = '';
|
$search_mvt_num = '';
|
||||||
$search_doc_type = '';
|
$search_doc_type = '';
|
||||||
@ -377,33 +376,51 @@ print '<tr class="liste_titre_filter">';
|
|||||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ': ';
|
print $langs->trans('From') . ' ';
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ': ';
|
print $langs->trans('to') . ' ';
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From').' ';
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to');
|
print $langs->trans('to').' ';
|
||||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From').' ';
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to');
|
print $langs->trans('to').' ';
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@ -437,7 +454,10 @@ print "</tr>\n";
|
|||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
|
|
||||||
foreach ($object->lines as $line ) {
|
$i=0;
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$line = $object->lines[$i];
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -463,6 +483,8 @@ foreach ($object->lines as $line ) {
|
|||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
|
|||||||
@ -92,7 +92,7 @@ if (! empty($search_doc_date)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (! GETPOST('button_removefilter_x','alpha') && ! GETPOST('button_removefilter.x','alpha') && ! GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
if (! empty($search_accountancy_code_start)) {
|
if (! empty($search_accountancy_code_start)) {
|
||||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||||
@ -121,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_doc_date = '';
|
$search_doc_date = '';
|
||||||
$search_accountancy_code = '';
|
$search_accountancy_code = '';
|
||||||
@ -160,7 +160,6 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By"
|
|||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
// List
|
// List
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||||
@ -173,7 +172,9 @@ $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $f
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
$nbtotalofrecords = $result;
|
|
||||||
|
$num=count($object->lines);
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||||
@ -204,7 +205,7 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
|
|||||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></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 type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||||
print '<td class="liste_titre" align="right" colspan="2">';
|
print '<td class="liste_titre" align="right" colspan="2">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
@ -250,7 +251,7 @@ print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_re
|
|||||||
print_liste_field_titre($langs->trans("Label"));
|
print_liste_field_titre($langs->trans("Label"));
|
||||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -263,7 +264,10 @@ $sous_total_debit = 0;
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
$i=0;
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$line = $object->lines[$i];
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -323,10 +327,11 @@ foreach ( $object->lines as $line ) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Comptabilise le sous-total
|
// Comptabilise le sous-total
|
||||||
$sous_total_debit += $line->debit;
|
$sous_total_debit += $line->debit;
|
||||||
$sous_total_credit += $line->credit;
|
$sous_total_credit += $line->credit;
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
// Affiche un Sous-Total du dernier compte comptable affiché
|
||||||
|
|||||||
@ -86,7 +86,7 @@ $offset = $limit * $page;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_doc_type = "";
|
$search_doc_type = "";
|
||||||
$search_doc_date = "";
|
$search_doc_date = "";
|
||||||
|
|||||||
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.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 accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
|
* \ingroup Advanced accountancy
|
||||||
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
|
$action=GETPOST('action','aZ09');
|
||||||
|
$massaction=GETPOST('massaction','alpha');
|
||||||
|
$show_files=GETPOST('show_files','int');
|
||||||
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
|
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||||
|
|
||||||
|
$search_year = GETPOST ( "search_year" );
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid = GETPOST("socid",'int');
|
||||||
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
|
$object = new Societe($db);
|
||||||
|
$object->id = $socid;
|
||||||
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$BookKeeping = new lettering($db);
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Action
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
|
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
if( $result < 0 ){
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
|
$result = $BookKeeping->LettrageTiers($socid);
|
||||||
|
|
||||||
|
if( $result < 0 ){
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader ( '', 'Compta - Grand Livre' );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affichage onglets
|
||||||
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter="te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">'.$langs->trans("CustomerCode"). '</td><td colspan="3">';
|
||||||
|
print $object->code_client;
|
||||||
|
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$langs->load('compta');
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||||
|
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Zip / Town
|
||||||
|
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Country
|
||||||
|
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||||
|
//$img=picto_from_langcode($object->country_code);
|
||||||
|
$img='';
|
||||||
|
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||||
|
else print ($img?$img.' ':'').$object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (dol_strlen ( $search_year )) {
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||||
|
|
||||||
|
// echo $sql;
|
||||||
|
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||||
|
$resql = $db->query ( $sql );
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows ( $resql );
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
|
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="action" value="lettering">';
|
||||||
|
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td></td>';
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<form action="" method="GET">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||||
|
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||||
|
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
// print '<td> </td>';
|
||||||
|
// print '<td> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</form>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
$solde = 0;
|
||||||
|
$tmp = '';
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$obj = $db->fetch_object ( $resql );
|
||||||
|
|
||||||
|
if($tmp !=$obj->lettering_code || empty($tmp) )
|
||||||
|
$tmp =$obj->lettering_code;
|
||||||
|
|
||||||
|
if($tmp !=$obj->lettering_code || empty($obj->lettering_code))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
|
$debit+= $obj->debit;
|
||||||
|
$credit+= $obj->credit;
|
||||||
|
|
||||||
|
$solde+=($obj->credit-$obj->debit);
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
print '<td>' . $obj->rowid . '</td>';
|
||||||
|
if(empty($obj->lettering_code)){
|
||||||
|
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit ();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||||
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
|
// print '<td>' . $obj->numero_compte . '</td>';
|
||||||
|
// print '<td>' . $obj->code_tiers . '</td>';
|
||||||
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . $obj->debit . '</td>';
|
||||||
|
print '<td>' . $obj->credit . '</td>';
|
||||||
|
// print '<td>' . $obj->montant . '</td>';
|
||||||
|
// print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if(empty($obj->lettering_code)){
|
||||||
|
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i ++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td></td>';
|
||||||
|
// print '<td></td>';
|
||||||
|
// print '<td></td>';
|
||||||
|
print '<td><strong>' . $debit . '</strong></td>';
|
||||||
|
print '<td><strong>' . $credit . '</strong></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||||
|
// print '<td></td>';
|
||||||
|
// print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering">';
|
||||||
|
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
|
||||||
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.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 accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
|
* \ingroup Advanced accountancy
|
||||||
|
* \brief Tab to setup lettering
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Dolibarr environment
|
||||||
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
$action=GETPOST('action','aZ09');
|
||||||
|
$massaction=GETPOST('massaction','alpha');
|
||||||
|
$show_files=GETPOST('show_files','int');
|
||||||
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
|
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||||
|
|
||||||
|
$search_year = GETPOST ( "search_year" );
|
||||||
|
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid = GETPOST("socid",'int');
|
||||||
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
|
$object = new Societe($db);
|
||||||
|
$object->id = $socid;
|
||||||
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$BookKeeping = new lettering($db);
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Action
|
||||||
|
*/
|
||||||
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
|
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
if( $result < 0 ){
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
|
$result = $BookKeeping->LettrageTiers($socid);
|
||||||
|
|
||||||
|
if( $result < 0 ){
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader ( '', 'Compta - Grand Livre' );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affichage onglets
|
||||||
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter="te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">'.$langs->trans("SupplierCode"). '</td><td colspan="3">';
|
||||||
|
print $object->code_fournisseur;
|
||||||
|
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$langs->load('compta');
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||||
|
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Zip / Town
|
||||||
|
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Country
|
||||||
|
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||||
|
//$img=picto_from_langcode($object->country_code);
|
||||||
|
$img='';
|
||||||
|
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||||
|
else print ($img?$img.' ':'').$object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
// print_r($soc);
|
||||||
|
// exit;
|
||||||
|
// [code_compta] => 411DOUA
|
||||||
|
// [code_compta_fournisseur] => 401SUPPCODE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Mode Liste
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (dol_strlen ( $search_year )) {
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||||
|
|
||||||
|
// echo $sql;
|
||||||
|
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||||
|
$resql = $db->query ( $sql );
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows ( $resql );
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
|
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="action" value="lettering">';
|
||||||
|
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td></td>';
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
|
||||||
|
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
|
||||||
|
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<form action="" method="GET">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||||
|
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||||
|
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</form>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
$solde = 0;
|
||||||
|
$tmp = '';
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$obj = $db->fetch_object ( $resql );
|
||||||
|
|
||||||
|
if($tmp !=$obj->lettering || empty($tmp) )
|
||||||
|
$tmp =$obj->lettering;
|
||||||
|
|
||||||
|
if($tmp !=$obj->lettering || empty($obj->lettering))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
|
$debit+= $obj->debit;
|
||||||
|
$credit+= $obj->credit;
|
||||||
|
|
||||||
|
$solde+=($obj->credit-$obj->debit);
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
print '<td>' . $obj->rowid . '</td>';
|
||||||
|
if(empty($obj->lettering)){
|
||||||
|
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit ();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||||
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
|
// print '<td>' . $obj->numero_compte . '</td>';
|
||||||
|
// print '<td>' . $obj->code_tiers . '</td>';
|
||||||
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . $obj->debit . '</td>';
|
||||||
|
print '<td>' . $obj->credit . '</td>';
|
||||||
|
print '<td>' . $obj->montant . '</td>';
|
||||||
|
print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if(empty($obj->lettering)){
|
||||||
|
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
print '<td>' . $obj->lettering . '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td><strong>' . $debit . '</strong></td>';
|
||||||
|
print '<td><strong>' . $credit . '</strong></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering">';
|
||||||
|
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free ( $resql );
|
||||||
|
} else {
|
||||||
|
dol_print_error ( $db );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -539,8 +539,9 @@ class AccountancyCategory
|
|||||||
/**
|
/**
|
||||||
* get cpts of category
|
* get cpts of category
|
||||||
*
|
*
|
||||||
* @param int $cat_id Category id
|
* @param int $cat_id Id accounting account category
|
||||||
* @return array Result in table
|
*
|
||||||
|
* @return array Result in table
|
||||||
*/
|
*/
|
||||||
public function getCptsCat($cat_id) {
|
public function getCptsCat($cat_id) {
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|||||||
@ -177,7 +177,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->credit)) $this->credit = 0;
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||||
@ -433,6 +433,9 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->debit)) $this->debit = 0;
|
if (empty($this->debit)) $this->debit = 0;
|
||||||
if (empty($this->credit)) $this->credit = 0;
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
|
$this->debit = price2num($this->debit, 'MT');
|
||||||
|
$this->credit = price2num($this->credit, 'MT');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create)) {
|
if (empty($this->date_create)) {
|
||||||
$this->date_create = $now;
|
$this->date_create = $now;
|
||||||
@ -616,6 +619,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
@ -806,7 +810,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array ();
|
$this->lines = array();
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1005,6 +1009,9 @@ class BookKeeping extends CommonObject
|
|||||||
$this->piece_num = trim($this->piece_num);
|
$this->piece_num = trim($this->piece_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->debit = price2num($this->debit, 'MT');
|
||||||
|
$this->credit = price2num($this->credit, 'MT');
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
@ -1075,9 +1082,10 @@ class BookKeeping extends CommonObject
|
|||||||
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
||||||
$sql .= ' SET ab.' . $field . '=' . $value;
|
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
||||||
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
@ -1100,7 +1108,6 @@ class BookKeeping extends CommonObject
|
|||||||
* @param User $user User that deletes
|
* @param User $user User that deletes
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, $notrigger = false, $mode='') {
|
public function delete(User $user, $notrigger = false, $mode='') {
|
||||||
@ -1260,7 +1267,7 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$object = new Accountingbookkeeping($this->db);
|
$object = new BookKeeping($this->db);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -1583,6 +1590,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
$sql = "DELETE FROM ";
|
$sql = "DELETE FROM ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||||
@ -1591,6 +1599,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND asy.rowid = " . $pcgver;
|
$sql .= " AND asy.rowid = " . $pcgver;
|
||||||
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql .= " ORDER BY account_number ASC";
|
$sql .= " ORDER BY account_number ASC";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
330
htdocs/accountancy/class/lettering.class.php
Normal file
330
htdocs/accountancy/class/lettering.class.php
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.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 2 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 accountancy/class/bookkeeping.class.php
|
||||||
|
* \ingroup Advanced accountancy
|
||||||
|
* \brief File of class for lettering
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
||||||
|
include_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||||
|
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class lettering
|
||||||
|
*/
|
||||||
|
class lettering extends BookKeeping
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* lettrageTiers
|
||||||
|
*
|
||||||
|
* @param int $socid Thirdparty id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function lettrageTiers($socid) {
|
||||||
|
|
||||||
|
$db = $this->db;
|
||||||
|
|
||||||
|
$object = new Societe($this->db);
|
||||||
|
$object->id = $socid;
|
||||||
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
|
||||||
|
if( $object->code_compta == '411CUSTCODE')
|
||||||
|
$object->code_compta = '';
|
||||||
|
|
||||||
|
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
||||||
|
$object->code_compta_fournisseur = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||||
|
if(!empty($object->code_compta) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||||
|
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " OR ";
|
||||||
|
if(!empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
|
||||||
|
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
||||||
|
|
||||||
|
$sql .= " GROUP BY bk.lettering_code ";
|
||||||
|
|
||||||
|
|
||||||
|
$resql = $db->query ( $sql );
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows ( $resql );
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$obj = $db->fetch_object ( $resql );
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if(!empty($object->code_compta) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||||
|
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " OR ";
|
||||||
|
if(!empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
$sql .= " ) ";
|
||||||
|
// echo $sql;
|
||||||
|
$resql2 = $db->query ( $sql );
|
||||||
|
if ($resql2) {
|
||||||
|
$num2 = $db->num_rows ( $resql2 );
|
||||||
|
$i2 = 0;
|
||||||
|
$ids = array();
|
||||||
|
while ( $i2 < $num2 ) {
|
||||||
|
$obj2 = $db->fetch_object ( $resql2 );
|
||||||
|
$i2++;
|
||||||
|
$ids[] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(count($ids) > 1 ){
|
||||||
|
$result = $this->updatelettrage($ids);
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
// if( $result < 0 ){
|
||||||
|
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
// $error++;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prise en charge des lettering complexe avec prelevment , virement
|
||||||
|
*/
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||||
|
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||||
|
if(!empty($object->code_compta) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||||
|
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " OR ";
|
||||||
|
if(!empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
|
||||||
|
$sql .= " ) AND date_lettering ='' ";
|
||||||
|
$sql .= " GROUP BY bk.lettering_code ";
|
||||||
|
|
||||||
|
// echo $sql;
|
||||||
|
//
|
||||||
|
$resql = $db->query ( $sql );
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows ( $resql );
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$obj = $db->fetch_object ( $resql );
|
||||||
|
$ids = array();
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
// print_r($obj);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($obj->type =='payment_supplier' ) {
|
||||||
|
$ids[] = $obj->rowid;
|
||||||
|
|
||||||
|
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
|
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
||||||
|
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
||||||
|
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
||||||
|
$sql .= " WHERE 1 ";
|
||||||
|
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
||||||
|
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if(!empty($object->code_compta) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||||
|
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " OR ";
|
||||||
|
if(!empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
$sql .= " ) ";
|
||||||
|
// echo $sql;
|
||||||
|
// exit;
|
||||||
|
}
|
||||||
|
elseif($obj->type =='payment' ){
|
||||||
|
$ids[] = $obj->rowid;
|
||||||
|
|
||||||
|
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
|
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
||||||
|
$sql .= " WHERE 1 ";
|
||||||
|
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if(!empty($object->code_compta) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||||
|
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " OR ";
|
||||||
|
if(!empty($object->code_compta_fournisseur) )
|
||||||
|
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
// echo $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$resql2 = $db->query ( $sql );
|
||||||
|
if ($resql2) {
|
||||||
|
$num2 = $db->num_rows ( $resql2 );
|
||||||
|
$i2 = 0;
|
||||||
|
|
||||||
|
while ( $i2 < $num2 ) {
|
||||||
|
$obj2 = $db->fetch_object ( $resql2 );
|
||||||
|
$i2++;
|
||||||
|
$ids[] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($ids);
|
||||||
|
// exit;
|
||||||
|
if(count($ids) > 1 ){
|
||||||
|
$result = $this->updatelettrage($ids);
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
// if( $result < 0 ){
|
||||||
|
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||||
|
// $error++;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updatelettrage($ids, $notrigger=false){
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
|
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
||||||
|
// echo $sql;
|
||||||
|
$result = $this->db->query ( $sql );
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object ( $result );
|
||||||
|
$lettre = (empty($obj->lettering_code)? 'AAA' : $obj->lettering_code );
|
||||||
|
if(!empty($obj->lettering_code))
|
||||||
|
$lettre++;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->errors[] = 'Error'.$this->db->lasterror();;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
// var_dump(__line__, $error);
|
||||||
|
|
||||||
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
|
$sql .= " rowid IN (".implode(',', $ids).") ";
|
||||||
|
$result = $this->db->query ( $sql );
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object ( $result );
|
||||||
|
// print_r($obj);
|
||||||
|
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
||||||
|
// echo $sql;
|
||||||
|
// print_r($obj);
|
||||||
|
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||||
|
$sql.= " lettering_code='".$lettre."'";
|
||||||
|
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
||||||
|
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
||||||
|
// echo $sql ;
|
||||||
|
//
|
||||||
|
// var_dump(__line__, $error);
|
||||||
|
// print_r($this->errors);
|
||||||
|
// exit;
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// var_dump(__line__, $error);
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
// foreach($this->errors as $errmsg)
|
||||||
|
// {
|
||||||
|
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
|
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
// }
|
||||||
|
$this->db->rollback();
|
||||||
|
// echo $this->error;
|
||||||
|
// var_dump(__line__, $error);
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -18,9 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/card.php
|
* \file htdocs/accountancy/customer/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card customer ventilation
|
* \brief Card customer ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
|||||||
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/index.php
|
* \file htdocs/accountancy/customer/index.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Home customer journalization page
|
* \brief Home customer journalization page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|||||||
@ -85,7 +85,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -153,7 +153,7 @@ print '<script type="text/javascript">
|
|||||||
* Customer Invoice lines
|
* Customer Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||||
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
|
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
|
||||||
@ -270,9 +270,9 @@ if ($result) {
|
|||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -287,9 +287,9 @@ if ($result) {
|
|||||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
$clickpicto=$form->showCheckAddButtons();
|
$clickpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
||||||
@ -332,14 +332,14 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td>';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->country .'</td>';
|
print '<td align="center">' . $objp->country .'</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -179,7 +179,7 @@ llxHeader('', $langs->trans("Ventilation"));
|
|||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,";
|
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
@ -189,7 +189,8 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accounta
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql .= " AND product_type <= 2";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
||||||
|
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -387,7 +388,7 @@ if ($result) {
|
|||||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/card.php
|
* \file htdocs/accountancy/supplier/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card expense report ventilation
|
* \brief Card expense report ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|||||||
@ -82,7 +82,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_expensereport = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -146,7 +146,7 @@ print '<script type="text/javascript">
|
|||||||
* Expense reports lines
|
* Expense reports lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
|
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " aa.label, aa.account_number,";
|
$sql .= " aa.label, aa.account_number,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
@ -241,8 +241,8 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"></td>';
|
print '<td class="liste_titre" align="right"></td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -258,7 +258,7 @@ if ($result) {
|
|||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
$checkpicto=$form->showCheckAddButtons();
|
$checkpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
@ -293,7 +293,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
|
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $codeCompta . '</td>';
|
print '<td>' . $codeCompta . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_expensereport = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -174,7 +174,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
|||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
|
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
@ -284,8 +284,8 @@ if ($result) {
|
|||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||||
$checkpicto='';
|
$checkpicto='';
|
||||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
@ -333,7 +333,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -36,12 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("trips");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -53,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -90,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
|
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
@ -105,26 +101,31 @@ $sql .= " AND erd.fk_code_ventilation > 0";
|
|||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )";
|
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
$sql .= " ORDER BY er.date_debut";
|
$sql .= " ORDER BY er.date_debut";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
|
||||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
|
||||||
|
|
||||||
$taber = array ();
|
$taber = array ();
|
||||||
$tabht = array ();
|
$tabht = array ();
|
||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabuser = array ();
|
$tabuser = array ();
|
||||||
|
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||||
|
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
@ -135,6 +136,8 @@ if ($result) {
|
|||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
|
||||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
@ -146,9 +149,19 @@ if ($result) {
|
|||||||
$taber[$obj->rowid]["ref"] = $obj->ref;
|
$taber[$obj->rowid]["ref"] = $obj->ref;
|
||||||
$taber[$obj->rowid]["comments"] = $obj->comments;
|
$taber[$obj->rowid]["comments"] = $obj->comments;
|
||||||
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
||||||
|
|
||||||
|
// Avoid warnings
|
||||||
|
if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||||
|
if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||||
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabuser[$obj->rowid] = array (
|
$tabuser[$obj->rowid] = array (
|
||||||
'id' => $obj->uid,
|
'id' => $obj->uid,
|
||||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||||
@ -166,7 +179,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($taber as $key => $val)
|
foreach ($taber as $key => $val) // Loop on each expense report
|
||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
@ -177,7 +190,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -187,8 +199,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||||
@ -203,7 +215,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -220,8 +232,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
$accountingaccount->fetch(null, $k, true);
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -235,8 +245,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = $accountingaccount->label;
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -251,7 +261,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -268,9 +278,15 @@ if ($action == 'writebookkeeping') {
|
|||||||
// VAT
|
// VAT
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
// var_dump($tabtva);
|
$listoftax=array(0, 1, 2);
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
foreach($listoftax as $numtax)
|
||||||
if ($mt) {
|
{
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
@ -281,8 +297,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -297,7 +313,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -306,6 +322,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +343,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error) && count($tabpay)) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
elseif (count($tabpay) == $error)
|
elseif (count($tabpay) == $error)
|
||||||
@ -339,6 +356,21 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -350,7 +382,7 @@ $form = new Form($db);
|
|||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
/*if ($action == 'export_csv') {
|
/*if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
@ -469,26 +501,32 @@ if (empty($action) || $action == 'view') {
|
|||||||
$builddate = time();
|
$builddate = time();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
// Button to write into Ledger
|
||||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
} else {
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}*/
|
}
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
}
|
||||||
|
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
@ -510,7 +548,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("Account") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
@ -540,6 +579,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -547,7 +587,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||||
@ -557,28 +600,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print "<td><!-- VAT --></td>";
|
|
||||||
print "<td>" . $date . "</td>";
|
|
||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
|
||||||
print "<td>";
|
|
||||||
$accountoshow = length_accountg($k);
|
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
|
||||||
{
|
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
|
||||||
}
|
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -587,19 +608,63 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT
|
||||||
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- VAT --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accountg($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -36,11 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -52,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -89,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
@ -109,26 +106,30 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )";
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
|
||||||
|
|
||||||
$tabfac = array ();
|
$tabfac = array ();
|
||||||
$tabht = array ();
|
$tabht = array ();
|
||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||||
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
@ -139,9 +140,9 @@ if ($result) {
|
|||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
@ -167,10 +168,14 @@ if ($result) {
|
|||||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
@ -189,8 +194,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
{
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -198,12 +202,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
|
||||||
$invoicestatic->ref = (string) $val["refsologest"];
|
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
|
||||||
$invoicestatic->type = $val["type"];
|
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
@ -212,6 +210,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
|
$invoicestatic->id = $key;
|
||||||
|
$invoicestatic->ref = (string) $val["refsologest"];
|
||||||
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -228,8 +232,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account");
|
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||||
@ -244,7 +248,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -261,8 +265,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
$accountingaccount->fetch(null, $k, true);
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -274,12 +276,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -294,7 +296,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -312,9 +314,15 @@ if ($action == 'writebookkeeping') {
|
|||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax=array(0, 1, 2);
|
||||||
|
foreach($listoftax as $numtax)
|
||||||
|
{
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
@ -326,8 +334,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -342,7 +350,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -354,6 +362,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -371,7 +380,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error) && count($tabpay)) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
elseif (count($tabpay) == $error)
|
elseif (count($tabpay) == $error)
|
||||||
@ -382,7 +391,23 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -391,30 +416,47 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$companystatic = new Fournisseur($db);
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
$companystatic = new Fournisseur($db);
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
|
foreach ( $tabfac as $key => $val )
|
||||||
|
{
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = dol_trunc($val["description"], 32);
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
// Third party
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal . '"' ;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
@ -432,12 +474,18 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal_label . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -446,35 +494,17 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
print '"' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal_label . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third party
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print '"' . $key . '"' . $sep;
|
|
||||||
print '"' . $date . '"' . $sep;
|
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
|
||||||
print '"' . $journal_label . '"' ;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
@ -485,7 +515,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescPurchasesJournal") . '<br>';
|
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
@ -493,18 +522,13 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
}
|
}
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
|
||||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
|
||||||
} else {
|
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
@ -523,7 +547,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
@ -546,7 +570,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("Type") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -554,19 +579,52 @@ if (empty($action) || $action == 'view') {
|
|||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
$companystatic = new Fournisseur($db);
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
|
|
||||||
$invoicestatic->type = $val["type"];
|
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Third party
|
||||||
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- Thirdparty --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -577,6 +635,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td><!-- Product --></td>";
|
print "<td><!-- Product --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -585,10 +644,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
||||||
// print "<td>" . $accountingaccount->label . "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -596,50 +657,37 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
if ($mt) {
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- VAT --></td>";
|
print "<td><!-- VAT --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print "<td><!-- Thirdparty --></td>";
|
|
||||||
print "<td>" . $date . "</td>";
|
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
print "<td>";
|
|
||||||
$accountoshow = length_accounta($k);
|
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
|
||||||
{
|
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . "</td>";
|
|
||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
|
||||||
// print "</td>";
|
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page with sells journal
|
* \brief Page with sells journal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
@ -38,15 +39,10 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("commercial");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
$date_startmonth = GETPOST('date_startmonth');
|
$date_startmonth = GETPOST('date_startmonth');
|
||||||
$date_startday = GETPOST('date_startday');
|
$date_startday = GETPOST('date_startday');
|
||||||
@ -55,6 +51,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -93,7 +90,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_sell as account_tva";
|
//$sql .= " ct.accountancy_code_sell as account_tva";
|
||||||
@ -114,8 +111,10 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
$sql .= " AND fd.product_type IN (0,1)";
|
$sql .= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )";
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||||
@ -126,13 +125,15 @@ if ($result) {
|
|||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
@ -144,13 +145,15 @@ if ($result) {
|
|||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
|
||||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
@ -185,10 +188,14 @@ if ($result) {
|
|||||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
@ -207,7 +214,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
@ -244,7 +251,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account");
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||||
@ -259,7 +266,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -287,7 +294,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
@ -307,7 +314,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -325,42 +332,50 @@ if ($action == 'writebookkeeping') {
|
|||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax=array(0, 1, 2);
|
||||||
if ($mt) {
|
foreach($listoftax as $numtax)
|
||||||
$bookkeeping = new BookKeeping($db);
|
{
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$arrayofvat = $tabtva;
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
$bookkeeping->date_create = $now;
|
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
|
||||||
$bookkeeping->fk_doc = $key;
|
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
|
||||||
$bookkeeping->subledger_account = '';
|
|
||||||
$bookkeeping->subledger_label = '';
|
|
||||||
$bookkeeping->numero_compte = $k;
|
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
$bookkeeping->montant = $mt;
|
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
|
||||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
|
||||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
|
||||||
$bookkeeping->code_journal = $journal;
|
|
||||||
$bookkeeping->journal_label = $journal_label;
|
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($result < 0) {
|
if ($mt) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
$bookkeeping = new BookKeeping($db);
|
||||||
{
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$error++;
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$errorforline++;
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
$bookkeeping->date_create = $now;
|
||||||
}
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
else
|
$bookkeeping->fk_doc = $key;
|
||||||
{
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$error++;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
$errorforline++;
|
$bookkeeping->subledger_account = '';
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
|
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,6 +412,21 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -408,89 +438,92 @@ if ($action == 'writebookkeeping') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'exportcsv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val )
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
{
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
// Third party
|
||||||
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $sell_journal . '"';
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product / Service
|
||||||
|
foreach ($tabht[$key] as $k => $mt) {
|
||||||
|
$accountingaccount = new AccountingAccount($db);
|
||||||
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print " " . $sep;
|
||||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"' ;
|
print '"' . $sell_journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Product / Service
|
// VAT
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
$accountingaccount = new AccountingAccount($db);
|
foreach ($listoftax as $numtax) {
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print " " . $sep;
|
print " " . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode (dol_trunc($companystatic->name, 16) ) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"' ;
|
print '"' . $sell_journal . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VAT
|
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($mt) {
|
|
||||||
print '"' . $key . '"' . $sep;
|
|
||||||
print '"' . $date . '"' . $sep;
|
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print " " . $sep;
|
|
||||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key]. '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
|
||||||
print '"' . $sell_journal . '"' ;
|
|
||||||
print "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -503,13 +536,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescSellsJournal") . '<br>';
|
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
else
|
else
|
||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
|
||||||
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -533,7 +567,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
@ -556,6 +590,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
@ -581,7 +616,17 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->customer_code = $tabcompany[$key]['code_client'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -589,12 +634,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,6 +651,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td><!-- Product --></td>";
|
print "<td><!-- Product --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -616,7 +660,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
// print "<td>" . $accountingaccount->label . "</td>";
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
@ -625,26 +673,36 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
if ($mt) {
|
foreach ($listoftax as $numtax) {
|
||||||
print '<tr class="oddeven">';
|
$arrayofvat = $tabtva;
|
||||||
print "<td><!-- VAT --></td>";
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
print "<td>" . $date . "</td>";
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
|
||||||
print "<td>";
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
$accountoshow = length_accountg($k);
|
if ($mt) {
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
print '<tr class="oddeven">';
|
||||||
{
|
print "<td><!-- VAT --></td>";
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accountg($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
print "</td>";
|
|
||||||
// print "<td>" . $langs->trans("VAT") . "</td>";
|
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/card.php
|
* \file htdocs/accountancy/supplier/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card supplier ventilation
|
* \brief Card supplier ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -154,7 +154,8 @@ print '<script type="text/javascript">
|
|||||||
* Supplier Invoice lines
|
* Supplier Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||||
|
$sql.= " aa.label, aa.account_number, ";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
@ -266,8 +267,8 @@ if ($result) {
|
|||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
@ -285,10 +286,10 @@ if ($result) {
|
|||||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
$checkpicto=$form->showCheckAddButtons();
|
$checkpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -336,7 +337,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
|
|||||||
@ -100,7 +100,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -181,7 +181,7 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
|
|||||||
|
|
||||||
// Supplier Invoice Lines
|
// Supplier Invoice Lines
|
||||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, ";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
$sql.= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
@ -191,7 +191,8 @@ $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountan
|
|||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND product_type <= 2";
|
$sql.= " AND product_type <= 2";
|
||||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
||||||
|
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -393,7 +394,7 @@ if ($result) {
|
|||||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
@ -151,7 +151,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search="";
|
$search="";
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
|
|||||||
@ -101,7 +101,7 @@ else
|
|||||||
|
|
||||||
$head = member_stats_prepare_head($adh);
|
$head = member_stats_prepare_head($adh);
|
||||||
|
|
||||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
|
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
|
||||||
|
|
||||||
|
|
||||||
// Print title
|
// Print title
|
||||||
|
|||||||
@ -198,7 +198,7 @@ if ($mode)
|
|||||||
|
|
||||||
$head = member_stats_prepare_head($adh);
|
$head = member_stats_prepare_head($adh);
|
||||||
|
|
||||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
|
dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
|
||||||
|
|
||||||
|
|
||||||
// Print title
|
// Print title
|
||||||
|
|||||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -788,7 +789,7 @@ if ($rowid > 0)
|
|||||||
$sql.= " c.datef,";
|
$sql.= " c.datef,";
|
||||||
$sql.= " c.fk_bank,";
|
$sql.= " c.fk_bank,";
|
||||||
$sql.= " b.rowid as bid,";
|
$sql.= " b.rowid as bid,";
|
||||||
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.accountancy_journal, ba.number";
|
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
@ -837,7 +838,12 @@ if ($rowid > 0)
|
|||||||
$accountstatic->id=$objp->baid;
|
$accountstatic->id=$objp->baid;
|
||||||
$accountstatic->number=$objp->number;
|
$accountstatic->number=$objp->number;
|
||||||
$accountstatic->account_number=$objp->account_number;
|
$accountstatic->account_number=$objp->account_number;
|
||||||
$accountstatic->accountancy_journal=$objp->accountancy_journal;
|
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||||
|
|
||||||
|
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||||
|
|
||||||
$accountstatic->ref=$objp->ref;
|
$accountstatic->ref=$objp->ref;
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -274,7 +274,7 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
$head = subscription_prepare_head($object);
|
$head = subscription_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
|
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||||
|
|
||||||
// Confirmation to delete subscription
|
// Confirmation to delete subscription
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
|
|||||||
@ -53,7 +53,17 @@ $result = $object->fetch($rowid);
|
|||||||
|
|
||||||
$head = subscription_prepare_head($object);
|
$head = subscription_prepare_head($object);
|
||||||
|
|
||||||
dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment');
|
dol_fiche_head($head, 'info', $langs->trans("Subscription"), -1, 'payment');
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
$object->info($rowid);
|
$object->info($rowid);
|
||||||
|
|
||||||
@ -64,5 +74,7 @@ print '</td></tr></table>';
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -88,7 +88,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search="";
|
$search="";
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
|
|||||||
@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lastname="";
|
$search_lastname="";
|
||||||
$search_login="";
|
$search_login="";
|
||||||
@ -347,8 +347,9 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hotbar
|
* Buttons
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
@ -482,18 +483,8 @@ if ($rowid > 0)
|
|||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
|
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
|
||||||
@ -516,6 +507,16 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
while ($i < $num && $i < $conf->liste_limit)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
@ -645,9 +646,9 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
print $form->selectyesno("subscription",$object->subscription,1);
|
print $form->selectyesno("subscription",$object->subscription,1);
|
||||||
|
|||||||
@ -385,7 +385,7 @@ print '<tr class="oddeven">'."\n";
|
|||||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||||
print '<td align="center"> </td>'."\n";
|
print '<td align="center"> </td>'."\n";
|
||||||
print '<td align="right">'."\n";
|
print '<td align="right">'."\n";
|
||||||
$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -174,8 +174,8 @@ $message.='<br>';
|
|||||||
print $message;
|
print $message;
|
||||||
|
|
||||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
$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("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$defaulturl='';
|
$defaulturl='';
|
||||||
$defaultkey='';
|
$defaultkey='';
|
||||||
|
|||||||
@ -249,7 +249,7 @@ $tabfield[6] = "code,libelle,type,color,position";
|
|||||||
$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
|
$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
|
||||||
$tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
$tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||||
$tabfield[9] = "code,label,unicode";
|
$tabfield[9] = "code,label,unicode";
|
||||||
$tabfield[10]= "country_id,country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfield[11]= "element,source,code,libelle,position";
|
$tabfield[11]= "element,source,code,libelle,position";
|
||||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||||
$tabfield[13]= "code,libelle,type,accountancy_code";
|
$tabfield[13]= "code,libelle,type,accountancy_code";
|
||||||
@ -286,7 +286,7 @@ $tabfieldvalue[6] = "code,libelle,type,color,position";
|
|||||||
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
|
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
|
||||||
$tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
$tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||||
$tabfieldvalue[9] = "code,label,unicode";
|
$tabfieldvalue[9] = "code,label,unicode";
|
||||||
$tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldvalue[11]= "element,source,code,libelle,position";
|
$tabfieldvalue[11]= "element,source,code,libelle,position";
|
||||||
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||||
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
|
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
|
||||||
@ -323,7 +323,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position";
|
|||||||
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
|
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
|
||||||
$tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
$tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||||
$tabfieldinsert[10]= "fk_pays,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||||
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
|
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
|
||||||
@ -1752,8 +1752,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||||
{
|
{
|
||||||
|
$type = (! empty($obj->type)?$obj->type:'user'); // Check if type is different of 'user' (external module)
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print 'user<input type="hidden" name="type" value="user">';
|
print $type.'<input type="hidden" name="type" value="'.$type.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||||
|
|||||||
@ -676,6 +676,8 @@ else
|
|||||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||||
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
||||||
|
|
||||||
|
dol_fiche_head('');
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
@ -714,7 +716,7 @@ else
|
|||||||
|
|
||||||
print $formmail->get_form('addfile','removefile');
|
print $formmail->get_form('addfile','removefile');
|
||||||
|
|
||||||
print '<br>';
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_label='';
|
$search_label='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
|
|||||||
@ -100,7 +100,7 @@ elseif ($action == 'update_currency')
|
|||||||
if ($submit == $langs->trans('Modify'))
|
if ($submit == $langs->trans('Modify'))
|
||||||
{
|
{
|
||||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||||
$rate = GETPOST('rate', 'float');
|
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||||
$currency = new MultiCurrency($db);
|
$currency = new MultiCurrency($db);
|
||||||
|
|
||||||
if ($currency->fetch($fk_multicurrency) > 0)
|
if ($currency->fetch($fk_multicurrency) > 0)
|
||||||
@ -178,7 +178,7 @@ print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").'</td>';
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="right" width="400">';
|
print '<td align="right" width="400">';
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
|
|||||||
@ -55,7 +55,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error && is_array($_POST))
|
||||||
{
|
{
|
||||||
//var_dump($_POST);
|
//var_dump($_POST);
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
|
|||||||
@ -116,7 +116,7 @@ print load_fiche_titre($langs->trans("Backup"),'','title_setup');
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print $langs->trans("BackupDesc",DOL_DATA_ROOT);
|
print $langs->trans("BackupDesc",DOL_DATA_ROOT);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ print load_fiche_titre($langs->trans("Restore"),'','title_setup');
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print $langs->trans("RestoreDesc",DOL_DATA_ROOT);
|
print $langs->trans("RestoreDesc",DOL_DATA_ROOT);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $date_endyear = $tmp['year'];
|
|||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$date_start=-1;
|
$date_start=-1;
|
||||||
$date_end=-1;
|
$date_end=-1;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ if (! $user->admin)
|
|||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$choice=GETPOST('choice');
|
$choice=GETPOST('choice','aZ09');
|
||||||
|
|
||||||
|
|
||||||
// Define filelog to discard it from purge
|
// Define filelog to discard it from purge
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$transkey='';
|
$transkey='';
|
||||||
$transvalue='';
|
$transvalue='';
|
||||||
|
|||||||
@ -27,6 +27,10 @@ $langs->load("admin");
|
|||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$sortfield='file';
|
||||||
|
$sortorder='ASC';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
@ -50,15 +54,16 @@ print "<br>\n";
|
|||||||
|
|
||||||
$interfaces = new Interfaces($db);
|
$interfaces = new Interfaces($db);
|
||||||
$triggers = $interfaces->getTriggersList();
|
$triggers = $interfaces->getTriggersList();
|
||||||
|
$param = ''; $align = '';
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder">
|
print '<table class="noborder">';
|
||||||
<tr class="liste_titre">
|
print '<tr class="liste_titre">';
|
||||||
<td colspan="2">'.$langs->trans("File").'</td>
|
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||||
<td align="center">'.$langs->trans("Active").'</td>
|
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, '', $sortfield, $sortorder, '', 1)."\n";
|
||||||
<td align="center"> </td>
|
print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n";
|
||||||
</tr>
|
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||||
';
|
print '</tr>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
foreach ($triggers as $trigger)
|
foreach ($triggers as $trigger)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,8 +25,10 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -35,7 +37,6 @@ $langs->load("website");
|
|||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
|
||||||
$id=1;
|
$id=1;
|
||||||
@ -47,24 +48,21 @@ $acts[1] = "disable";
|
|||||||
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
|
||||||
$listoffset=GETPOST('listoffset');
|
|
||||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
|
||||||
$status = 1;
|
$status = 1;
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
// Load variable for pagination
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$page = GETPOST("page",'int');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$offset = $listlimit * $page ;
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('admin'));
|
$hookmanager->initHooks(array('admin'));
|
||||||
|
|
||||||
// This page is a generic page to edit dictionaries
|
|
||||||
// Put here declaration of dictionaries properties
|
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
$tabname[1] = MAIN_DB_PREFIX."website";
|
$tabname[1] = MAIN_DB_PREFIX."website";
|
||||||
@ -75,7 +73,7 @@ $tablib[1] = "Websites";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
@ -83,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[1] = "ref,description";
|
$tabfield[1] = "ref,description,virtualhost";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[1] = "ref,description";
|
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[1] = "ref,description,entity";
|
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
// Example: "" if id field is "rowid" and has autoincrement on
|
||||||
@ -105,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
|
|||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[1] = array();
|
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -116,8 +114,8 @@ $tabfieldcheck[1] = array();
|
|||||||
$elementList = array();
|
$elementList = array();
|
||||||
$sourceList=array();
|
$sourceList=array();
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify a website
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||||
{
|
{
|
||||||
$listfield=explode(',',$tabfield[$id]);
|
$listfield=explode(',',$tabfield[$id]);
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
@ -128,16 +126,29 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
|
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
|
if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value]))
|
||||||
|
{
|
||||||
|
$ok=0;
|
||||||
|
$fieldnamekey=$listfield[$f];
|
||||||
|
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (! empty($_POST['ref']))
|
||||||
|
{
|
||||||
|
$websitekey=strtolower($_POST['ref']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd','alpha'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
if ($tabrowid[$id])
|
||||||
{
|
{
|
||||||
@ -155,6 +166,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* $website=new Website($db);
|
||||||
|
$website->ref=
|
||||||
|
$website->description=
|
||||||
|
$website->virtualhost=
|
||||||
|
$website->create($user); */
|
||||||
|
|
||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
@ -173,6 +190,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($value == 'entity') {
|
if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
|
if ($value == 'ref') {
|
||||||
|
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||||
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
@ -184,8 +204,31 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
|
global $dolibarr_main_data_root;
|
||||||
|
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
||||||
|
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||||
|
$filecss=$pathofwebsite.'/styles.css.php';
|
||||||
|
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||||
|
$fileindex=$pathofwebsite.'/index.php';
|
||||||
|
|
||||||
|
// Css file
|
||||||
|
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||||
|
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
|
||||||
|
$csscontent.= '<?php '."\n";
|
||||||
|
$csscontent.= "header('Content-type: text/css');\n";
|
||||||
|
$csscontent.= "?>"."\n";
|
||||||
|
$csscontent.= '<!-- END -->'."\n";
|
||||||
|
$csscontent.= 'body { margin: 0; }'."\n";
|
||||||
|
|
||||||
|
dol_syslog("Save file css into ".$filecss);
|
||||||
|
|
||||||
|
dol_mkdir($pathofwebsite);
|
||||||
|
$result = file_put_contents($filecss, $csscontent);
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
unset($_POST); // Clean $_POST array, we keep only
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -199,11 +242,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify','alpha'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
|
$website=new Website($db);
|
||||||
|
$rowid=GETPOST('rowid','int');
|
||||||
|
$website->fetch($rowid);
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
@ -229,7 +276,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||||
|
if ($newname != $website->ref)
|
||||||
|
{
|
||||||
|
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
||||||
|
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
||||||
|
@rename($srcfile, $destfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -237,7 +294,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('actioncancel'))
|
if (GETPOST('actioncancel','alpha'))
|
||||||
{
|
{
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
@ -247,7 +304,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_pages WHERE fk_website ='".$rowid."'";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||||
@ -321,12 +378,12 @@ print "<br>\n";
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show a dictionary
|
* Show website list
|
||||||
*/
|
*/
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
@ -350,12 +407,12 @@ if ($id)
|
|||||||
$sql.=" ORDER BY ";
|
$sql.=" ORDER BY ";
|
||||||
}
|
}
|
||||||
$sql.=$tabsqlsort[$id];
|
$sql.=$tabsqlsort[$id];
|
||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
$sql.=$db->plimit($limit+1, $offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
@ -381,16 +438,18 @@ if ($id)
|
|||||||
{
|
{
|
||||||
print '<td class="'.$align.'">';
|
print '<td class="'.$align.'">';
|
||||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
elseif (! empty($tabhelp[$id][$value]))
|
||||||
|
{
|
||||||
|
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||||
|
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||||
|
}
|
||||||
else print $valuetoshow;
|
else print $valuetoshow;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -399,11 +458,11 @@ if ($id)
|
|||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
if (GETPOST('actionadd'))
|
if (GETPOST('actionadd','alpha'))
|
||||||
{
|
{
|
||||||
foreach ($fieldlist as $key=>$val)
|
foreach ($fieldlist as $key=>$val)
|
||||||
{
|
{
|
||||||
if (GETPOST($val))
|
if (GETPOST($val,'alpha'))
|
||||||
$obj->$val=GETPOST($val);
|
$obj->$val=GETPOST($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,8 +493,7 @@ if ($id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List of available values in database
|
// List of websites in database
|
||||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -445,21 +503,13 @@ if ($id)
|
|||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// There is several pages
|
|
||||||
if ($num > $listlimit)
|
|
||||||
{
|
|
||||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
@ -486,11 +536,11 @@ if ($id)
|
|||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':''),"","align=".$align,$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':''),"",'align="center"',$sortfield,$sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -539,7 +589,7 @@ if ($id)
|
|||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$isdisable=1; // true by default
|
$iserasable=1;$isdisable=1; // true by default
|
||||||
|
|
||||||
$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)?urlencode($obj->code):'').'&id='.$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)?urlencode($obj->code):'').'&';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
|
|||||||
@ -77,11 +77,11 @@ $workflowcodes=array(
|
|||||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||||
// Automatic classification
|
// Automatic classification
|
||||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -131,9 +131,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$regmod))
|
||||||
{
|
{
|
||||||
$module = strtolower($reg[1]);
|
$module = strtolower($regmod[1]);
|
||||||
$moduledirforclass = getModuleDirForApiClass($module);
|
$moduledirforclass = getModuleDirForApiClass($module);
|
||||||
$moduleforperm = $module;
|
$moduleforperm = $module;
|
||||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||||
@ -159,9 +159,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
if ($file_searched == 'api_access.class.php') continue;
|
if ($file_searched == 'api_access.class.php') continue;
|
||||||
|
|
||||||
// Support of the deprecated API.
|
// Support of the deprecated API.
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]).'Api';
|
$classname = ucwords($regapi[1]).'Api';
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
@ -173,9 +173,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]);
|
$classname = ucwords($regapi[1]);
|
||||||
$classname = str_replace('_', '', $classname);
|
$classname = str_replace('_', '', $classname);
|
||||||
require_once $dir_part.$file_searched;
|
require_once $dir_part.$file_searched;
|
||||||
if (class_exists($classname))
|
if (class_exists($classname))
|
||||||
@ -206,7 +206,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call one APIs or one definition of an API
|
// Call one APIs or one definition of an API
|
||||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
|
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
|
||||||
{
|
{
|
||||||
$module = $reg[1];
|
$module = $reg[1];
|
||||||
if ($module == 'explorer') // If we call page to explore details of a service
|
if ($module == 'explorer') // If we call page to explore details of a service
|
||||||
|
|||||||
@ -53,11 +53,13 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
// No urlencode, all param $url will be urlencoded later
|
// No urlencode, all param $url will be urlencoded later
|
||||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||||
foreach($_POST as $key => $val)
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
foreach($_POST as $key => $val)
|
||||||
|
{
|
||||||
|
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ $action=GETPOST('action','aZ09');
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
if (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
@ -82,7 +83,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup')
|
|||||||
|
|
||||||
$head=categoriesadmin_prepare_head();
|
$head=categoriesadmin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'setup', $langs->trans("Categories"), 0, 'category');
|
dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
|||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
$elementtype='categories'; //Must be the $element of the class that manage extrafield
|
$elementtype='categorie'; //Must be the $element of the class that manage extrafield
|
||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup')
|
|||||||
|
|
||||||
$head = categoriesadmin_prepare_head();
|
$head = categoriesadmin_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category');
|
dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), -1, 'category');
|
||||||
|
|
||||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@ -43,22 +43,23 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
class Categorie extends CommonObject
|
class Categorie extends CommonObject
|
||||||
{
|
{
|
||||||
// Categories types
|
// Categories types
|
||||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
const TYPE_PRODUCT = 'product';
|
||||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
const TYPE_SUPPLIER = 'supplier';
|
||||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
const TYPE_CUSTOMER = 'customer';
|
||||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
const TYPE_MEMBER = 'member';
|
||||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
const TYPE_CONTACT = 'contact';
|
||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 'user';
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_PROJECT = 'project';
|
||||||
const TYPE_PROJECT = 6;
|
const TYPE_ACCOUNT = 'bank_account';
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
|
|
||||||
public $picto = 'category';
|
public $picto = 'category';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array ID mapping from type string
|
* @var array ID mapping from type string
|
||||||
*
|
*
|
||||||
* @note This array should be remove in future, once previous constants are moved to the string value.
|
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
||||||
*/
|
*/
|
||||||
private $MAP_ID = array(
|
private $MAP_ID = array(
|
||||||
'product' => 0,
|
'product' => 0,
|
||||||
@ -66,10 +67,21 @@ class Categorie extends CommonObject
|
|||||||
'customer' => 2,
|
'customer' => 2,
|
||||||
'member' => 3,
|
'member' => 3,
|
||||||
'contact' => 4,
|
'contact' => 4,
|
||||||
'user' => 4,
|
|
||||||
'account' => 5,
|
'account' => 5,
|
||||||
'project' => 6,
|
'project' => 6,
|
||||||
|
'user' => 7,
|
||||||
);
|
);
|
||||||
|
public static $MAP_ID_TO_CODE = array(
|
||||||
|
0 => 'product',
|
||||||
|
1 => 'supplier',
|
||||||
|
2 => 'customer',
|
||||||
|
3 => 'member',
|
||||||
|
4 => 'contact',
|
||||||
|
5 => 'account',
|
||||||
|
6 => 'project',
|
||||||
|
7 => 'user',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Foreign keys mapping from type string
|
* @var array Foreign keys mapping from type string
|
||||||
*
|
*
|
||||||
@ -81,9 +93,9 @@ class Categorie extends CommonObject
|
|||||||
'supplier' => 'soc',
|
'supplier' => 'soc',
|
||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Category tables mapping from type string
|
* @var array Category tables mapping from type string
|
||||||
@ -96,9 +108,9 @@ class Categorie extends CommonObject
|
|||||||
'supplier' => 'fournisseur',
|
'supplier' => 'fournisseur',
|
||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'contact',
|
'contact' => 'contact',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object class mapping from type string
|
* @var array Object class mapping from type string
|
||||||
@ -112,8 +124,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'Adherent',
|
'member' => 'Adherent',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'user' => 'User',
|
'user' => 'User',
|
||||||
'account' => 'Account',
|
'account' => 'Account',
|
||||||
'project' => 'Project',
|
'project' => 'Project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* @var array Object table mapping from type string
|
* @var array Object table mapping from type string
|
||||||
@ -127,12 +139,12 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'adherent',
|
'member' => 'adherent',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'bank_account',
|
'account' => 'bank_account',
|
||||||
'project' => 'projet',
|
'project' => 'projet',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $element='category';
|
public $element='category';
|
||||||
public $table_element='categories';
|
public $table_element='categorie';
|
||||||
|
|
||||||
public $fk_parent;
|
public $fk_parent;
|
||||||
public $label;
|
public $label;
|
||||||
@ -447,9 +459,10 @@ class Categorie extends CommonObject
|
|||||||
* Delete a category from database
|
* Delete a category from database
|
||||||
*
|
*
|
||||||
* @param User $user Object user that ask to delete
|
* @param User $user Object user that ask to delete
|
||||||
* @return int <0 KO >0 OK
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
* @return int <0 KO >0 OK
|
||||||
*/
|
*/
|
||||||
function delete($user)
|
function delete($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -462,6 +475,14 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
/* FIX #1317 : Check for child category and move up 1 level*/
|
/* FIX #1317 : Check for child category and move up 1 level*/
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -580,25 +601,16 @@ class Categorie extends CommonObject
|
|||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
// Removed extrafields
|
||||||
|
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
|
{
|
||||||
|
$result=$this->deleteExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
// Removed extrafields
|
$error++;
|
||||||
if (! $error)
|
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
|
||||||
{
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
|
||||||
{
|
|
||||||
$result=$this->deleteExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
|
||||||
if ($result < 0) { $error++; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,11 +1186,11 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -39,6 +39,8 @@ $id=GETPOST('id','int');
|
|||||||
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
||||||
$catname=GETPOST('catname','alpha');
|
$catname=GETPOST('catname','alpha');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -53,8 +55,8 @@ elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCat
|
|||||||
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
||||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||||
|
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||||
|
|
||||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||||
|
|||||||
@ -42,6 +42,8 @@ $type=GETPOST('type');
|
|||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
if ($id == "")
|
if ($id == "")
|
||||||
{
|
{
|
||||||
dol_print_error('','Missing parameter id');
|
dol_print_error('','Missing parameter id');
|
||||||
@ -100,7 +102,8 @@ if ($object->id)
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||||
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|
||||||
|
|||||||
@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
$langs->load("languages");
|
$langs->load("languages");
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action=GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$type=GETPOST('type');
|
$type = GETPOST('type','aZ09');
|
||||||
|
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||||
@ -153,6 +155,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
|
|||||||
@ -34,15 +34,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
|
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref=GETPOST('ref');
|
$label= GETPOST('label','alpha');
|
||||||
$type=GETPOST('type');
|
$type = GETPOST('type','az09');
|
||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$removeelem = GETPOST('removeelem','int');
|
$removeelem = GETPOST('removeelem','int');
|
||||||
$elemid=GETPOST('elemid');
|
$elemid = GETPOST('elemid','alpha');
|
||||||
|
|
||||||
if ($id == "")
|
if ($id == "" && $label == "")
|
||||||
{
|
{
|
||||||
dol_print_error('','Missing parameter id');
|
dol_print_error('','Missing parameter id');
|
||||||
exit();
|
exit();
|
||||||
@ -52,7 +52,7 @@ if ($id == "")
|
|||||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||||
|
|
||||||
$object = new Categorie($db);
|
$object = new Categorie($db);
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id, $label);
|
||||||
$object->fetch_optionals($id,$extralabels);
|
$object->fetch_optionals($id,$extralabels);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
@ -61,6 +61,7 @@ if ($result <= 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$type=$object->type;
|
$type=$object->type;
|
||||||
|
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
@ -187,6 +188,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
|||||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
|
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("ProjectsCategoriesShort");
|
||||||
else $title=$langs->trans("Category");
|
else $title=$langs->trans("Category");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
@ -195,7 +197,7 @@ $head = categories_prepare_head($object,$type);
|
|||||||
dol_fiche_head($head, 'card', $title, -1, 'category');
|
dol_fiche_head($head, 'card', $title, -1, 'category');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
$object->next_prev_filter=" type = ".$object->type;
|
||||||
$object->ref = $object->label;
|
$object->ref = $object->label;
|
||||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||||
@ -205,7 +207,7 @@ foreach ($ways as $way)
|
|||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -955,8 +955,15 @@ if ($id > 0)
|
|||||||
// Type of event
|
// Type of event
|
||||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
{
|
{
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
||||||
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto");
|
if ($object->type_code != 'AC_OTH_AUTO')
|
||||||
|
{
|
||||||
|
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'.$langs->trans("Action".$object->type_code);
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1279,7 +1279,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filters['logint']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
$sql.= " WHERE a.fk_action=c.id";
|
$sql.= " WHERE a.fk_action=c.id";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
foreach ($filters as $key => $value)
|
foreach ($filters as $key => $value)
|
||||||
@ -1291,20 +1291,34 @@ class ActionComm extends CommonObject
|
|||||||
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
||||||
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
if ($key == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
if ($key == 'logina')
|
if ($key == 'logina')
|
||||||
{
|
{
|
||||||
$logina=$value;
|
$logina=$value;
|
||||||
|
$condition='=';
|
||||||
|
if (preg_match('/^!/',$logina))
|
||||||
|
{
|
||||||
|
$logina=preg_replace('/^!/','',$logina);
|
||||||
|
$condition='<>';
|
||||||
|
}
|
||||||
$userforfilter=new User($this->db);
|
$userforfilter=new User($this->db);
|
||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$logina);
|
||||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
if ($result > 0) $sql.= " AND a.fk_user_author ".$condition." ".$userforfilter->id;
|
||||||
|
elseif ($result < 0 || $condition == '=') $sql.= " AND a.fk_user_author = 0";
|
||||||
}
|
}
|
||||||
if ($key == 'logint' || $key == 'login')
|
if ($key == 'logint')
|
||||||
{
|
{
|
||||||
$logint=$value;
|
$logint=$value;
|
||||||
|
$condition='=';
|
||||||
|
if (preg_match('/^!/',$logint))
|
||||||
|
{
|
||||||
|
$logint=preg_replace('/^!/','',$logint);
|
||||||
|
$condition='<>';
|
||||||
|
}
|
||||||
$userforfilter=new User($this->db);
|
$userforfilter=new User($this->db);
|
||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$logint);
|
||||||
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
if ($result > 0) $sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||||
|
elseif ($result < 0 || $condition == '=') $sql.= " AND ar.fk_element = 0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||||
|
|||||||
@ -129,10 +129,13 @@ $hookmanager->initHooks(array('agenda'));
|
|||||||
if (GETPOST("viewlist") || $action == 'show_list')
|
if (GETPOST("viewlist") || $action == 'show_list')
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
foreach($_POST as $key => $val)
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
if ($key=='token') continue;
|
foreach($_POST as $key => $val)
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
{
|
||||||
|
if ($key=='token') continue;
|
||||||
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
|
||||||
@ -142,10 +145,13 @@ if (GETPOST("viewlist") || $action == 'show_list')
|
|||||||
if (GETPOST("viewperuser") || $action == 'show_peruser')
|
if (GETPOST("viewperuser") || $action == 'show_peruser')
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
foreach($_POST as $key => $val)
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
if ($key=='token') continue;
|
foreach($_POST as $key => $val)
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
{
|
||||||
|
if ($key=='token') continue;
|
||||||
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
||||||
@ -537,8 +543,10 @@ $resql=$db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$MAXONSAMEPAGE=10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num && $i < $MAXONSAMEPAGE)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
|||||||
@ -59,9 +59,9 @@ else
|
|||||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||||
$search_title=GETPOST('search_title','alpha');
|
$search_title=GETPOST('search_title','alpha');
|
||||||
|
|
||||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||||
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear'));
|
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
|
||||||
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear'));
|
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
|
||||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
|
||||||
@ -120,10 +120,13 @@ $hookmanager->initHooks(array('agendalist'));
|
|||||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
foreach($_POST as $key => $val)
|
if (is_array($_POST))
|
||||||
{
|
{
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
foreach($_POST as $key => $val)
|
||||||
}
|
{
|
||||||
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
|
}
|
||||||
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
||||||
exit;
|
exit;
|
||||||
@ -134,7 +137,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$actioncode='';
|
$actioncode='';
|
||||||
$search_title='';
|
$search_title='';
|
||||||
@ -168,7 +171,7 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
if ($status != '' && $status > -1) $param.="&status=".$status;
|
||||||
if ($filter) $param.="&filter=".$filter;
|
if ($filter) $param.="&filter=".$filter;
|
||||||
if ($filtert) $param.="&filtert=".$filtert;
|
if ($filtert) $param.="&filtert=".$filtert;
|
||||||
if ($socid) $param.="&socid=".$socid;
|
if ($socid) $param.="&socid=".$socid;
|
||||||
@ -177,6 +180,13 @@ if ($pid) $param.="&projectid=".$pid;
|
|||||||
if ($type) $param.="&type=".$type;
|
if ($type) $param.="&type=".$type;
|
||||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
if ($search_title != '') $param.='&search_title='.$search_title;
|
||||||
|
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
|
||||||
|
if (GETPOST('datestartmonth','int')) $param.='&datestartmonth='.GETPOST('datestartmonth','int');
|
||||||
|
if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestartyear','int');
|
||||||
|
if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int');
|
||||||
|
if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int');
|
||||||
|
if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int');
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
if ($usergroup > 0) $sql.=" DISTINCT";
|
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||||
@ -340,11 +350,13 @@ if ($resql)
|
|||||||
|
|
||||||
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
||||||
{
|
{
|
||||||
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
$tmpforcreatebutton=dol_getdate(dol_now(), true);
|
||||||
|
|
||||||
|
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
|
||||||
|
|
||||||
//$param='month='.$monthshown.'&year='.$year;
|
//$param='month='.$monthshown.'&year='.$year;
|
||||||
$hourminsec='100000';
|
$hourminsec='100000';
|
||||||
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||||
$link.= $langs->trans("NewAction");
|
$link.= $langs->trans("NewAction");
|
||||||
$link.= '</a>';
|
$link.= '</a>';
|
||||||
}
|
}
|
||||||
@ -520,7 +532,7 @@ if ($resql)
|
|||||||
|
|
||||||
// Status/Percent
|
// Status/Percent
|
||||||
$datep=$db->jdate($obj->datep);
|
$datep=$db->jdate($obj->datep);
|
||||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,1,$datep).'</td>';
|
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';
|
||||||
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -534,81 +534,86 @@ if ($id > 0)
|
|||||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
|
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
|
||||||
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
||||||
|
|
||||||
if ($conf->propal->enabled)
|
if (! empty($conf->propal->enabled))
|
||||||
{
|
{
|
||||||
// Box proposals
|
// Box proposals
|
||||||
$tmp = $object->getOutstandingProposals();
|
$tmp = $object->getOutstandingProposals();
|
||||||
$outstandingOpened=$tmp['opened'];
|
$outstandingOpened=$tmp['opened'];
|
||||||
$outstandingTotal=$tmp['total_ht'];
|
$outstandingTotal=$tmp['total_ht'];
|
||||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||||
$text=$langs->trans("OverAllProposals");
|
$text=$langs->trans("OverAllProposals");
|
||||||
$link='';
|
$link='';
|
||||||
$icon='bill';
|
$icon='bill';
|
||||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
$boxstat.='<div class="boxstats">';
|
$boxstat.='<div class="boxstats">';
|
||||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||||
$boxstat.='</div>';
|
$boxstat.='</div>';
|
||||||
if ($link) $boxstat.='</a>';
|
if ($link) $boxstat.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->commande->enabled)
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
// Box proposals
|
// Box proposals
|
||||||
$tmp = $object->getOutstandingOrders();
|
$tmp = $object->getOutstandingOrders();
|
||||||
$outstandingOpened=$tmp['opened'];
|
$outstandingOpened=$tmp['opened'];
|
||||||
$outstandingTotal=$tmp['total_ht'];
|
$outstandingTotal=$tmp['total_ht'];
|
||||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||||
$text=$langs->trans("OverAllOrders");
|
$text=$langs->trans("OverAllOrders");
|
||||||
$link='';
|
$link='';
|
||||||
$icon='bill';
|
$icon='bill';
|
||||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
$boxstat.='<div class="boxstats">';
|
$boxstat.='<div class="boxstats">';
|
||||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||||
$boxstat.='</div>';
|
$boxstat.='</div>';
|
||||||
if ($link) $boxstat.='</a>';
|
if ($link) $boxstat.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->facture->enabled)
|
if (! empty($conf->facture->enabled))
|
||||||
{
|
{
|
||||||
$tmp = $object->getOutstandingBills();
|
$tmp = $object->getOutstandingBills();
|
||||||
$outstandingOpened=$tmp['opened'];
|
$outstandingOpened=$tmp['opened'];
|
||||||
$outstandingTotal=$tmp['total_ht'];
|
$outstandingTotal=$tmp['total_ht'];
|
||||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||||
|
$text=$langs->trans("OverAllInvoices");
|
||||||
|
$link='';
|
||||||
|
$icon='bill';
|
||||||
|
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
|
$boxstat.='<div class="boxstats">';
|
||||||
|
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||||
|
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||||
|
$boxstat.='</div>';
|
||||||
|
if ($link) $boxstat.='</a>';
|
||||||
|
|
||||||
$text=$langs->trans("OverAllInvoices");
|
// Box outstanding bill
|
||||||
$link='';
|
$warn = '';
|
||||||
$icon='bill';
|
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened)
|
||||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
{
|
||||||
$boxstat.='<div class="boxstats">';
|
$warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
|
||||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
}
|
||||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
$text=$langs->trans("CurrentOutstandingBill");
|
||||||
$boxstat.='</div>';
|
$link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
|
||||||
if ($link) $boxstat.='</a>';
|
$icon='bill';
|
||||||
|
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||||
|
$boxstat.='<div class="boxstats">';
|
||||||
|
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||||
|
$boxstat.='<span class="boxstatsindicator'.($outstandingOpened>0?' amountremaintopay':'').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||||
|
$boxstat.='</div>';
|
||||||
|
if ($link) $boxstat.='</a>';
|
||||||
|
}
|
||||||
|
|
||||||
// Box outstanding bill
|
$parameters = array();
|
||||||
$warn = '';
|
$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);
|
||||||
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened)
|
if(empty($reshook)){
|
||||||
{
|
$boxstat.= $hookmanager->resPrint;
|
||||||
$warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
|
|
||||||
}
|
|
||||||
$text=$langs->trans("CurrentOutstandingBill");
|
|
||||||
$link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
|
|
||||||
$icon='bill';
|
|
||||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
|
||||||
$boxstat.='<div class="boxstats">';
|
|
||||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
|
||||||
$boxstat.='<span class="boxstatsindicator'.($outstandingOpened>0?' amountremaintopay':'').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
|
||||||
$boxstat.='</div>';
|
|
||||||
if ($link) $boxstat.='</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$boxstat.='</td></tr>';
|
$boxstat.='</td></tr>';
|
||||||
$boxstat.='</table>';
|
$boxstat.='</table>';
|
||||||
$boxstat.='</div>';
|
$boxstat.='</div>';
|
||||||
|
|
||||||
print $boxstat;
|
print $boxstat;
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
* \brief Page to define emailing targets
|
* \brief Page to define emailing targets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
||||||
@ -66,7 +68,7 @@ $search_email = GETPOST("search_email");
|
|||||||
$template_id = GETPOST('template_id', 'int');
|
$template_id = GETPOST('template_id', 'int');
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x")) {
|
if (GETPOST('button_removefilter_x','alpha')) {
|
||||||
$search_nom = '';
|
$search_nom = '';
|
||||||
$search_prenom = '';
|
$search_prenom = '';
|
||||||
$search_email = '';
|
$search_email = '';
|
||||||
@ -404,14 +406,8 @@ if ($_POST["button_removefilter"]) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$extrajs = array (
|
|
||||||
'/includes/jquery/plugins/multiselect/js/ui.multiselect.js'
|
|
||||||
);
|
|
||||||
$extracss = array (
|
|
||||||
'/includes/jquery/plugins/multiselect/css/ui.multiselect.css',
|
|
||||||
);
|
|
||||||
|
|
||||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss);
|
llxHeader('', $langs->trans("MailAdvTargetRecipients"));
|
||||||
|
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
@ -474,7 +474,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
||||||
}
|
}
|
||||||
if (array_key_exists('cust_categ', $arrayquery)) {
|
if (array_key_exists('cust_categ', $arrayquery)) {
|
||||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid ";
|
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=t.rowid ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayquery['cust_name'])) {
|
if (!empty($arrayquery['cust_name'])) {
|
||||||
|
|||||||
@ -335,49 +335,8 @@ class FormAdvTargetEmailing extends Form
|
|||||||
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$return = '';
|
$form=new Form($this->db);
|
||||||
$return .= '<script type="text/javascript" language="javascript">
|
$return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295);
|
||||||
$(document).ready(function() {
|
|
||||||
$.extend($.ui.multiselect.locale, {
|
|
||||||
addAll:\'' . $langs->transnoentities ( "AddAll" ) . '\',
|
|
||||||
removeAll:\'' . $langs->transnoentities ( "RemoveAll" ) . '\',
|
|
||||||
itemsCount:\'' . $langs->transnoentities ( "ItemsCount" ) . '\'
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function(){
|
|
||||||
$("#' . $htmlname . '").addClass("' . $htmlname . '").attr("multiple","multiple").attr("name","' . $htmlname . '[]");
|
|
||||||
$(".multiselect").multiselect({sortable: false, searchable: false});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]" style="display: none;">';
|
|
||||||
//$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]">';
|
|
||||||
|
|
||||||
if ($showempty)
|
|
||||||
$return .= '<option value=""> </option>';
|
|
||||||
|
|
||||||
// Find if keys is in selected array value
|
|
||||||
if (is_array($selected_array) && count($selected_array)>0) {
|
|
||||||
$intersect_array = array_intersect_key($options_array, array_flip($selected_array));
|
|
||||||
} else {
|
|
||||||
$intersect_array=array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($options_array) > 0) {
|
|
||||||
foreach ($options_array as $keyoption => $valoption) {
|
|
||||||
// If key is in intersect table then it have to e selected
|
|
||||||
$selected = '';
|
|
||||||
if (count ( $intersect_array ) > 0) {
|
|
||||||
if (array_key_exists ( $keyoption, $intersect_array )) {
|
|
||||||
$selected = ' selected="selected"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$return .= '</select>';
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +407,7 @@ class FormAdvTargetEmailing extends Form
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
return $this->advMultiselectarray( $htmlname, $options_array, $selected_array );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1250,6 +1250,8 @@ $now = dol_now();
|
|||||||
// Add new proposal
|
// Add new proposal
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewProp"));
|
print load_fiche_titre($langs->trans("NewProp"));
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
|
|||||||
@ -618,9 +618,10 @@ class Propal extends CommonObject
|
|||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param double $pu_ht_devise Unit price in currency
|
* @param double $pu_ht_devise Unit price in currency
|
||||||
|
* @param int $notrigger disable line update trigger
|
||||||
* @return int 0 if OK, <0 if KO
|
* @return int 0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0)
|
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
@ -745,7 +746,7 @@ class Propal extends CommonObject
|
|||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
|
|
||||||
$result=$this->line->update();
|
$result=$this->line->update($notrigger);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
@ -909,23 +910,23 @@ class Propal extends CommonObject
|
|||||||
$sql.= $this->socid;
|
$sql.= $this->socid;
|
||||||
$sql.= ", 0";
|
$sql.= ", 0";
|
||||||
$sql.= ", ".$this->remise;
|
$sql.= ", ".$this->remise;
|
||||||
$sql.= ", ".($this->remise_percent?$this->db->escape($this->remise_percent):'null');
|
$sql.= ", ".($this->remise_percent?$this->db->escape($this->remise_percent):'NULL');
|
||||||
$sql.= ", ".($this->remise_absolue?$this->db->escape($this->remise_absolue):'null');
|
$sql.= ", ".($this->remise_absolue?$this->db->escape($this->remise_absolue):'NULL');
|
||||||
$sql.= ", 0";
|
$sql.= ", 0";
|
||||||
$sql.= ", 0";
|
$sql.= ", 0";
|
||||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ", '(PROV)'";
|
$sql.= ", '(PROV)'";
|
||||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"NULL");
|
||||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->modelpdf)."'";
|
$sql.= ", '".$this->db->escape($this->modelpdf)."'";
|
||||||
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null");
|
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"NULL");
|
||||||
$sql.= ", ".$this->cond_reglement_id;
|
$sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
|
||||||
$sql.= ", ".$this->mode_reglement_id;
|
$sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
|
||||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||||
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
||||||
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null");
|
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"NULL");
|
||||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||||
$sql.= ", ".$this->availability_id;
|
$sql.= ", ".$this->availability_id;
|
||||||
$sql.= ", ".$this->demand_reason_id;
|
$sql.= ", ".$this->demand_reason_id;
|
||||||
@ -2361,7 +2362,7 @@ class Propal extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
||||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
|
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -3501,7 +3502,7 @@ class Propal extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Class to manage commercial proposal lines
|
* Class to manage commercial proposal lines
|
||||||
*/
|
*/
|
||||||
class PropaleLigne extends CommonObjectLine
|
class PropaleLigne extends CommonObjectLine
|
||||||
{
|
{
|
||||||
public $element='propaldet';
|
public $element='propaldet';
|
||||||
public $table_element='propaldet';
|
public $table_element='propaldet';
|
||||||
|
|||||||
@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_user='';
|
$search_user='';
|
||||||
@ -355,6 +355,7 @@ if ($resql)
|
|||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
|
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
|
||||||
|
if (empty($search_societe)) $search_societe = $soc->name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2039,7 +2039,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $object->date ? dol_print_date($object->date, 'day') : ' ';
|
print $object->date ? dol_print_date($object->date, 'day') : ' ';
|
||||||
if ($object->hasDelay() && empty($object->date_livraison)) {
|
if ($object->hasDelay() && ! empty($object->date_livraison)) {
|
||||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,9 +65,8 @@ class Commande extends CommonOrder
|
|||||||
public $contactid;
|
public $contactid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of the order. Check the following constants:
|
* Status of the order
|
||||||
* @var int
|
* @var int
|
||||||
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
|
||||||
*/
|
*/
|
||||||
public $statut;
|
public $statut;
|
||||||
/**
|
/**
|
||||||
@ -1359,10 +1358,10 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
$this->line->vat_src_code=$vat_src_code;
|
$this->line->vat_src_code=$vat_src_code;
|
||||||
$this->line->tva_tx=$txtva;
|
$this->line->tva_tx=$txtva;
|
||||||
$this->line->localtax1_tx=$txlocaltax1;
|
$this->line->localtax1_tx=$localtaxes_type[1];
|
||||||
$this->line->localtax2_tx=$txlocaltax2;
|
$this->line->localtax2_tx=$localtaxes_type[3];
|
||||||
$this->line->localtax1_type = $localtaxes_type[0];
|
$this->line->localtax1_type=$localtaxes_type[0];
|
||||||
$this->line->localtax2_type = $localtaxes_type[2];
|
$this->line->localtax2_type=$localtaxes_type[2];
|
||||||
$this->line->fk_product=$fk_product;
|
$this->line->fk_product=$fk_product;
|
||||||
$this->line->product_type=$product_type;
|
$this->line->product_type=$product_type;
|
||||||
$this->line->fk_remise_except=$fk_remise_except;
|
$this->line->fk_remise_except=$fk_remise_except;
|
||||||
@ -1411,7 +1410,7 @@ class Commande extends CommonOrder
|
|||||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -2778,9 +2777,10 @@ class Commande extends CommonOrder
|
|||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param double $pu_ht_devise Amount in currency
|
* @param double $pu_ht_devise Amount in currency
|
||||||
|
* @param int $notrigger disable line update trigger
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $mysoc, $langs, $user;
|
global $conf, $mysoc, $langs, $user;
|
||||||
|
|
||||||
@ -2935,7 +2935,7 @@ class Commande extends CommonOrder
|
|||||||
$this->line->array_options=$array_options;
|
$this->line->array_options=$array_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$this->line->update($user);
|
$result=$this->line->update($user, $notrigger);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
@ -3243,7 +3243,8 @@ class Commande extends CommonOrder
|
|||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$generic_commande->statut = $obj->fk_statut;
|
$generic_commande->statut = $obj->fk_statut;
|
||||||
$generic_commande->date_livraison = $obj->delivery_date;
|
$generic_commande->date_commande = $this->db->jdate($obj->date_commande);
|
||||||
|
$generic_commande->date_livraison = $this->db->jdate($obj->delivery_date);
|
||||||
|
|
||||||
if ($generic_commande->hasDelay()) {
|
if ($generic_commande->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
@ -3370,14 +3371,14 @@ class Commande extends CommonOrder
|
|||||||
* Return clicable link of object (with eventually picto)
|
* Return clicable link of object (with eventually picto)
|
||||||
*
|
*
|
||||||
* @param int $withpicto Add picto into link
|
* @param int $withpicto Add picto into link
|
||||||
* @param int $option Where point the link (0=> main card, 1,2 => shipment)
|
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||||
* @param int $max Max length to show
|
* @param int $max Max length to show
|
||||||
* @param int $short ???
|
* @param int $short ???
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
@ -3385,7 +3386,7 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
|
if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
|
||||||
else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;
|
else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;
|
||||||
|
|
||||||
if ($option !== 'nolink')
|
if ($option !== 'nolink')
|
||||||
|
|||||||
@ -162,7 +162,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_user='';
|
$search_user='';
|
||||||
@ -191,6 +191,11 @@ if (empty($reshook))
|
|||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||||
|
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||||
|
{
|
||||||
|
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Commande';
|
$objectclass='Commande';
|
||||||
@ -371,7 +376,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd->classifyBilled($user);
|
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||||
|
|
||||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
||||||
else $TFact[$object->id] = $object;
|
else $TFact[$object->id] = $object;
|
||||||
@ -573,6 +578,7 @@ if ($resql)
|
|||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
|
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
|
||||||
|
if (empty($search_company)) $search_company = $soc->name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -754,7 +760,7 @@ if ($resql)
|
|||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||||
|
|
||||||
print '<table class="border" width="100%" >';
|
print '<table class="noborder" width="100%" >';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefieldmiddle">';
|
print '<td class="titlefieldmiddle">';
|
||||||
print $langs->trans('DateInvoice');
|
print $langs->trans('DateInvoice');
|
||||||
@ -776,7 +782,15 @@ if ($resql)
|
|||||||
print $langs->trans('ValidateInvoices');
|
print $langs->trans('ValidateInvoices');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectyesno('valdate_invoices', 1, 1);
|
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||||
|
{
|
||||||
|
print $form->selectyesno('valdate_invoices', 0, 1, 1);
|
||||||
|
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -838,7 +852,7 @@ if ($resql)
|
|||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
@ -976,6 +990,7 @@ if ($resql)
|
|||||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||||
|
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||||
);
|
);
|
||||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||||
@ -1033,7 +1048,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$total=0;
|
$total=0;
|
||||||
|
|||||||
@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||||
@ -46,17 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->loadLangs(array("banks","bills","categories","companies","margins","salaries","loan","donations","trips","members","compta","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("categories");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("margins");
|
|
||||||
$langs->load("salaries");
|
|
||||||
$langs->load("loan");
|
|
||||||
$langs->load("donations");
|
|
||||||
$langs->load("trips");
|
|
||||||
$langs->load("members");
|
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
@ -84,6 +75,7 @@ $debit=GETPOST("debit",'alpha');
|
|||||||
$credit=GETPOST("credit",'alpha');
|
$credit=GETPOST("credit",'alpha');
|
||||||
$type=GETPOST("type",'alpha');
|
$type=GETPOST("type",'alpha');
|
||||||
$account=GETPOST("account",'int');
|
$account=GETPOST("account",'int');
|
||||||
|
$accountancy_code=GETPOST('accountancy_code', 'alpha');
|
||||||
$bid=GETPOST("bid","int");
|
$bid=GETPOST("bid","int");
|
||||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||||
@ -178,7 +170,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_dt_start='';
|
$search_dt_start='';
|
||||||
$search_dt_end='';
|
$search_dt_end='';
|
||||||
@ -276,11 +268,11 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
|||||||
$amount = - price2num($_POST["adddebit"]);
|
$amount = - price2num($_POST["adddebit"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||||
$operation=$_POST["operation"];
|
$operation = GETPOST("operation",'alpha');
|
||||||
$num_chq=$_POST["num_chq"];
|
$num_chq = GETPOST("num_chq",'alpha');
|
||||||
$label=$_POST["label"];
|
$label = GETPOST("label",'alpha');
|
||||||
$cat1=$_POST["cat1"];
|
$cat1 = GETPOST("cat1",'alpha');
|
||||||
|
|
||||||
if (! $dateop) {
|
if (! $dateop) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -290,15 +282,24 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
if (! $label) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Label")), null, 'errors');
|
||||||
|
}
|
||||||
if (! $amount) {
|
if (! $amount) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
/*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}*/
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user);
|
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||||
if ($insertid > 0)
|
if ($insertid > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
@ -331,6 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
$bankaccountstatic=new Account($db);
|
$bankaccountstatic=new Account($db);
|
||||||
@ -365,6 +367,7 @@ if (!empty($debit)) $param.='&debit='.$debit;
|
|||||||
if (!empty($credit)) $param.='&credit='.$credit;
|
if (!empty($credit)) $param.='&credit='.$credit;
|
||||||
if (!empty($account)) $param.='&account='.$account;
|
if (!empty($account)) $param.='&account='.$account;
|
||||||
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
||||||
|
if ($search_conciliated != '') $param.='&search_conciliated='.urlencode($search_conciliated);
|
||||||
if (!empty($bid)) $param.='&bid='.$bid;
|
if (!empty($bid)) $param.='&bid='.$bid;
|
||||||
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||||
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||||
@ -408,19 +411,32 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buttons actions
|
* Buttons actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action != 'reconcile')
|
if ($action != 'reconcile')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||||
{
|
{
|
||||||
if ($user->rights->banque->modifier) {
|
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>';
|
{
|
||||||
} else {
|
if ($user->rights->banque->modifier) {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // If direct entries is not done using miscellaneous payments
|
||||||
|
{
|
||||||
|
if ($user->rights->banque->modifier) {
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -431,7 +447,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->canBeConciliated() > 0) {
|
if ($object->canBeConciliated() > 0) {
|
||||||
// If not cash account and can be reconciliate
|
// If not cash account and can be reconciliate
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||||
}
|
}
|
||||||
@ -637,6 +653,60 @@ if ($resql)
|
|||||||
// print '</td></tr></table>';
|
// print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Form to add a transaction with no invoice
|
||||||
|
if ($user->rights->banque->modifier && $action == 'addline')
|
||||||
|
{
|
||||||
|
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Numero").'</td>';
|
||||||
|
print '<td colspan="2">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td align=right>'.$langs->trans("Debit").'</td>';
|
||||||
|
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||||
|
/*if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $langs->trans("AccountAccounting");
|
||||||
|
print '</td>';
|
||||||
|
}*/
|
||||||
|
print '<td colspan="2" align="center"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr '.$bcnd[false].'>';
|
||||||
|
print '<td class="nowrap" colspan="2">';
|
||||||
|
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||||
|
print '</td><td>';
|
||||||
|
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||||
|
if ($options) {
|
||||||
|
print '<br>'.$langs->trans("Rubrique").': ';
|
||||||
|
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
|
||||||
|
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
|
||||||
|
/*if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||||
|
print '</td>';
|
||||||
|
}*/
|
||||||
|
print '<td colspan="2" align="center">';
|
||||||
|
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
|
||||||
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
/// ajax to adjust value date with plus and less picto
|
/// ajax to adjust value date with plus and less picto
|
||||||
print '
|
print '
|
||||||
|
|||||||
@ -394,9 +394,10 @@ class Account extends CommonObject
|
|||||||
* @param User $user User that create
|
* @param User $user User that create
|
||||||
* @param string $emetteur Name of cheque writer
|
* @param string $emetteur Name of cheque writer
|
||||||
* @param string $banque Bank of cheque writer
|
* @param string $banque Bank of cheque writer
|
||||||
|
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||||
* @return int Rowid of added entry, <0 if KO
|
* @return int Rowid of added entry, <0 if KO
|
||||||
*/
|
*/
|
||||||
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='')
|
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='')
|
||||||
{
|
{
|
||||||
// Deprecatîon warning
|
// Deprecatîon warning
|
||||||
if (is_numeric($oper)) {
|
if (is_numeric($oper)) {
|
||||||
@ -456,6 +457,7 @@ class Account extends CommonObject
|
|||||||
$accline->fk_user_author = $user->id;
|
$accline->fk_user_author = $user->id;
|
||||||
$accline->fk_account = $this->rowid;
|
$accline->fk_account = $this->rowid;
|
||||||
$accline->fk_type = $oper;
|
$accline->fk_type = $oper;
|
||||||
|
$accline->numero_compte = $accountancycode;
|
||||||
|
|
||||||
if ($num_chq) {
|
if ($num_chq) {
|
||||||
$accline->num_chq = $num_chq;
|
$accline->num_chq = $num_chq;
|
||||||
@ -1683,8 +1685,9 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", num_chq";
|
$sql .= ", num_chq";
|
||||||
$sql .= ", fk_account";
|
$sql .= ", fk_account";
|
||||||
$sql .= ", fk_type";
|
$sql .= ", fk_type";
|
||||||
$sql .= ",emetteur,banque";
|
$sql .= ", emetteur,banque";
|
||||||
$sql .= ", rappro";
|
$sql .= ", rappro";
|
||||||
|
$sql .= ", numero_compte";
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->idate($this->datec)."'";
|
$sql .= "'".$this->db->idate($this->datec)."'";
|
||||||
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
||||||
@ -1698,6 +1701,7 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
||||||
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
||||||
$sql .= ", ".(int) $this->rappro;
|
$sql .= ", ".(int) $this->rappro;
|
||||||
|
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||||
|
|||||||
@ -236,7 +236,7 @@ class BankAccounts extends DolibarrApi
|
|||||||
function _validate($data)
|
function _validate($data)
|
||||||
{
|
{
|
||||||
$account = array();
|
$account = array();
|
||||||
foreach (Accounts::$FIELDS as $field) {
|
foreach (BankAccounts::$FIELDS as $field) {
|
||||||
if (! isset($data[$field]))
|
if (! isset($data[$field]))
|
||||||
throw new RestException(400, "$field field missing");
|
throw new RestException(400, "$field field missing");
|
||||||
$account[$field] = $data[$field];
|
$account[$field] = $data[$field];
|
||||||
|
|||||||
@ -325,14 +325,14 @@ class PaymentVarious extends CommonObject
|
|||||||
$sql.= " VALUES (";
|
$sql.= " VALUES (";
|
||||||
$sql.= "'".$this->db->idate($this->datep)."'";
|
$sql.= "'".$this->db->idate($this->datep)."'";
|
||||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||||
$sql.= ", '".$this->sens."'";
|
$sql.= ", '".$this->db->escape($this->sens)."'";
|
||||||
$sql.= ", ".$this->amount;
|
$sql.= ", ".$this->amount;
|
||||||
$sql.= ", '".$this->type_payment."'";
|
$sql.= ", '".$this->db->escape($this->type_payment)."'";
|
||||||
$sql.= ", '".$this->num_payment."'";
|
$sql.= ", '".$this->db->escape($this->num_payment)."'";
|
||||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql.= ", '".$this->accountancy_code."'";
|
$sql.= ", '".$this->db->escape($this->accountancy_code)."'";
|
||||||
$sql.= ", '".$user->id."'";
|
$sql.= ", ".$user->id;
|
||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ", NULL";
|
$sql.= ", NULL";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
@ -342,7 +342,6 @@ class PaymentVarious extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
||||||
|
|
||||||
if ($this->id > 0)
|
if ($this->id > 0)
|
||||||
|
|||||||
@ -121,7 +121,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$statut = 'all';
|
$statut = 'all';
|
||||||
$search_ref='';
|
$search_ref='';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user