Merge remote-tracking branch 'upstream/develop' into fr_4763
This commit is contained in:
commit
5778ba0bd8
@ -266,7 +266,7 @@ script:
|
||||
- |
|
||||
echo "Upgrading Dolibarr"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
set +e
|
||||
cd htdocs/install
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
|
||||
php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log
|
||||
@ -289,9 +289,9 @@ script:
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors. Set this to +e if you want to go to this end to see log file.
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
#phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
set +e
|
||||
|
||||
- |
|
||||
|
||||
@ -14,7 +14,7 @@ Component Version License GPL Compatible
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
|
||||
CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
CKEditor 4.5.8 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
|
||||
|
||||
131
ChangeLog
131
ChangeLog
@ -24,7 +24,12 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
|
||||
|
||||
Following changes may create regression for some external modules, but were necessary to make
|
||||
Dolibarr better:
|
||||
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
|
||||
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
|
||||
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
|
||||
So if you included it into your module, change your code like this to be compatible with all version:
|
||||
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
|
||||
@ -187,6 +192,109 @@ This is list of hooks modified:
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.8.4 compared to 3.8.3 *****
|
||||
FIX: #3694
|
||||
FIX: #3798 #2519 Cron jobs would never be executed
|
||||
FIX: #4155 Search Categories error
|
||||
FIX: #4239
|
||||
FIX: #4272 Error when trying to print the page "Linked objects" of a Thirdparty
|
||||
FIX: #4291 Correctly filter bank card GETPOSTs
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: #4341
|
||||
FIX: #4394 Untranslated label in list of expense reports
|
||||
FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property
|
||||
FIX: #4418
|
||||
FIX: #4425 Missing "VAT" translation in supplier order popup
|
||||
FIX: #4434 Weird behaviour when enabling multiprices
|
||||
FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays
|
||||
FIX: #4453 SEPA Direct Debit generated XML shows a trailing comma in RmtInf field
|
||||
FIX: #4528
|
||||
FIX: #4556 desiredstock and seuil_stock_alerte cleared on modify product card
|
||||
FIX: #4580
|
||||
FIX: #4583 Incorrect call of Categories::containing throws a DoliDB error
|
||||
FIX: #4649 Wrong parameters order
|
||||
FIX: #4768
|
||||
FIX: #4785
|
||||
FIX: Add a test to show bugged module with a bad declaration of dictionaries to avoid to see clean module to be breaked.
|
||||
FIX: add Croatia into list of country in EEC
|
||||
FIX: add missing global def for ttc column
|
||||
FIX: ajax error with multicompany module
|
||||
FIX: Avoid errors when batch stock is negative
|
||||
FIX: bad field in select
|
||||
FIX: bad path
|
||||
FIX: bad transaction level due to code of situation invoices
|
||||
FIX: best sql request
|
||||
FIX: bookmark's user change after update if the user hasn't superadmin right
|
||||
FIX: call trigger LINEBILL_SUPPLIER_CREATE
|
||||
FIX: Can not disabled an opened service line in a contract
|
||||
FIX: can't clone event
|
||||
FIX: can't send mail to thirdparty contact if no mail defined on thirdparty card
|
||||
FIX: Check stock of batch on shippment
|
||||
FIX: code corrupting database
|
||||
FIX: compatibility with multicompany transversal mode
|
||||
FIX: compatibility with multicompany transversal mode and more security issue
|
||||
FIX: Contrat card don't consider user permissions to show active/unactive service button
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: Deadlock situation. Can't edit anymore contract. FIX: List of automatic events was not visible.
|
||||
FIX: disable main.inc.php hooks
|
||||
FIX: do not show warning if account defined
|
||||
FIX: don't see the sales representative of anothers entities
|
||||
FIX: duration format
|
||||
FIX: Correct problem of rights beetween tax and salaries module
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
FIX: $fileparams is not defined
|
||||
FIX: filter by socid if from customer card
|
||||
FIX: for avoid conflict with "global $m" in memory.lib.php
|
||||
FIX: for avoid division by 0
|
||||
FIX: hover css
|
||||
FIX: If option to hide automatic ECM is on, dont show menu.
|
||||
FIX: if we dont use SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE the hour is displayed on pdf
|
||||
FIX: Introduce hidden option to disable feature than hangs when too much data
|
||||
FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant
|
||||
FIX: issue when bank module is disabled FIX: missing entity filter for lines of payment
|
||||
FIX: list of leave request was not showing label correctly.
|
||||
FIX: MAIN_THIRDPARTY_CREATION_INDIVIDUAL syntax error in name
|
||||
FIX: markRate can be 100
|
||||
FIX: minor css error (pixel size must have "px"). Compatibility with old behaviour.
|
||||
FIX: missing field "label"
|
||||
FIX: missing signature and uniformize code between card and script
|
||||
FIX: missing traduction
|
||||
FIX: missing translation
|
||||
FIX: missing translation key
|
||||
FIX: nblignes not calculated after hook and hook can't modify this value. Usefull for modules
|
||||
FIX: no database structure change is allowed into minor versions
|
||||
FIX: no transaction in this place
|
||||
FIX: Noway to validate a leave request for some uer even if they have permission for.
|
||||
FIX: Option to disable meteo was not set correctly in edit mode
|
||||
FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9)
|
||||
FIX: path to copyrighted files
|
||||
FIX: php unit to work both with old and new setup
|
||||
FIX: Purge of temp files was broken
|
||||
FIX: Relative discount decimals are not saved
|
||||
FIX: Removed a bugged list. Fixed another one to not count data of previous year.
|
||||
FIX: retrieve correct pu_ttc (set by printObjectLine function) like in 3.7
|
||||
FIX: search product in customer product prices doesn't work
|
||||
FIX: Some filters are lost when paging
|
||||
FIX: sql injection #4341
|
||||
FIX: sql injection even when code is on several lines
|
||||
FIX: sql request and total for time spen for current month
|
||||
FIX: Sql syntax error in doc_generic_task_odt
|
||||
FIX: Status filter don't work
|
||||
FIX: Strict Standards: Only variables should be passed by reference
|
||||
FIX: The part added with hidden option MAIN_DOC_USE_TIMING was included with a . instead of -. This make os think it is part of extension instead of file name.
|
||||
FIX: The third dashboard don't consider user permissions
|
||||
FIX: the view my task must show only task you are assigned to
|
||||
FIX: to allow phpunit of migration process for 3.4 to 3.5
|
||||
FIX: to allow phpunit of migration process for 3.5 to 3.6
|
||||
FIX: userlocaltax
|
||||
FIX: view of product image when using old path
|
||||
FIX: size of image uploaded on user.
|
||||
FIX: We must ue the "small" size of imge to show on card pages.
|
||||
FIX: When we make a direct assignement on a task to a user, we must check he is also assigned to project (and if not assign it)
|
||||
FIX: wrong fk_parent_line in credit note with invoiceAvoirWithLines option
|
||||
FIX: wrong modelpdf var name
|
||||
FIX: wrong object name
|
||||
|
||||
***** ChangeLog for 3.8.3 compared to 3.8.2 *****
|
||||
FIX: #3805
|
||||
FIX: #3231 [Members] Public subscription page displays GeoIP error
|
||||
@ -609,6 +717,23 @@ Dolibarr better:
|
||||
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
|
||||
|
||||
|
||||
***** ChangeLog for 3.7.4 compared to 3.7.3 *****
|
||||
FIX: #3694
|
||||
FIX: #4239
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: #4341
|
||||
FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property
|
||||
FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays
|
||||
FIX: add missing global def for ttc column
|
||||
FIX: Contrat card don't consider user permissions to show active/unactive service button
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
Fix: for avoid division by 0
|
||||
FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant
|
||||
FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9)
|
||||
FIX: sql injection even when code is on several lines
|
||||
FIX: The third dashboard don't consider user permissions
|
||||
|
||||
***** ChangeLog for 3.7.3 compared to 3.7.2 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #3890 Expected transactions bank account page, shows negative numbers
|
||||
@ -1758,7 +1883,7 @@ backport commit 384e3812eb73a15adafb472cacfb93397a54459b to fix W3C/edit contrac
|
||||
- Fix: [ bug #810 ] Cannot update ODT template path
|
||||
- Fix: [ bug #816 ] Sales journal does not reflect localtaxes
|
||||
- Fix: [ bug #817 ] Purchases journal does not reflect localtaxes
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionnary
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionary
|
||||
- Fix: [ bug #828 ] Error when code_region is not a number in llx_c_regions (with postgres)
|
||||
- Fix: [ bug #855 ] Holiday approval email in French
|
||||
- Fix: [ bug #856 ] (Holidays module) Mail error if destination user doesn't have an email
|
||||
@ -1777,7 +1902,7 @@ backport commit 384e3812eb73a15adafb472cacfb93397a54459b to fix W3C/edit contrac
|
||||
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
|
||||
- Fix: Localtax2 for Spain must be based into buyer
|
||||
- Fix: [ bug #762 ] Bad profit calculation in Reporting
|
||||
- Fix: bug dictionnary with wrong prefix table
|
||||
- Fix: bug dictionary with wrong prefix table
|
||||
|
||||
***** ChangeLog for 3.3 compared to 3.2.* *****
|
||||
For users:
|
||||
@ -1865,7 +1990,7 @@ New experimental module:
|
||||
For developers:
|
||||
- New: Add webservice for thirdparty creation and list.
|
||||
- New: A module can overwrite templates parts.
|
||||
- New: Can add a link on title field of added dictionnary.
|
||||
- New: Can add a link on title field of added dictionary.
|
||||
- New: Uniformize code.
|
||||
- New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and
|
||||
WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER.
|
||||
|
||||
@ -6,7 +6,7 @@ Dolibarr ERP & CRM is a modern software to manage your organization's activity (
|
||||
|
||||
It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances.
|
||||
|
||||
You can freely use, study, modify or distribute it according to it's Free Software licence.
|
||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||
|
||||
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
|
||||
|
||||
|
||||
@ -1108,6 +1108,14 @@ if ($nboftargetok) {
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
|
||||
);
|
||||
%filestoscanstableasso=(
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
|
||||
);
|
||||
|
||||
use POSIX qw/strftime/;
|
||||
foreach my $file (sort keys %filestoscansf)
|
||||
{
|
||||
@ -1150,17 +1158,22 @@ if ($nboftargetok) {
|
||||
|
||||
if ($target eq 'SF') {
|
||||
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
||||
print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."/".$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
||||
}
|
||||
else
|
||||
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
|
||||
$destFolder="$NEWPUBLISH/$filestoscanstableasso{$file}";
|
||||
}
|
||||
elsif ($target eq 'ASSO' and $NEWPUBLISH !~ /stable/) {
|
||||
$destFolder="$NEWPUBLISH";
|
||||
}
|
||||
else # No more used
|
||||
{
|
||||
$dirnameonly=$file;
|
||||
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
|
||||
$filenameonly=$file;
|
||||
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
|
||||
$destFolder="$NEWPUBLISH/$dirnameonly";
|
||||
print "Publish file ".$file." to $NEWPUBLISH/".$dirnameonly."\n";
|
||||
}
|
||||
print "Publish file ".$file." to ".$destFolder."\n";
|
||||
|
||||
# mkdir
|
||||
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");
|
||||
|
||||
1141
composer.lock
generated
1141
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,11 @@ with:
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
* Removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
@ -62,12 +67,6 @@ In htdocs/includes/tcpdf/tcpdf.php
|
||||
* Renamed getmypid into dol_getmypid().
|
||||
|
||||
|
||||
To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
|
||||
|
||||
TCPDI:
|
||||
------
|
||||
|
||||
@ -17,16 +17,16 @@ fi
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix $fic
|
||||
dos2unix "$fic"
|
||||
done;
|
||||
fi
|
||||
|
||||
@ -171,6 +171,8 @@ then
|
||||
fi
|
||||
#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
|
||||
#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
||||
#echo "drop old table"
|
||||
echo "drop table llx_accounting_account;" | mysql -P$port -u$admin $passwd $base
|
||||
echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
|
||||
mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
||||
export res=$?
|
||||
|
||||
8217
dev/initdemo/mysqldump_dolibarr_3.9.0.sql
Normal file
8217
dev/initdemo/mysqldump_dolibarr_3.9.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -174,6 +174,10 @@ export list="
|
||||
--ignore-table=$base.llx_advanced_extrafields
|
||||
--ignore-table=$base.llx_advanced_extrafields_options
|
||||
--ignore-table=$base.llx_advanced_extrafields_values
|
||||
--ignore-table=$base.llx_askpricesupplier
|
||||
--ignore-table=$base.llx_askpricesupplier_extrafields
|
||||
--ignore-table=$base.llx_askpricesupplierdet
|
||||
--ignore-table=$base.llx_askpricesupplierdet_extrafields
|
||||
--ignore-table=$base.llx_bookkeeping
|
||||
--ignore-table=$base.llx_bootstrap
|
||||
--ignore-table=$base.llx_bt_namemap
|
||||
@ -196,6 +200,11 @@ export list="
|
||||
--ignore-table=$base.llx_cabinetmed_motifcons
|
||||
--ignore-table=$base.llx_cabinetmed_patient
|
||||
--ignore-table=$base.llx_cabinetmed_societe
|
||||
--ignore-table=$base.llx_congespayes
|
||||
--ignore-table=$base.llx_congespayes_config
|
||||
--ignore-table=$base.llx_congespayes_events
|
||||
--ignore-table=$base.llx_congespayes_logs
|
||||
--ignore-table=$base.llx_congespayes_users
|
||||
--ignore-table=$base.llx_dolicloud_customers
|
||||
--ignore-table=$base.llx_dolicloud_stats
|
||||
--ignore-table=$base.llx_dolicloud_emailstemplates
|
||||
@ -205,6 +214,7 @@ export list="
|
||||
--ignore-table=$base.llx_filemanager_roots
|
||||
--ignore-table=$base.llx_fournisseur_ca
|
||||
--ignore-table=$base.llx_google_maps
|
||||
--ignore-table=$base.llx_milestone
|
||||
--ignore-table=$base.llx_monitoring_probes
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
|
||||
@ -50,25 +50,26 @@ class modMyModule extends DolibarrModules
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'mymodule';
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "other";
|
||||
// Module position in the family
|
||||
$this->module_position = 500;
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
|
||||
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Description of module MyModule";
|
||||
$this->descriptionlong = "A very lon description. Can be a full HTML content";
|
||||
$this->editor_name = 'Editor name';
|
||||
$this->editor_url = 'http://www.dolibarr.org';
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '1.0';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 0;
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
|
||||
@ -43,7 +43,9 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
include_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/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
dol_include_once('/mymodule/class/skeleton_class.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
@ -58,6 +60,7 @@ $myparam = GETPOST('myparam','alpha');
|
||||
|
||||
$search_field1=GETPOST("search_field1");
|
||||
$search_field2=GETPOST("search_field2");
|
||||
$search_myfield=GETPOST('search_myfield');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -123,6 +126,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -141,6 +147,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete')
|
||||
{
|
||||
@ -216,7 +235,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -265,6 +284,7 @@ if ($resql)
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
@ -274,6 +294,11 @@ if ($resql)
|
||||
print $langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escpae_htmltag($search_myfield).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -291,8 +316,8 @@ if ($resql)
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -309,8 +334,8 @@ if ($resql)
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>'."\n";
|
||||
@ -322,10 +347,25 @@ if ($resql)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
@ -358,7 +398,9 @@ if ($resql)
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
$i=0;
|
||||
$var=true;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -366,8 +408,16 @@ if ($resql)
|
||||
{
|
||||
// You can use here results
|
||||
print '<tr>';
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print '<td>'.$obj->field1.'</td>';
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print '<td>'.$obj->field2.'</td>';
|
||||
if (! empty($arrayfields['t.field1']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->field1.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['t.field2']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->field2.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -382,6 +432,7 @@ if ($resql)
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,6 +446,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
@ -402,6 +454,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
/*
|
||||
@ -410,9 +463,12 @@ if ($resql)
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
||||
}*/
|
||||
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -161,11 +161,11 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_accountparent" value="' . $search_accountparent . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="' . $search_accountparent . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
@ -190,7 +190,7 @@ if ($result) {
|
||||
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
|
||||
print '<td>' . $obj->label . '</td>';
|
||||
|
||||
if ($obj->account_parent)
|
||||
if (! empty($obj->account_parent))
|
||||
{
|
||||
$accountparent->id = $obj->rowid2;
|
||||
$accountparent->label = $obj->label2;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/card.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Card accounting account
|
||||
* \file htdocs/accountancy/admin/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card of accounting account
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -28,6 +28,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -45,7 +46,7 @@ $cancel = GETPOST('cancel');
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
$object = new AccountingAccount($db);
|
||||
|
||||
// Action
|
||||
if ($action == 'add') {
|
||||
@ -55,16 +56,25 @@ if ($action == 'add') {
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Clean code
|
||||
$account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right
|
||||
if (GETPOST('account_category') <= 0) {
|
||||
$account_parent = '';
|
||||
} else {
|
||||
$account_parent = GETPOST('account_category','int');
|
||||
}
|
||||
|
||||
$accounting->fk_pcg_version = $obj->pcg_version;
|
||||
$accounting->pcg_type = GETPOST('pcg_type');
|
||||
$accounting->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$accounting->account_number = GETPOST('account_number');
|
||||
$accounting->account_parent = GETPOST('account_parent', 'int');
|
||||
$accounting->label = GETPOST('label', 'alpha');
|
||||
$accounting->active = 1;
|
||||
$object->fk_pcg_version = $obj->pcg_version;
|
||||
$object->pcg_type = GETPOST('pcg_type');
|
||||
$object->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$object->account_number = $account_number;
|
||||
$object->account_parent = $account_parent;
|
||||
$object->account_category = GETPOST('account_category');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
$object->active = 1;
|
||||
|
||||
$res = $accounting->create($user);
|
||||
$res = $object->create($user);
|
||||
|
||||
if ($res == 0) {
|
||||
} else {
|
||||
@ -81,22 +91,31 @@ if ($action == 'add') {
|
||||
Header("Location: account.php");
|
||||
} else if ($action == 'edit') {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
$result = $accounting->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
$obj = $db->fetch_object($result2);
|
||||
|
||||
// Clean code
|
||||
$account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right
|
||||
if (GETPOST('account_category') <= 0) {
|
||||
$account_parent = '';
|
||||
} else {
|
||||
$account_parent = GETPOST('account_category','int');
|
||||
}
|
||||
|
||||
$object->fk_pcg_version = $obj->pcg_version;
|
||||
$object->pcg_type = GETPOST('pcg_type');
|
||||
$object->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$object->account_number = $account_number;
|
||||
$object->account_parent = $account_parent;
|
||||
$object->account_category = GETPOST('account_category');
|
||||
$object->label = GETPOST('label', 'alpha');
|
||||
|
||||
$accounting->fk_pcg_version = $obj->pcg_version;
|
||||
$accounting->pcg_type = GETPOST('pcg_type');
|
||||
$accounting->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$accounting->account_number = GETPOST('account_number');
|
||||
$accounting->account_parent = GETPOST('account_parent', 'int');
|
||||
$accounting->label = GETPOST('label', 'alpha');
|
||||
|
||||
$result = $accounting->update($user);
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
@ -109,10 +128,10 @@ if ($action == 'add') {
|
||||
exit();
|
||||
}
|
||||
} else if ($action == 'delete') {
|
||||
$result = $accounting->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if (! empty($accounting->id)) {
|
||||
$result = $accounting->delete($user);
|
||||
if (! empty($object->id)) {
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result > 0) {
|
||||
Header("Location: account.php");
|
||||
@ -120,7 +139,7 @@ if ($action == 'add') {
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($accounting->error, $accounting->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +150,9 @@ llxheader('', $langs->trans('AccountAccounting'));
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlacc = new FormVentilation($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
// Create mode
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans('NewAccount'));
|
||||
|
||||
@ -142,22 +163,37 @@ if ($action == 'create') {
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
|
||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
|
||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type');
|
||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of acounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
|
||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -172,20 +208,16 @@ if ($action == 'create') {
|
||||
|
||||
print '</form>';
|
||||
} else if ($id) {
|
||||
$rowid = $id;
|
||||
$account = $accounting->fetch($rowid);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($account > 0) {
|
||||
if ($result > 0) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$head = accounting_prepare_head($accounting);
|
||||
$head = accounting_prepare_head($object);
|
||||
|
||||
if ($action == 'update') {
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid) {
|
||||
$soc->fetch($object->socid);
|
||||
}
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'update')
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
@ -195,21 +227,36 @@ if ($action == 'create') {
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
|
||||
print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
|
||||
print '<td><input name="label" size="70" value="' . $object->label . '"</td></tr>';
|
||||
|
||||
// Account parent
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
|
||||
print $htmlacc->select_account($object->account_parent, 'account_parent', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type');
|
||||
print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type');
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
|
||||
print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -224,6 +271,8 @@ if ($action == 'create') {
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
|
||||
// View mode
|
||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
@ -232,29 +281,37 @@ if ($action == 'create') {
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td>' . $accounting->account_number . '</td>';
|
||||
print '<td>' . $object->account_number . '</td>';
|
||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
||||
|
||||
|
||||
// Label
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->label . '</td></tr>';
|
||||
|
||||
print '<td colspan="2">' . $object->label . '</td></tr>';
|
||||
|
||||
// Account parent
|
||||
$accp = new AccountingAccount($db);
|
||||
if (! empty($accounting->account_parent)) {
|
||||
$accp->fetch($accounting->account_parent, '');
|
||||
if (! empty($object->account_parent)) {
|
||||
$accp->fetch($object->account_parent, '');
|
||||
}
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td colspan="2">' . $accp->account_number . ' - ' . $accp->label . '</td></tr>';
|
||||
|
||||
|
||||
// Category
|
||||
print "<tr><td>".$langs->trans("AccountingCategory")."</td><td colspan='2'>".$object->account_category_label."</td>";
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->pcg_type . '</td></tr>';
|
||||
|
||||
print '<td colspan="2">' . $object->pcg_type . '</td></tr>';
|
||||
|
||||
// Chart of accounts subtype
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
|
||||
|
||||
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
||||
|
||||
// Active
|
||||
print '<tr><td>' . $langs->trans("Activated") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if (empty($accounting->active)) {
|
||||
if (empty($object->active)) {
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
} else {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
@ -267,7 +324,7 @@ if ($action == 'create') {
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
* Actions buttons
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -21,15 +21,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/export.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/export.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
@ -195,11 +196,7 @@ if (! $conf->use_javascript_ajax) {
|
||||
print "</td>";
|
||||
} else {
|
||||
print '<td>';
|
||||
$listmodelcsv = array (
|
||||
'1' => $langs->trans("Modelcsv_normal"),
|
||||
'2' => $langs->trans("Modelcsv_CEGID"),
|
||||
'3' => $langs->trans("Modelcsv_COALA")
|
||||
);
|
||||
$listmodelcsv = AccountancyExport::getType();
|
||||
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
||||
|
||||
print '</td>';
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/importaccounts.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page import accounting account
|
||||
* \file htdocs/accountancy/admin/importaccounts.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page import accounting account
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -38,6 +38,7 @@ $langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("salaries");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
@ -45,7 +46,7 @@ if (! $user->admin)
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Other parameters ACCOUNTING_*
|
||||
// Parameters ACCOUNTING_* and others
|
||||
$list = array (
|
||||
'ACCOUNTING_LIMIT_LIST_VENTILATION',
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
@ -63,8 +64,11 @@ $list_account = array (
|
||||
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_VAT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_VAT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_VAT_PAY_ACCOUNT',
|
||||
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH'
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'DONATION_ACCOUNTINGACCOUNT'
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief To define accounting account on product / service
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief To define accounting account on product / service
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -184,7 +184,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
llxHeader('', $langs->trans("InitAccountancy"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
@ -241,7 +241,7 @@ if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print_barre_liste($langs->trans("ModulesSystemTools"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/balance.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Balance of book keeping
|
||||
* \file htdocs/accountancy/bookkeeping/balance.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Balance of book keeping
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -106,81 +106,37 @@ if (! empty($search_accountancy_code_end)) {
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = 'bookkepping';
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
// Model Cegid Expert Export
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
print $date . $sep;
|
||||
print $line->code_journal . $sep;
|
||||
print length_accountg($line->numero_compte) . $sep;
|
||||
print ' ' . $sep;
|
||||
print $line->sens . $sep;
|
||||
print price($line->montant) . $sep;
|
||||
print dol_trunc($line->label_compte, 32) . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print length_accounta($line->code_tiers) . $sep;
|
||||
print . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;*/
|
||||
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
|
||||
// Std export
|
||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
print $date . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
print length_accounta($line->numero_compte) . $sep;
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print $line->label_compte . $sep;
|
||||
print price($line->montant) . $sep;
|
||||
print $line->sens . $sep;*/
|
||||
print $line->code_journal . $sep;
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
|
||||
|
||||
// Coala export
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $sep;
|
||||
print $line->code_journal . $sep;
|
||||
print length_accounta($line->numero_compte) . $sep;
|
||||
print $line->piece_num . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
print 'E' . $sep;
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
print length_accountg($line->numero_compte) . $sep;
|
||||
print $line->debit . $sep;
|
||||
print $line->credit . $sep;
|
||||
print $line->debit . $sep;
|
||||
print $line->credit - $line->debit . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
|
||||
$title_page = $langs->trans("AccountBalance") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
|
||||
/*
|
||||
* List
|
||||
*/
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||
@ -188,81 +144,86 @@ else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result);
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('DateStart') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print $langs->trans('DateEnd') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $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("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print '<td colspan="2">';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = True;
|
||||
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$link = '';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
|
||||
if(empty($description)){
|
||||
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() .'</a>';
|
||||
}
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td align="right">' . number_format($line->debit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="right">' . number_format($line->credit - $line->debit, 2, ',', ' ') . '</td>';
|
||||
print '<td align="center">' . $link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
@ -272,10 +233,10 @@ else {
|
||||
print '<td align="right">' . price($total_credit - $total_debit) . '</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
$db->close();
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Balance by month
|
||||
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Balance by month
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Numerocompte"));
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||
print_liste_field_titre($langs->trans("Code_tiers"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
@ -182,9 +182,9 @@ if (! empty($search_mvt_num)) {
|
||||
* Action
|
||||
*/
|
||||
if ($action == 'delbookkeeping') {
|
||||
|
||||
|
||||
$import_key = GETPOST('importkey', 'alpha');
|
||||
|
||||
|
||||
if (! empty($import_key)) {
|
||||
$result = $object->deleteByImportkey($import_key);
|
||||
if ($result < 0) {
|
||||
@ -194,9 +194,9 @@ if ($action == 'delbookkeeping') {
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'delbookkeepingyearconfirm') {
|
||||
|
||||
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
|
||||
|
||||
if (! empty($delyear)) {
|
||||
$result = $object->deleteByYear($delyear);
|
||||
if ($result < 0) {
|
||||
@ -206,34 +206,45 @@ if ($action == 'delbookkeeping') {
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'delmouvconfirm') {
|
||||
|
||||
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
|
||||
if (! empty($mvt_num)) {
|
||||
$result = $object->deleteMvtNum($mvt_num);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
// if (!empty($options)) {
|
||||
// Header("Location: list.php?".urldecode($options));
|
||||
// } else {
|
||||
Header("Location: list.php");
|
||||
// }
|
||||
exit();
|
||||
}
|
||||
} elseif ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = 'bookkepping';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($result < 0) {
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_array($conf->global->ACCOUNTING_EXPORT_MODELCSV, array(5,6))) // TODO remove the conditional and keep the code in the "else"
|
||||
{
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines);
|
||||
if (!empty($accountancyexport->errors)) setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
else exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO remove next 3 lines and foreach to implement the AccountancyExport method for each model
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = 'bookkepping';
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
// Model Cegid Expert Export
|
||||
@ -246,16 +257,9 @@ if ($action == 'delbookkeeping') {
|
||||
print price($line->montant) . $sep;
|
||||
print dol_trunc($line->label_compte, 32) . $sep;
|
||||
print $line->doc_ref . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print length_accounta($line->code_tiers) . $sep;
|
||||
print . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;*/
|
||||
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
|
||||
|
||||
// Std export
|
||||
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
print $date . $sep;
|
||||
@ -264,15 +268,10 @@ if ($action == 'delbookkeeping') {
|
||||
print length_accounta($line->code_tiers) . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
|
||||
/*print $line->piece_num . $sep;
|
||||
print $line->label_compte . $sep;
|
||||
print price($line->montant) . $sep;
|
||||
print $line->sens . $sep;*/
|
||||
print $line->code_journal . $sep;
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
|
||||
|
||||
|
||||
// Coala export
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $sep;
|
||||
@ -285,23 +284,48 @@ if ($action == 'delbookkeeping') {
|
||||
print 'E' . $sep;
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
print "\n";
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 4) {
|
||||
|
||||
// Bob50
|
||||
print $line->piece_num . $sep;
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $sep;
|
||||
|
||||
if (empty($line->code_tiers)) {
|
||||
print 'G' . $sep;
|
||||
print length_accounta($line->numero_compte) . $sep;
|
||||
} else {
|
||||
if (substr($line->numero_compte,0,3)=='411') {
|
||||
print 'C' . $sep;
|
||||
}
|
||||
if (substr($line->numero_compte,0,3)=='401') {
|
||||
print 'F' . $sep;
|
||||
}
|
||||
print length_accountg($line->code_tiers) . $sep;
|
||||
|
||||
}
|
||||
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
print dol_trunc($line->label_compte, 32) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
else {
|
||||
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
|
||||
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
|
||||
/*
|
||||
* List
|
||||
*/
|
||||
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
@ -309,94 +333,62 @@ else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
|
||||
|
||||
if (empty($delyear)) {
|
||||
$delyear = dol_print_date(dol_now(), '%Y');
|
||||
}
|
||||
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
|
||||
|
||||
$form_question['delyear'] = array (
|
||||
'name' => 'delyear',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('DelYear'),
|
||||
'values' => $year_array,
|
||||
'default' => $delyear
|
||||
'default' => $delyear
|
||||
);
|
||||
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
|
||||
|
||||
/*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="delbookkeeping">';
|
||||
|
||||
print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
|
||||
|
||||
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
|
||||
print '</form>';*/
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<div class="tabsAction">' . "\n";
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
// print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>';
|
||||
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*print '<div class="liste_titre">';
|
||||
print $langs->trans('DateStart') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print $langs->trans('DateEnd') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</div>';*/
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $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("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
// print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $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("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
|
||||
@ -404,61 +396,52 @@ else {
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
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_doc_date, 'doc_date', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td>';
|
||||
// print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
// print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $langs->trans('To');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
// print '<td><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>';
|
||||
print '<td>';
|
||||
// print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
// print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $langs->trans('To');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</td>';
|
||||
// print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>';
|
||||
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = True;
|
||||
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
print '<td>' . $line->doc_ref . '</td>';
|
||||
@ -467,8 +450,6 @@ else {
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
// print '<td align="right">' . price($line->montant) . '</td>';
|
||||
// print '<td align="center">' . $line->sens . '</td>';
|
||||
print '<td align="right">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
@ -476,7 +457,7 @@ else {
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6"></td>';
|
||||
print '<td align="right">';
|
||||
@ -487,10 +468,10 @@ else {
|
||||
print '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -74,7 +74,6 @@ if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
@ -184,13 +183,13 @@ print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
|
||||
print $langs->trans('to') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
||||
print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
|
||||
print '</div>';
|
||||
print '<div class="liste_titre">';
|
||||
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
|
||||
print $langs->trans('to') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||
print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
|
||||
print '</div>';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
@ -257,9 +256,10 @@ print '<td class="liste_titre" align="center">';
|
||||
print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -268,7 +268,7 @@ $var = True;
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>' . $line->piece_num . '</td>' . "\n";
|
||||
print '<td>' . $line->doc_type . '</td>' . "\n";
|
||||
|
||||
386
htdocs/accountancy/class/accountancycategory.class.php
Normal file
386
htdocs/accountancy/class/accountancycategory.class.php
Normal file
@ -0,0 +1,386 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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 htdocs/accountancy/class/accountancycategory.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage categories of an accounting account_category
|
||||
*/
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
/**
|
||||
* Class to manage categories of an accounting account
|
||||
*/
|
||||
class AccountancyCategory
|
||||
{
|
||||
private $db;
|
||||
public $error;
|
||||
public $errors = array();
|
||||
//public $element='accounting_category';
|
||||
//public $table_element='c_accounting_category';
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select all accounting accounts from an accounting category
|
||||
*
|
||||
* @param int $id Id
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function display($id)
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql.= " WHERE t.fk_accounting_category = " . $id;
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj[$i] = $this->db->fetch_object($resql);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
|
||||
return $obj;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select accountiing category of an accounting account present in chart of accounts
|
||||
*
|
||||
* @param int $id Id category
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function getCptBK($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql.= " WHERE t.numero_compte NOT IN (";
|
||||
$sql.= " SELECT t.account_number";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql.= " WHERE t.fk_accounting_category = " . $id .")";
|
||||
$sql.= " AND t.numero_compte IN (";
|
||||
$sql.= " SELECT DISTINCT aa.account_number";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql.= " AND aa.active = 1)";
|
||||
$sql.= " GROUP BY t.numero_compte";
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj[$i] = $this->db->fetch_object($resql);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
|
||||
return $obj;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add an accounting account in an accounting category
|
||||
*
|
||||
* @param int $id_cat Id category
|
||||
* @param array $cpts list of accounts array
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateAccAcc($id_cat, $cpts = array())
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql.= " AND aa.active = 1";
|
||||
$sql.= " SET fk_accounting_category=" . $id_cat;
|
||||
$sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")";
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete an accounting account from an accounting category
|
||||
*
|
||||
* @param int $cpt_id Id of accounting account
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteCptCat($cpt_id)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " SET fk_accounting_category= 0";
|
||||
$sql.= " WHERE aa.rowid= " . $cpt_id;
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to know all category from accounting account
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCatsCpts()
|
||||
{
|
||||
global $mysoc;
|
||||
$sql = "";
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
|
||||
$sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id.")";
|
||||
$sql.= " AND cat.rowid = t.fk_accounting_category";
|
||||
$sql.= " ORDER BY cat.position ASC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.account_category ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array();
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$name_cat = $obj->name_cat;
|
||||
$data[$name_cat][$i] = array(
|
||||
'id' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'position' => $obj->position,
|
||||
'account_number' => $obj->account_number,
|
||||
'name_cpt' => $obj->name_cpt,
|
||||
'sens' => $obj->sens,
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show result of an accounting account from the general ledger with a sens and a period
|
||||
*
|
||||
* @param int $cpt Id accounting account
|
||||
* @param string $month Specifig month - Can be empty
|
||||
* @param string $year Specific year
|
||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getResult($cpt, $month, $year, $sens)
|
||||
{
|
||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql.= " WHERE t.numero_compte = " . $cpt;
|
||||
$sql.= " AND YEAR(t.doc_date) = " . $year;
|
||||
|
||||
if(! empty($month)){
|
||||
$sql.= " AND MONTH(t.doc_date) = " . $month;
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$sdc = 0;
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if($sens == 1){
|
||||
$sdc = $obj->debit - $obj->credit;
|
||||
}else{
|
||||
$sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
}
|
||||
return $sdc;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to call category from a specific country
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCatsCal()
|
||||
{
|
||||
global $db,$langs,$user,$mysoc;
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 ";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array();
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$position = $obj->position;
|
||||
$data[$position] = array(
|
||||
'code' => $obj->code,
|
||||
'label' => $obj->label,
|
||||
'formula' => $obj->formula
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
286
htdocs/accountancy/class/accountancyexport.class.php
Normal file
286
htdocs/accountancy/class/accountancyexport.class.php
Normal file
@ -0,0 +1,286 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancyexport.class.php
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class AccountancyExport
|
||||
*
|
||||
* Manage the different format accountancy export
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
|
||||
class AccountancyExport
|
||||
{
|
||||
/**
|
||||
* @var Type of export
|
||||
*/
|
||||
public static $EXPORT_TYPE_NORMAL = 1;
|
||||
public static $EXPORT_TYPE_CEGID = 2;
|
||||
public static $EXPORT_TYPE_COALA = 3;
|
||||
public static $EXPORT_TYPE_BOB50 = 4;
|
||||
public static $EXPORT_TYPE_CIEL = 5;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 6;
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var string Separator
|
||||
*/
|
||||
public $separator = '';
|
||||
|
||||
/**
|
||||
* @var string End of line
|
||||
*/
|
||||
public $end_line = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB &$db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = &$db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all export type are available
|
||||
*
|
||||
* @return array of type
|
||||
*/
|
||||
public static function getType()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return array (
|
||||
self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
|
||||
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
|
||||
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
|
||||
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
|
||||
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function downloadFile()
|
||||
{
|
||||
global $conf;
|
||||
$journal = 'bookkepping';
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function who chose which export to use with the default config
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*/
|
||||
public function export(&$TData)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
|
||||
case self::$EXPORT_TYPE_NORMAL:
|
||||
$this->exportNormal($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_CEGID:
|
||||
$this->exportCegid($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_COALA:
|
||||
$this->exportCoala($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_BOB50:
|
||||
$this->exportBob50($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_CIEL:
|
||||
$this->exportCiel($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_QUADRATUS:
|
||||
$this->exportQuadratus($TData);
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($this->errors)) self::downloadFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Normal
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportNormal(&$TData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : CEGID
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCegid(&$TData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : COALA
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCoala(&$TData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : BOB50
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportBob50(&$TData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : CIEL
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCiel(&$TData)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$i=1;
|
||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||
foreach ($TData as $data)
|
||||
{
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
|
||||
|
||||
$Tab = array();
|
||||
$Tab['num_ecriture'] = str_pad($i, 5);
|
||||
$Tab['code_journal'] = str_pad($data->code_journal, 2);
|
||||
$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.$data->label_compte, 25), 25);
|
||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||
$Tab['vide'] = str_repeat(' ', 18);
|
||||
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_compte, 34), 34);
|
||||
$Tab['end'] = 'O2003';
|
||||
|
||||
$Tab['end_line'] = $this->end_line;
|
||||
|
||||
print implode($Tab);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Quadratus
|
||||
*
|
||||
* @param unknown $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportQuadratus(&$TData)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ($TData as $data)
|
||||
{
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
|
||||
|
||||
$Tab = array();
|
||||
$Tab['type_ligne'] = 'M';
|
||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||
$Tab['folio'] = '000';
|
||||
$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['filler'] = ' ';
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 20), 20);
|
||||
$Tab['sens'] = $data->sens; // C or D
|
||||
$Tab['signe_montant'] = '+';
|
||||
$Tab['montant'] = str_pad(abs($data->montant)*100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
if (!empty($data->date_echeance)) $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
else $Tab['date_echeance'] = '000000';
|
||||
$Tab['lettrage'] = str_repeat(' ', 5);
|
||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
||||
$Tab['filler2'] = str_repeat(' ', 20);
|
||||
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
||||
$Tab['devis'] = str_pad($conf->currency, 3);
|
||||
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
||||
$Tab['filler3'] = str_repeat(' ', 3);
|
||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 32), 32);
|
||||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||
$Tab['filler4'] = str_repeat(' ', 73);
|
||||
|
||||
$Tab['end_line'] = $this->end_line;
|
||||
|
||||
print implode($Tab);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown $str data
|
||||
* @param integer $size data
|
||||
*/
|
||||
public static function trunc($str, $size)
|
||||
{
|
||||
return dol_trunc($str, $size, 'right', 'UTF-8', 1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancysystem.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief File of class to manage accountancy systems
|
||||
* \file htdocs/accountancy/class/accountancysystem.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage accountancy systems
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Fichier de la classe des comptes comptable
|
||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage accounting accounts
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,6 +41,7 @@ class AccountingAccount extends CommonObject
|
||||
var $pcg_subtype;
|
||||
var $account_number;
|
||||
var $account_parent;
|
||||
var $account_category;
|
||||
var $label;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
@ -58,25 +59,29 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int $limittocurentchart 1=Do not load record if it is into another accounting system
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurentchart = 0) {
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
||||
global $conf;
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account WHERE";
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql .= ", ca.label as category_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
|
||||
$sql .= " WHERE";
|
||||
if ($rowid) {
|
||||
$sql .= " rowid = '" . $rowid . "'";
|
||||
$sql .= " a.rowid = '" . $rowid . "'";
|
||||
} elseif ($account_number) {
|
||||
$sql .= " account_number = '" . $account_number . "'";
|
||||
$sql .= " a.account_number = '" . $account_number . "'";
|
||||
}
|
||||
if (! empty($limittocurentchart)) {
|
||||
$sql .= ' AND fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
if (! empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -93,6 +98,8 @@ class AccountingAccount extends CommonObject
|
||||
$this->account_number = $obj->account_number;
|
||||
$this->account_parent = $obj->account_parent;
|
||||
$this->label = $obj->label;
|
||||
$this->account_category = $obj->fk_accounting_category;
|
||||
$this->account_category_label = $obj->category_label;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->active = $obj->active;
|
||||
@ -110,7 +117,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert line in accounting_account
|
||||
* Insert new accounting account in chart of accounts
|
||||
*
|
||||
* @param User $user Use making action
|
||||
* @param int $notrigger Disable triggers
|
||||
@ -134,6 +141,8 @@ class AccountingAccount extends CommonObject
|
||||
$this->account_parent = trim($this->account_parent);
|
||||
if (isset($this->label))
|
||||
$this->label = trim($this->label);
|
||||
if (isset($this->account_category))
|
||||
$this->account_category = trim($this->account_category);
|
||||
if (isset($this->fk_user_author))
|
||||
$this->fk_user_author = trim($this->fk_user_author);
|
||||
if (isset($this->active))
|
||||
@ -153,6 +162,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", account_number";
|
||||
$sql .= ", account_parent";
|
||||
$sql .= ", label";
|
||||
$sql .= ", fk_accounting_category";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", active";
|
||||
|
||||
@ -166,6 +176,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", " . (! isset($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
||||
$sql .= ", " . (! isset($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||
$sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||
$sql .= ", " . (! isset($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||
$sql .= ", " . $user->id;
|
||||
$sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'");
|
||||
|
||||
@ -226,6 +237,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , account_number = '" . $this->account_number . "'";
|
||||
$sql .= " , account_parent = '" . $this->account_parent . "'";
|
||||
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
|
||||
$sql .= " , fk_accounting_category = '" . $this->account_category . "'";
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = '" . $this->active . "'";
|
||||
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-*2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
/* Copyright (C) 2014-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
@ -19,21 +18,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accountancy/bookkeeping.class.php
|
||||
* \ingroup accountancy
|
||||
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
|
||||
* Put some comments here
|
||||
* \file htdocs/accountancy/class/bookkeeping.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage general ledger
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
// require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
// require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class Accountingbookkeeping
|
||||
*
|
||||
* Put here description of your class
|
||||
* Class to manage general ledger
|
||||
*/
|
||||
class BookKeeping extends CommonObject
|
||||
{
|
||||
@ -170,7 +164,7 @@ class BookKeeping extends CommonObject
|
||||
$this->piece_num = 0;
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "SELECT count(*)";
|
||||
$sql = "SELECT count(*) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||
@ -180,8 +174,8 @@ class BookKeeping extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$row = $this->db->fetch_array($resql);
|
||||
if ($row[0] == 0) {
|
||||
$row = $this->db->fetch_object($resql);
|
||||
if ($row->nb == 0) {
|
||||
|
||||
// Determine piece_num
|
||||
$sqlnum = "SELECT piece_num";
|
||||
@ -461,7 +455,7 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
*
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null) {
|
||||
@ -1064,6 +1058,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -1118,7 +1113,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
|
||||
dol_syslog(get_class($this) . "fetch_all_per_mvt sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -1147,7 +1142,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::fetch_all_per_mvt " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
@ -1206,6 +1201,48 @@ class BookKeeping extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string
|
||||
*/
|
||||
function get_compte_desc($account = null)
|
||||
{
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = '';
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
}
|
||||
|
||||
if(empty($obj->category)){
|
||||
return $obj->label;
|
||||
}else{
|
||||
return $obj->label.' ('.$obj->category.')';
|
||||
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/html.formventilation.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief File of class with all html predefined components
|
||||
* \file htdocs/accountancy/class/html.formventilation.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class with all html predefined components
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Home customer ventilation
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
@ -95,7 +95,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/lines.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page of detail of the lines of ventilation of invoices customers
|
||||
* \file htdocs/accountancy/customer/lines.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page of detail of the lines of ventilation of invoices customers
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -31,6 +31,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("bills");
|
||||
@ -48,6 +49,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
@ -68,7 +71,7 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.facnumber, l.rowid";
|
||||
$sortfield = "f.datef, f.facnumber, fd.rowid";
|
||||
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
@ -94,6 +97,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
@ -150,14 +155,27 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, 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";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$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 .= " fd.situation_percent, co.label as country, s.tva_intra";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
}
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND f.facnumber like '%" . $search_invoice . "%'";
|
||||
}
|
||||
@ -168,16 +186,22 @@ if (strlen(trim($search_label))) {
|
||||
$sql .= " AND p.label like '%" . $search_label . "%'";
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND l.description like '%" . $search_desc . "%'";
|
||||
$sql .= " AND fd.description like '%" . $search_desc . "%'";
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '%" . $search_amount . "%'";
|
||||
$sql .= " AND fd.total_ht like '%" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
$sql .= " AND (fd.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= " AND (co.label like'" . $search_country . "%')";
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
@ -201,8 +225,8 @@ if ($result) {
|
||||
$i = 0;
|
||||
|
||||
$param = "";
|
||||
if ($search_facture)
|
||||
$param .= "&search_facture=" . $search_facture;
|
||||
if ($search_invoice)
|
||||
$param .= "&search_invoice=" . $search_invoice;
|
||||
if ($search_ref)
|
||||
$param .= "&search_ref=" . $search_ref;
|
||||
if ($search_label)
|
||||
@ -211,8 +235,13 @@ if ($result) {
|
||||
$param .= "&search_desc=" . $search_desc;
|
||||
if ($search_account)
|
||||
$param .= "&search_account=" . $search_account;
|
||||
if ($filter)
|
||||
$param .= "&filter=" . $filter;
|
||||
if ($search_vat)
|
||||
$param .= "&search_vat=" . $search_vat;
|
||||
if ($search_country)
|
||||
$param .= "&search_country=" . $search_country;
|
||||
if ($search_tvaintra)
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords);
|
||||
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
|
||||
@ -228,29 +257,28 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_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("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $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("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="center"', $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("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_country" value="' . $search_country . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_tavintra" value="' . $search_tavintra . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
@ -258,7 +286,7 @@ if ($result) {
|
||||
$var = True;
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$var = ! $var;
|
||||
$codecompta = $objp->account_number . ' ' . $objp->label;
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
@ -282,13 +310,12 @@ if ($result) {
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codecompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print '<td>' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||
print '<td align="right">' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
||||
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->fdid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
|
||||
@ -106,7 +106,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
@ -135,7 +134,7 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||
$mesCodesVentilChoisis = $codeventil;
|
||||
$cpt = 0;
|
||||
|
||||
|
||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
||||
$maLigneCourante = explode("_", $maLigneCochee);
|
||||
$monId = $maLigneCourante[0];
|
||||
@ -153,7 +152,7 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
if ($db->query($sql)) {
|
||||
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
} else {
|
||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
|
||||
$cpt ++;
|
||||
|
||||
@ -52,8 +52,9 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
$langs->load("compta");
|
||||
$langs->load("bank");
|
||||
$langs->load("banks");
|
||||
$langs->load('bills');
|
||||
$langs->load('donations');
|
||||
$langs->load("accountancy");
|
||||
|
||||
$id_bank_account = GETPOST('id_account', 'int');
|
||||
@ -71,7 +72,7 @@ $now = dol_now();
|
||||
// Security check
|
||||
if ($user->societe_id > 0 && empty($id_bank_account))
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -122,7 +123,7 @@ $paymentsalstatic = new PaymentSalary($db);
|
||||
// Get code of finance journal
|
||||
$bank_code_journal = new Account($db);
|
||||
$result = $bank_code_journal->fetch($id_bank_account);
|
||||
$journal = $bank_code_journal->ref;
|
||||
$journal = $bank_code_journal->accountancy_journal;
|
||||
|
||||
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -130,11 +131,12 @@ if ($result) {
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
|
||||
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||
$account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
|
||||
$account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
|
||||
|
||||
$tabpay = array ();
|
||||
$tabbq = array ();
|
||||
@ -148,17 +150,15 @@ if ($result) {
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_client' => $obj->code_compta
|
||||
'code_client' => $obj->code_compta
|
||||
);
|
||||
|
||||
// Controls
|
||||
$compta_bank = $obj->account_number;
|
||||
if ($obj->label == '(SupplierInvoicePayment)')
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour);
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
||||
if ($obj->label == '(CustomerInvoicePayment)')
|
||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
|
||||
if ($obj->typeop == '(BankTransfert)')
|
||||
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
|
||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||
|
||||
// Variable bookkeeping
|
||||
$tabpay[$obj->rowid]["date"] = $obj->do;
|
||||
@ -226,32 +226,30 @@ if ($result) {
|
||||
$paymentdonstatic->id = $links[$key]['url_id'];
|
||||
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
|
||||
$tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'payment_vat') {
|
||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||
$paymentvatstatic->label = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
|
||||
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'payment_salary') {
|
||||
$paymentsalstatic->id = $links[$key]['url_id'];
|
||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||
$paymentsalstatic->label = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
||||
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_employee ] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
||||
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||
}
|
||||
/*else {
|
||||
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||
|
||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
@ -312,14 +310,13 @@ if ($action == 'writebookkeeping') {
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
// Third party
|
||||
@ -388,7 +385,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->code_tiers = $k;
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
} else {
|
||||
|
||||
|
||||
$bookkeeping->doc_ref = $k;
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
}
|
||||
@ -396,7 +393,7 @@ if ($action == 'writebookkeeping') {
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -414,7 +411,7 @@ if ($action == 'export_csv') {
|
||||
$companystatic = new Client($db);
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
@ -436,7 +433,7 @@ if ($action == 'export_csv') {
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -455,7 +452,7 @@ if ($action == 'export_csv') {
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@ -468,7 +465,7 @@ if ($action == 'export_csv') {
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@ -486,7 +483,12 @@ if ($action == 'export_csv') {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -499,7 +501,12 @@ if ($action == 'export_csv') {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $companystatic->name . '"' . $sep;
|
||||
// print '"' . $companystatic->name . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -510,7 +517,12 @@ if ($action == 'export_csv') {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -523,7 +535,7 @@ else {
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("FinanceJournal"));
|
||||
|
||||
|
||||
$nom = $langs->trans("FinanceJournal") . ' - ' . $bank_code_journal->getNomUrl(1);
|
||||
$builddate = time();
|
||||
$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||
@ -531,7 +543,7 @@ else {
|
||||
|
||||
$varlink = 'id_account=' . $id_bank_account;
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
||||
'action' => ''
|
||||
'action' => ''
|
||||
), '', $varlink);
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
@ -573,21 +585,32 @@ else {
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
if ($val["lib"] == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('SupplierInvoicePayment');
|
||||
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
}
|
||||
if ($val["lib"] == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('CustomerInvoicePayment');
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $langs->trans('Bank') . "</td>";
|
||||
if ($val['soclib'] == '') {
|
||||
print "<td>" . $bank_code_journal->label . " - " . $val["ref"] . "</td>";
|
||||
} else {
|
||||
print "<td>" . $bank_code_journal->label . " - " . $val['soclib'] . "</td>";
|
||||
}
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
@ -600,9 +623,9 @@ else {
|
||||
if ($k != 'type') {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $val["soclib"] . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
print "<td>" . length_accounta($k) . "</td>";
|
||||
print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
|
||||
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
|
||||
print "<td>" . $val["type_payment"] . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
@ -613,9 +636,9 @@ else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $ref . "</td>";
|
||||
print "<td>" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "</td>";
|
||||
print "<td>" . $langs->trans('ThirdParty') . "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td> </td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Index
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
llxHeader('', 'Journaux', '');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/purchasesjournal.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page with purchases journal
|
||||
* \file htdocs/accountancy/journal/purchasesjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with purchases journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -112,18 +112,18 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
// les variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$tabttc = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
// contrôles
|
||||
// contrôles
|
||||
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
@ -133,9 +133,13 @@ if ($result) {
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
}
|
||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
||||
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref ;
|
||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier ;
|
||||
|
||||
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||
$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
||||
@ -145,9 +149,9 @@ if ($result) {
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_fournisseur' => $obj->code_compta_fournisseur
|
||||
'code_fournisseur' => $obj->code_compta_fournisseur
|
||||
);
|
||||
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
@ -158,11 +162,24 @@ if ($result) {
|
||||
if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = $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->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
// get compte id and label
|
||||
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -171,7 +188,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
||||
$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
@ -179,16 +196,18 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -201,7 +220,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
@ -209,16 +228,16 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
@ -232,7 +251,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->label_compte = $langs->trans("VAT");
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier .' - '. $langs->trans("VAT");
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
@ -240,7 +259,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
@ -249,7 +268,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($error)) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
@ -265,23 +284,23 @@ $companystatic = new Fournisseur($db);
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
@ -294,7 +313,7 @@ if ($action == 'export_csv') {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
@ -309,7 +328,7 @@ if ($action == 'export_csv') {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
@ -325,12 +344,20 @@ if ($action == 'export_csv') {
|
||||
} else {
|
||||
// Model Classic Export
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -339,7 +366,8 @@ if ($action == 'export_csv') {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -351,19 +379,21 @@ if ($action == 'export_csv') {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
//print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
//print '"' . utf8_decode($companystatic->name) . '"' . $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) : '') . '"';
|
||||
}
|
||||
@ -371,11 +401,11 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
llxHeader('', $langs->trans("PurchasesJournal"));
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
$nom = $langs->trans("PurchasesJournal");
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
@ -387,16 +417,16 @@ if ($action == 'export_csv') {
|
||||
} else {
|
||||
$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);
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
||||
'action' => ''
|
||||
'action' => ''
|
||||
));
|
||||
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
@ -410,12 +440,12 @@ if ($action == 'export_csv') {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
/*
|
||||
* Show result array
|
||||
*/
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -425,31 +455,39 @@ if ($action == 'export_csv') {
|
||||
print "<td>" . $langs->trans("Account") . "</td>";
|
||||
print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$var = true;
|
||||
$r = '';
|
||||
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$invoicestatic->ref = $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
|
||||
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $accountingaccount->label . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
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 "</tr>";
|
||||
@ -461,36 +499,37 @@ if ($action == 'export_csv') {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td><td>" . $langs->trans("VAT") . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>" ;
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("VAT") . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>" . length_accounta($k);
|
||||
print "</td><td>" . $langs->trans("ThirdParty");
|
||||
print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
||||
print "</td>";
|
||||
print "<td>" . length_accounta($k)."</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("Code_tiers")."</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>";
|
||||
|
||||
|
||||
$var = ! $var;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* 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
|
||||
@ -24,9 +24,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/sellsjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
* \file htdocs/accountancy/journal/sellsjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,6 +44,7 @@ $langs->load("commercial");
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$date_startmonth = GETPOST('date_startmonth');
|
||||
@ -119,16 +120,16 @@ if ($result) {
|
||||
$tabtva = array ();
|
||||
$tabttc = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
// les variables
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
||||
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
||||
|
||||
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
@ -138,7 +139,7 @@ if ($result) {
|
||||
}
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
||||
|
||||
|
||||
// Situation invoices handling
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->rowid);
|
||||
@ -153,7 +154,7 @@ if ($result) {
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
}
|
||||
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
@ -172,9 +173,9 @@ if ($result) {
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_client' => $obj->code_compta
|
||||
'code_client' => $obj->code_compta
|
||||
);
|
||||
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
@ -190,8 +191,16 @@ if ($result) {
|
||||
if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
|
||||
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->ref = $val["ref"];
|
||||
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@ -202,21 +211,22 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||
//$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
@ -232,23 +242,23 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
@ -262,14 +272,14 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $langs->trans("VAT");
|
||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
@ -278,7 +288,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($error)) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
@ -288,23 +298,26 @@ if ($action == 'writebookkeeping') {
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
$companystatic = new Client($db);
|
||||
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
|
||||
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->ref = $val["ref"];
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
@ -312,11 +325,12 @@ if ($action == 'export_csv') {
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print utf8_decode($companystatic->name) . $sep;
|
||||
print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
|
||||
//print utf8_decode($companystatic->name) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount_static = new AccountingAccount($db);
|
||||
@ -327,12 +341,13 @@ if ($action == 'export_csv') {
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($accountingaccount_static->label, 32) . $sep;
|
||||
print utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount_static->label)) . $sep;
|
||||
//print dol_trunc($accountingaccount_static->label, 32) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TVA
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
@ -342,7 +357,8 @@ if ($action == 'export_csv') {
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $langs->trans("VAT") . $sep;
|
||||
print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . $sep;
|
||||
//print $langs->trans("VAT") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
@ -355,41 +371,47 @@ if ($action == 'export_csv') {
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. utf8_decode ( dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . '"' . $sep;
|
||||
//print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -398,11 +420,11 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
llxHeader('', $langs->trans("SellsJournal"));
|
||||
|
||||
|
||||
$nom = $langs->trans("SellsJournal");
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
@ -415,13 +437,13 @@ if ($action == 'export_csv') {
|
||||
$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);
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
||||
'action' => ''
|
||||
'action' => ''
|
||||
));
|
||||
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
@ -435,12 +457,12 @@ if ($action == 'export_csv') {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
/*
|
||||
* Show result array
|
||||
*/
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -451,20 +473,20 @@ if ($action == 'export_csv') {
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$var = true;
|
||||
$r = '';
|
||||
|
||||
|
||||
$invoicestatic = new Facture($db);
|
||||
$companystatic = new Client($db);
|
||||
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
@ -474,30 +496,32 @@ if ($action == 'export_csv') {
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
print "<td>" . length_accounta($k);
|
||||
print "</td><td>" . $langs->trans("ThirdParty");
|
||||
print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
||||
//print "</td><td>" . $langs->trans("ThirdParty");
|
||||
//print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"). "</td>";
|
||||
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $accountingaccount->label . "</td>";
|
||||
//print "<td>" . $accountingaccount->label . "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
@ -505,18 +529,19 @@ if ($action == 'export_csv') {
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $langs->trans("VAT") . "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . "</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>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$var = ! $var;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
0
htdocs/accountancy/report/index.html
Normal file
0
htdocs/accountancy/report/index.html
Normal file
240
htdocs/accountancy/report/result.php
Normal file
240
htdocs/accountancy/report/result.php
Normal file
@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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 htdocs/accountancy/report/result.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page for accounting result
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
$langs->load("compta");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
|
||||
if($cat_id == 0){
|
||||
$cat_id = null;
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->comptarapport->lire)
|
||||
accessforbidden();
|
||||
|
||||
$AccCat = new AccountancyCategory($db);
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxheader('', $langs->trans('ReportInOut'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans('ReportInOut') . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$months = array( $langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin"),
|
||||
);
|
||||
|
||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Account").'</th>';
|
||||
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
|
||||
print '<th class="liste_titre" align="center">N-1</th>';
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
|
||||
foreach($months as $k => $v){
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$cats = $AccCat->getCatsCpts();
|
||||
$catsCalcule = $AccCat->getCatsCal();
|
||||
|
||||
$j=1;
|
||||
$sommes = array();
|
||||
|
||||
if(!empty($cats))
|
||||
{
|
||||
foreach ( $cats as $name_cat => $cpts )
|
||||
{
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="17">' . $name_cat . '</td>';
|
||||
print "</tr>\n";
|
||||
$position = -1;
|
||||
$code = -1;
|
||||
foreach($cpts as $i => $cpt){
|
||||
$var = ! $var;
|
||||
|
||||
$position = $cpt['position'];
|
||||
$code = $cpt['code'];
|
||||
|
||||
$resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||
$sommes[$code]['NP'] += $resultNP;
|
||||
$sommes[$code]['N'] += $resultN;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>' . $cpt['account_number'] . '</td>';
|
||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||
print '<td>' . price($resultNP) . '</td>';
|
||||
print '<td>' . price($resultN) . '</td>';
|
||||
|
||||
foreach($months as $k => $v){
|
||||
$resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||
$sommes[$code]['M'][$k] += $resultM;
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// If it's a calculated catgory
|
||||
$p = $position + 1;
|
||||
if(array_key_exists($p, $catsCalcule)){
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Others calculed category
|
||||
foreach($catsCalcule as $p => $catc)
|
||||
{
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Home supplier ventilation
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home supplier ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -42,7 +42,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
@ -91,7 +91,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/lines.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page of detail of the lines of ventilation of invoices suppliers
|
||||
* \file htdocs/accountancy/supplier/lines.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page of detail of the lines of ventilation of invoices suppliers
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -213,8 +214,8 @@ if ($result) {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
|
||||
@ -233,7 +234,7 @@ if ($result) {
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
$codeCompta = $objp->account_number . ' ' . $objp->label;
|
||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
@ -257,7 +258,7 @@ if ($result) {
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codeCompta . '</td>';
|
||||
print '<td>' . $codeCompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
|
||||
@ -254,11 +254,11 @@ if ($result) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre">%<input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
|
||||
@ -356,13 +356,8 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
// Create thumbs
|
||||
$object->addThumbs($newfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.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
|
||||
@ -35,10 +36,14 @@ class AdherentType extends CommonObject
|
||||
public $table_element = 'adherent_type';
|
||||
public $element = 'adherent_type';
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $libelle;
|
||||
var $cotisation; // Soumis a la cotisation
|
||||
var $vote; // droit de vote
|
||||
var $mail_valid; //mail envoye lors de la validation
|
||||
var $cotisation; // Soumis a la cotisation
|
||||
var $note;
|
||||
var $vote; // droit de vote
|
||||
var $mail_valid; //mail envoye lors de la validation
|
||||
var $statut;
|
||||
|
||||
|
||||
/**
|
||||
@ -110,7 +115,7 @@ class AdherentType extends CommonObject
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = '".$this->vote."',";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -164,7 +169,7 @@ class AdherentType extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -223,7 +228,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$projets = array();
|
||||
$adherenttypes = array();
|
||||
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
@ -241,7 +246,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$projets[$obj->rowid] = $langs->trans($obj->libelle);
|
||||
$adherenttypes[$obj->rowid] = $langs->trans($obj->libelle);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -250,8 +255,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $projets;
|
||||
return $adherenttypes;
|
||||
}
|
||||
|
||||
|
||||
@ -308,7 +312,7 @@ class AdherentType extends CommonObject
|
||||
function getMailOnSubscription()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// mail_subscription not defined so never used
|
||||
if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_subscription;
|
||||
@ -327,7 +331,7 @@ class AdherentType extends CommonObject
|
||||
function getMailOnResiliate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// NOTE mail_resiliate not defined so never used
|
||||
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
|
||||
@ -76,7 +76,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$o
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -141,7 +141,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@ -200,7 +200,10 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
print '<td>'.dol_escape_htmltag($objp->libelle).'</td>';
|
||||
print '<td align="center">'.yn($objp->cotisation).'</td>';
|
||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
if ($user->rights->adherent->configurer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
else
|
||||
print '<td align="right"> </td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -46,24 +46,6 @@ $action = GETPOST('action','alpha');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
//Order display of bank account
|
||||
if ($action == 'setbankorder')
|
||||
{
|
||||
@ -89,58 +71,13 @@ $form=new Form($db);
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
$var=!$var;
|
||||
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_BANK_CHEQUERECEIPT_DRAFT_WATERMARK\">";
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("WatermarkOnDraftChequeReceipt").'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="BANK_CHEQUERECEIPT_DRAFT_WATERMARK" value="'.$conf->global->BANK_CHEQUERECEIPT_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
*/
|
||||
|
||||
|
||||
//Show bank account order
|
||||
print load_fiche_titre($langs->trans("BankOrderShow"));
|
||||
|
||||
@ -202,8 +139,6 @@ print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
287
htdocs/admin/chequereceipts.php
Normal file
287
htdocs/admin/chequereceipts.php
Normal file
@ -0,0 +1,287 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("banks");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
|
||||
|
||||
if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstchequereceipts=GETPOST('maskconstchequereceipts','alpha');
|
||||
$maskchequereceipts=GETPOST('maskchequereceipts','alpha');
|
||||
if ($maskconstchequereceipts) $res = dolibarr_set_const($db,$maskconstchequereceipts,$maskchequereceipts,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
{
|
||||
dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* view
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader("",$langs->trans("BankSetupModule"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'checkreceipts', $langs->trans("BankSetupModule"), 0, 'account');
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("ChequeReceiptsNumberingModule"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/cheque/");
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
{
|
||||
$filebis = $file;
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = preg_replace('/\.php$/','',$file);
|
||||
// For compatibility
|
||||
if (! is_file($dir.$filebis))
|
||||
{
|
||||
$filebis = $file."/".$file.".modules.php";
|
||||
$classname = "mod_chequereceipt_".$file;
|
||||
}
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
{
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
|
||||
print $module->info();
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$chequereceipts=new RemiseCheque($db);
|
||||
$chequereceipts->initAsSpecimen();
|
||||
|
||||
// Example
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$chequereceipts);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
|
||||
if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors
|
||||
{
|
||||
if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -98,12 +98,14 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Create thumbs of logo (Note that PDF use original file and not thumbs)
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@ -111,9 +113,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
@ -203,12 +205,14 @@ if ($action == 'addthumb')
|
||||
// Create thumbs of logo
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@ -218,7 +222,7 @@ if ($action == 'addthumb')
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
|
||||
@ -131,7 +131,10 @@ print '</tr>';
|
||||
// Bon de livraison activation/desactivation
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("DeliveriesOrderAbility").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("DeliveriesOrderAbility");
|
||||
print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
|
||||
print '</td>';
|
||||
print '<td align="center" width="20">';
|
||||
print '</td>';
|
||||
print '<td align="center" width="100">';
|
||||
@ -151,7 +154,5 @@ print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
@ -46,6 +46,8 @@ $langs->load("admin");
|
||||
$langs->load("companies");
|
||||
$langs->load("resource");
|
||||
$langs->load("holiday");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("hrm");
|
||||
|
||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
@ -78,7 +80,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -112,6 +114,10 @@ $tabname[27]= MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
|
||||
$tabname[29]= MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabname[30]= MAIN_DB_PREFIX."c_format_cards";
|
||||
$tabname[31]= MAIN_DB_PREFIX."accounting_system";
|
||||
$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
|
||||
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -145,6 +151,10 @@ $tablib[27]= "DictionaryProspectStatus";
|
||||
$tablib[28]= "DictionaryHolidayTypes";
|
||||
$tablib[29]= "DictionaryOpportunityStatus";
|
||||
$tablib[30]= "DictionaryFormatCards";
|
||||
$tablib[31]= "DictionaryAccountancysystem";
|
||||
$tablib[32]= "DictionaryAccountancyCategory";
|
||||
$tablib[33]= "DictionaryDepartment";
|
||||
$tablib[34]= "DictionaryFunction";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -172,12 +182,16 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
|
||||
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
|
||||
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -211,6 +225,10 @@ $tabsqlsort[27]="code ASC";
|
||||
$tabsqlsort[28]="country ASC, code ASC";
|
||||
$tabsqlsort[29]="position ASC";
|
||||
$tabsqlsort[30]="code ASC";
|
||||
$tabsqlsort[31]="pcg_version ASC";
|
||||
$tabsqlsort[32]="code ASC, label ASC";
|
||||
$tabsqlsort[33]="code ASC";
|
||||
$tabsqlsort[34]="code ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -238,12 +256,16 @@ $tabfield[21]= "code,label";
|
||||
$tabfield[22]= "code,label";
|
||||
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[24]= "code,label";
|
||||
$tabfield[25]= "label,type_template,position,topic,content";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country";
|
||||
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
||||
$tabfield[29]= "code,label,percent,position";
|
||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfield[31]= "pcg_version,country_id,country,label";
|
||||
$tabfield[32]= "code,label,range,position,country_id,country";
|
||||
$tabfield[33]= "code,label";
|
||||
$tabfield[34]= "code,label";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -271,12 +293,16 @@ $tabfieldvalue[21]= "code,label";
|
||||
$tabfieldvalue[22]= "code,label";
|
||||
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[24]= "code,label";
|
||||
$tabfieldvalue[25]= "label,type_template,position,topic,content";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
||||
$tabfieldvalue[29]= "code,label,percent,position";
|
||||
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldvalue[31]= "pcg_version,country,label";
|
||||
$tabfieldvalue[32]= "code,label,range_account,position,country";
|
||||
$tabfieldvalue[33]= "code,label";
|
||||
$tabfieldvalue[34]= "code,label";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -304,12 +330,16 @@ $tabfieldinsert[21]= "code,label";
|
||||
$tabfieldinsert[22]= "code,label";
|
||||
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[24]= "code,label";
|
||||
$tabfieldinsert[25]= "label,type_template,position,topic,content";
|
||||
$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity";
|
||||
$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27]= "code,libelle";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
||||
$tabfieldinsert[29]= "code,label,percent,position";
|
||||
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
|
||||
$tabfieldinsert[32]= "code,label,range_account,position,fk_country";
|
||||
$tabfieldinsert[33]= "code,label";
|
||||
$tabfieldinsert[34]= "code,label";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -345,6 +375,10 @@ $tabrowid[27]= "id";
|
||||
$tabrowid[28]= "";
|
||||
$tabrowid[29]= "";
|
||||
$tabrowid[30]= "";
|
||||
$tabrowid[31]= "";
|
||||
$tabrowid[32]= "";
|
||||
$tabrowid[33]= "rowid";
|
||||
$tabrowid[34]= "rowid";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -378,6 +412,10 @@ $tabcond[27]= ! empty($conf->societe->enabled);
|
||||
$tabcond[28]= ! empty($conf->holiday->enabled);
|
||||
$tabcond[29]= ! empty($conf->projet->enabled);
|
||||
$tabcond[30]= ! empty($conf->label->enabled);
|
||||
$tabcond[31]= ! empty($conf->accounting->enabled);
|
||||
$tabcond[32]= ! empty($conf->accounting->enabled);
|
||||
$tabcond[33]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -408,9 +446,13 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
|
||||
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -444,6 +486,10 @@ $tabfieldcheck[27] = array();
|
||||
$tabfieldcheck[28] = array();
|
||||
$tabfieldcheck[29] = array();
|
||||
$tabfieldcheck[30] = array();
|
||||
$tabfieldcheck[31] = array();
|
||||
$tabfieldcheck[32] = array();
|
||||
$tabfieldcheck[33] = array();
|
||||
$tabfieldcheck[34] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
||||
@ -534,7 +580,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
@ -598,7 +644,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@ -952,6 +998,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1119,6 +1166,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -1341,8 +1389,10 @@ if ($id)
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1359,7 +1409,7 @@ if ($id)
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
||||
|
||||
|
||||
$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.'&';
|
||||
|
||||
// Favorite
|
||||
@ -1642,13 +1692,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
$size=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='centpercent';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,11 +262,11 @@ if ($action == 'setforcedate')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_FAC_AUTO_FILLJS')
|
||||
if ($action == 'set_INVOICE_AUTO_FILLJS')
|
||||
{
|
||||
$freetext = GETPOST('FAC_AUTO_FILLJS'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "FAC_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
@ -754,11 +754,11 @@ print '</form>';
|
||||
$var=! $var;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_AUTO_FILLJS" />';
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("JSOnPaimentBill");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
|
||||
print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
|
||||
*
|
||||
* 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
|
||||
@ -71,6 +72,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"),'chaine',0,'',$conf->entity);
|
||||
// Content parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine',0,'',$conf->entity);
|
||||
@ -274,6 +276,8 @@ if ($action == 'edit')
|
||||
jQuery(".drag").hide();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true);
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val(0);
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").prop("disabled", true);
|
||||
';
|
||||
if ($linuxlike)
|
||||
{
|
||||
@ -300,6 +304,8 @@ if ($action == 'edit')
|
||||
jQuery(".drag").show();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
|
||||
@ -312,6 +318,14 @@ if ($action == 'edit')
|
||||
jQuery("#MAIN_MAIL_SENDMODE").change(function() {
|
||||
initfields();
|
||||
});
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
|
||||
if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val() == 1)
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val(0);
|
||||
});
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").change(function() {
|
||||
if (jQuery("#MAIN_MAIL_EMAIL_TLS").val() == 1)
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
@ -475,6 +489,20 @@ if ($action == 'edit')
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS',(! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS)?$conf->global->MAIN_MAIL_EMAIL_STARTTLS:0),1);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
||||
@ -579,6 +607,20 @@ else
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS);
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||
}
|
||||
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '</td></tr>';
|
||||
|
||||
// Separator
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>';
|
||||
|
||||
@ -50,25 +50,11 @@ else if ($action == 'disable_hidemenu')
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'activate_layoutmenu')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT", '1','chaine',0,'',$conf->entity);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else if ($action == 'disable_layoutmenu')
|
||||
{
|
||||
dolibarr_del_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT",$conf->entity);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("Setup"));
|
||||
|
||||
print load_fiche_titre($langs->trans("Menus"),'','title_setup');
|
||||
@ -119,25 +105,6 @@ else
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Use a flip-hide menu
|
||||
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="3">'.$langs->trans("MenuUseLayout").'</td>';
|
||||
print '<td align="center">';
|
||||
if (empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_layoutmenu">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_layoutmenu">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,10 @@ $mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):(isset($_SESSION['mode']
|
||||
$action=GETPOST('action','alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
$page_y=GETPOST('page_y','int');
|
||||
$search_keyword=GETPOST('search_keyword','alpha');
|
||||
$search_status=GETPOST('search_status','alpha');
|
||||
$search_nature=GETPOST('search_nature','alpha');
|
||||
$search_version=GETPOST('search_version','alpha');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
@ -59,6 +63,12 @@ $familyinfo=array(
|
||||
'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
|
||||
);
|
||||
|
||||
$param='';
|
||||
if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
|
||||
if ($search_status) $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
|
||||
if ($search_version) $param.='&search_version='.urlencode($search_version);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -69,7 +79,7 @@ if ($action == 'set' && $user->admin)
|
||||
{
|
||||
$result=activateModule($value);
|
||||
if ($result) setEventMessages($result, null, 'errors');
|
||||
header("Location: modules.php?mode=".$mode.($page_y?'&page_y='.$page_y:''));
|
||||
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -77,10 +87,19 @@ if ($action == 'reset' && $user->admin)
|
||||
{
|
||||
$result=unActivateModule($value);
|
||||
if ($result) setEventMessages($result, null, 'errors');
|
||||
header("Location: modules.php?mode=".$mode.($page_y?'&page_y='.$page_y:''));
|
||||
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||
exit;
|
||||
}
|
||||
|
||||
if (GETPOST('buttonreset'))
|
||||
{
|
||||
$search_keyword='';
|
||||
$search_status='';
|
||||
$search_nature='';
|
||||
$search_version='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -93,6 +112,7 @@ $_SESSION["mode"]=$mode;
|
||||
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('',$langs->trans("Setup"),$help_url);
|
||||
|
||||
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
|
||||
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
@ -154,11 +174,30 @@ foreach ($modulesdir as $dir)
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
|
||||
// We discard modules according to property disabled
|
||||
if (! empty($objMod->hidden)) $modulequalified=false;
|
||||
|
||||
// We discard modules according to property disabled
|
||||
if (! empty($objMod->hidden)) $modulequalified=0;
|
||||
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
$publisher=dol_escape_htmltag($objMod->getPublisher());
|
||||
$external=($objMod->isCoreOrExternalModule() == 'external');
|
||||
if ($external)
|
||||
{
|
||||
if ($publisher)
|
||||
{
|
||||
$arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
|
||||
}
|
||||
}
|
||||
ksort($arrayofnatures);
|
||||
}
|
||||
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
if ($modulequalified)
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
$modules[$i] = $objMod;
|
||||
$filename[$i]= $modName;
|
||||
@ -183,6 +222,7 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
|
||||
$dirmod[$i] = $dir;
|
||||
//print $i.'-'.$dirmod[$i].'<br>';
|
||||
// Set categ[$i]
|
||||
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
|
||||
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
|
||||
@ -231,57 +271,22 @@ print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
|
||||
// Start to show page
|
||||
if (empty($mode)) $mode='common';
|
||||
if ($mode==='common') print $langs->trans("ModulesDesc")."<br>\n";
|
||||
//if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."<br>\n";
|
||||
//if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."<br>\n";
|
||||
//if ($mode==='functional') print $langs->trans("ModulesJobDesc")."<br>\n";
|
||||
if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
|
||||
if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>\n";
|
||||
|
||||
|
||||
//print '<br>'."\n";
|
||||
|
||||
|
||||
$h = 0;
|
||||
|
||||
$categidx='common'; // Main
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
//if (! empty($categ[$categidx]))
|
||||
//{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
}
|
||||
//}
|
||||
|
||||
/*
|
||||
$categidx='other'; // Other
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("ModulesOther");
|
||||
$head[$h][2] = 'other';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$categidx='interfaces'; // Interfaces
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("ModulesInterfaces");
|
||||
$head[$h][2] = 'interfaces';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$categidx='functional'; // Not used
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("ModulesSpecial");
|
||||
$head[$h][2] = 'functional';
|
||||
$h++;
|
||||
}
|
||||
*/
|
||||
|
||||
$categidx='expdev';
|
||||
/*$categidx='expdev';
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$categidx='expdev';
|
||||
@ -289,7 +294,7 @@ if (! empty($categ[$categidx]))
|
||||
$head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3);
|
||||
$head[$h][2] = 'expdev';
|
||||
$h++;
|
||||
}
|
||||
}*/
|
||||
|
||||
$categidx='marketplace';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
@ -307,20 +312,56 @@ $var=true;
|
||||
|
||||
if ($mode != 'marketplace')
|
||||
{
|
||||
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
|
||||
|
||||
/*
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print " <td colspan=\"2\">".$langs->trans("Module")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print " <td align=\"center\">".$langs->trans("Version")."</td>\n";
|
||||
print ' <td align="center">'.$langs->trans("Status").'</td>'."\n";
|
||||
print ' <td align="right">'.$langs->trans("SetupShort").'</td>'."\n";
|
||||
print "</tr>\n";
|
||||
*/
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated");
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental");
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development");
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
}
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.='<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
//print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
//print '</div>';
|
||||
}
|
||||
|
||||
print '<br><br><br>';
|
||||
|
||||
|
||||
// Show list of modules
|
||||
|
||||
print '<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">'."\n";
|
||||
|
||||
$oldfamily='';
|
||||
|
||||
foreach ($orders as $key => $value)
|
||||
@ -330,7 +371,8 @@ if ($mode != 'marketplace')
|
||||
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$key];
|
||||
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
$special = $objMod->special;
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
|
||||
@ -343,8 +385,50 @@ if ($mode != 'marketplace')
|
||||
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
// Check filters
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
$moduledesclong=$objMod->getDescLong();
|
||||
$moduleauthor=$objMod->getPublisher();
|
||||
|
||||
// We discard showing according to filters
|
||||
if ($search_keyword)
|
||||
{
|
||||
$qualified=0;
|
||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
||||
) $qualified=1;
|
||||
if (! $qualified) continue;
|
||||
}
|
||||
if ($search_status)
|
||||
{
|
||||
if ($search_status == 'active' && empty($conf->global->$const_name)) continue;
|
||||
if ($search_status == 'disabled' && ! empty($conf->global->$const_name)) continue;
|
||||
}
|
||||
if ($search_nature)
|
||||
{
|
||||
if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue;
|
||||
if (preg_match('/^external_(.*)$/',$search_nature, $reg))
|
||||
{
|
||||
//print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
|
||||
$publisher=dol_escape_htmltag($objMod->getPublisher());
|
||||
if ($reg[1] && $reg[1] != $publisher) continue;
|
||||
if (! $reg[1] && ! empty($publisher)) continue;
|
||||
}
|
||||
if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
|
||||
}
|
||||
if ($search_version)
|
||||
{
|
||||
if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue;
|
||||
if ($objMod->version != 'development' && ($search_version == 'development')) continue;
|
||||
if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue;
|
||||
if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue;
|
||||
}
|
||||
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||
@ -361,7 +445,7 @@ if ($mode != 'marketplace')
|
||||
if ($familykey!=$oldfamily)
|
||||
{
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td colspan="5">';
|
||||
print '<td colspan="6">';
|
||||
$familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
|
||||
print $familytext;
|
||||
print "</td>\n";
|
||||
@ -409,18 +493,171 @@ if ($mode != 'marketplace')
|
||||
print nl2br($objMod->getDesc());
|
||||
print "</td>\n";
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
$version=$objMod->getVersion();
|
||||
$dirofmodule=$dirmod[$key];
|
||||
// Help
|
||||
print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
|
||||
$text='';
|
||||
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'.$objMod->getDescLong().'<br>';
|
||||
else $text.=$objMod->getDesc().'<br>';
|
||||
|
||||
$textexternal='';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
$text=$langs->trans("ExternalModule",$dirofmodule);
|
||||
if (! empty($objMod->editor_name) && $objMod->editor_name != 'dolibarr') $text.=' - '.$objMod->editor_name;
|
||||
if (! empty($objMod->editor_web) && $objMod->editor_web != 'www.dolibarr.org') $text.=' - '.$objMod->editor_web;
|
||||
print $form->textwithpicto($version, $text, 1, 'help');
|
||||
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
|
||||
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
|
||||
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
|
||||
$text.=$textexternal;
|
||||
$text.='<br>';
|
||||
}
|
||||
else print $version;
|
||||
else
|
||||
{
|
||||
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
|
||||
}
|
||||
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->tabs as $val)
|
||||
{
|
||||
$tmp=explode(':',$val,3);
|
||||
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->dictionaries['tablib'] as $val)
|
||||
{
|
||||
$text.=($i?', ':'').$val;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->boxes as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->cronjobs as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val['label']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->module_parts['hooks'] as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
|
||||
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->rights as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu)
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->export_label as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->import_label as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
|
||||
// Picto warning
|
||||
$version=$objMod->getVersion(0);
|
||||
$versiontrans=$objMod->getVersion(1);
|
||||
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"');
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"');
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"');
|
||||
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
print $versiontrans;
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
@ -440,7 +677,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . '">';
|
||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . $param . '">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -451,25 +688,25 @@ if ($mode != 'marketplace')
|
||||
{
|
||||
if (is_array($objMod->config_page_url))
|
||||
{
|
||||
print ' <td align="right" valign="top">';
|
||||
print '<td class="tdsetuppicto" align="right" valign="top">';
|
||||
$i=0;
|
||||
foreach ($objMod->config_page_url as $page)
|
||||
{
|
||||
$urlpage=$page;
|
||||
if ($i++)
|
||||
{
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a> ';
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>';
|
||||
// print '<a href="'.$page.'">'.ucfirst($page).'</a> ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
|
||||
{
|
||||
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a> ';
|
||||
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a> ';
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,16 +714,16 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
|
||||
{
|
||||
print '<td align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td> </td>";
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
||||
}
|
||||
|
||||
}
|
||||
@ -504,12 +741,12 @@ if ($mode != 'marketplace')
|
||||
else
|
||||
{
|
||||
// Module non actif
|
||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . '">';
|
||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . $param . '">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print "</a>\n";
|
||||
}
|
||||
print "</td>\n";
|
||||
print "<td> </td>";
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
@ -529,7 +766,7 @@ else
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
$url='http://www.dolistore.com';
|
||||
$url='https://www.dolistore.com';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
@ -537,7 +774,7 @@ else
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
$url='http://partners.dolibarr.org';
|
||||
$url='https://partners.dolibarr.org';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
|
||||
|
||||
// Translations
|
||||
$langs->load("multicurrency");
|
||||
|
||||
@ -41,10 +42,11 @@ if (! $user->admin) {
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
@ -64,7 +66,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, 0) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -117,6 +119,21 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'synchronize')
|
||||
{
|
||||
$response = GETPOST('response');
|
||||
$response = json_decode($response);
|
||||
|
||||
if ($response->success)
|
||||
{
|
||||
MultiCurrency::syncRates($response);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('multicurrency_syncronize_error', $reponse->error->info), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$TCurrency = array();
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity;
|
||||
@ -136,7 +153,7 @@ if ($resql)
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "MultiCurrency";
|
||||
$page_name = "MultiCurrencySetup";
|
||||
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
@ -212,42 +229,72 @@ print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_MODIFY_RATE_APPLICATION">';
|
||||
print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY'));
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appId").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_CURRENCY_APP_ID">';
|
||||
print '<input type="text" name="CURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_currencyFromToRate").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_FROM_TO_RATE">';
|
||||
print '<input type="text" name="MULTICURRENCY_FROM_TO_RATE" value="'.$conf->global->MULTICURRENCY_FROM_TO_RATE.'" size="10" placeholder="USD-EUR-1" /> '; // CURRENCY_BASE - CURRENCY_ENTITY - ID_ENTITY
|
||||
print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY'), $conf->global->MULTICURRENCY_MODIFY_RATE_APPLICATION);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br />';
|
||||
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("CurrencyLayerAccount").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="100">';
|
||||
print '<form id="form_sync" action="" method="POST">';
|
||||
print '<input type="hidden" name="action" value="synchronize" />';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print $langs->trans("Value").' <input type="button" id="bt_sync" class="button" onclick="javascript:getRates();" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_ID">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
/* This property seems not used in code, so i comment it
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_SOURCE" value="'.$conf->global->MULTICURRENCY_APP_SOURCE.'" size="10" placeholder="USD" /> '; // Default: USD
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_ALTERNATE_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_ALTERNATE_SOURCE" value="'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE.'" size="10" placeholder="EUR" /> '; // Example: EUR
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -287,6 +334,26 @@ foreach ($TCurrency as &$currency)
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function getRates()
|
||||
{
|
||||
$("#bt_sync").attr("disabled", true);
|
||||
var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'";
|
||||
|
||||
$.ajax({
|
||||
url: url_sync,
|
||||
dataType: "jsonp"
|
||||
}).done(function(response) {
|
||||
$("#response").val(JSON.stringify(response));
|
||||
$("#form_sync").submit();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Bahfir Abbes <contact@dolibarrpar.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -169,6 +170,7 @@ if ($conf->societe->enabled)
|
||||
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
|
||||
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
|
||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
@ -213,6 +215,7 @@ foreach($listofnotifiedevents as $notifiedevent)
|
||||
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
|
||||
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
|
||||
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
|
||||
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
|
||||
@ -114,9 +114,8 @@ llxHeader('',$langs->trans("Files"),$wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
|
||||
|
||||
//print $langs->trans("FilesDesc")."<br>\n";
|
||||
//print "<br>\n";
|
||||
|
||||
print $langs->trans("SecurityFilesDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
require '../../main.inc.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/class/utils.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
@ -111,175 +112,34 @@ $outputdir = $conf->admin->dir_output.'/backup';
|
||||
$result=dol_mkdir($outputdir);
|
||||
|
||||
|
||||
$utils = new Utils($db);
|
||||
|
||||
|
||||
// MYSQL
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
|
||||
if ($cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
// for compression format, we add extension
|
||||
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
|
||||
if ($compression == 'gz') $outputfile.='.gz';
|
||||
if ($compression == 'bz') $outputfile.='.bz2';
|
||||
$outputerror = $outputfile.'.err';
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
|
||||
$param.=" -u ".$dolibarr_main_db_user;
|
||||
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
|
||||
if (! GETPOST("use_transaction")) $param.=" -l --single-transaction";
|
||||
if (GETPOST("disable_fk")) $param.=" -K";
|
||||
if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat","alpha"));
|
||||
if (GETPOST("drop_database")) $param.=" --add-drop-database";
|
||||
if (GETPOST("sql_structure"))
|
||||
{
|
||||
if (GETPOST("drop")) $param.=" --add-drop-table=TRUE";
|
||||
else $param.=" --add-drop-table=FALSE";
|
||||
}
|
||||
else
|
||||
{
|
||||
$param.=" -t";
|
||||
}
|
||||
if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE";
|
||||
if (GETPOST("sql_data"))
|
||||
{
|
||||
$param.=" --tables";
|
||||
if (GETPOST("showcolumns")) $param.=" -c";
|
||||
if (GETPOST("extended_ins")) $param.=" -e";
|
||||
else $param.=" --skip-extended-insert";
|
||||
if (GETPOST("delayed")) $param.=" --delayed-insert";
|
||||
if (GETPOST("sql_ignore")) $param.=" --insert-ignore";
|
||||
if (GETPOST("hexforbinary")) $param.=" --hex-blob";
|
||||
}
|
||||
else
|
||||
{
|
||||
$param.=" -d"; // No row information (no data)
|
||||
}
|
||||
$param.=" --default-character-set=utf8"; // We always save output into utf8 charset
|
||||
$paramcrypted=$param;
|
||||
$paramclear=$param;
|
||||
if (! empty($dolibarr_main_db_pass))
|
||||
{
|
||||
$paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"';
|
||||
$paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"';
|
||||
}
|
||||
|
||||
$_SESSION["commandbackuplastdone"]=$command." ".$paramcrypted;
|
||||
$_SESSION["commandbackuptorun"]="";
|
||||
/*
|
||||
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
// Now run command and show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
*/
|
||||
|
||||
$errormsg='';
|
||||
|
||||
// Debut appel methode execution
|
||||
$fullcommandcrypted=$command." ".$paramcrypted." 2>&1";
|
||||
$fullcommandclear=$command." ".$paramclear." 2>&1";
|
||||
if ($compression == 'none') $handle = fopen($outputfile, 'w');
|
||||
if ($compression == 'gz') $handle = gzopen($outputfile, 'w');
|
||||
if ($compression == 'bz') $handle = bzopen($outputfile, 'w');
|
||||
|
||||
if ($handle)
|
||||
{
|
||||
$ok=0;
|
||||
dol_syslog("Run command ".$fullcommandcrypted);
|
||||
$handlein = popen($fullcommandclear, 'r');
|
||||
$i=0;
|
||||
while (!feof($handlein))
|
||||
{
|
||||
$i++; // output line number
|
||||
$read = fgets($handlein);
|
||||
if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue;
|
||||
fwrite($handle,$read);
|
||||
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
|
||||
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;
|
||||
}
|
||||
pclose($handlein);
|
||||
|
||||
if ($compression == 'none') fclose($handle);
|
||||
if ($compression == 'gz') gzclose($handle);
|
||||
if ($compression == 'bz') bzclose($handle);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
|
||||
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
|
||||
}
|
||||
|
||||
// Get errorstring
|
||||
if ($compression == 'none') $handle = fopen($outputfile, 'r');
|
||||
if ($compression == 'gz') $handle = gzopen($outputfile, 'r');
|
||||
if ($compression == 'bz') $handle = bzopen($outputfile, 'r');
|
||||
if ($handle)
|
||||
{
|
||||
// Get 2048 first chars of error message.
|
||||
$errormsg = fgets($handle,2048);
|
||||
// Close file
|
||||
if ($compression == 'none') fclose($handle);
|
||||
if ($compression == 'gz') gzclose($handle);
|
||||
if ($compression == 'bz') bzclose($handle);
|
||||
if ($ok && preg_match('/^-- MySql/i',$errormsg)) $errormsg=''; // Pas erreur
|
||||
else
|
||||
{
|
||||
// Renommer fichier sortie en fichier erreur
|
||||
//print "$outputfile -> $outputerror";
|
||||
@dol_delete_file($outputerror,1);
|
||||
@rename($outputfile,$outputerror);
|
||||
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
|
||||
if (! $errormsg)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errormsg=$langs->trans("ErrorFailedToRunExternalCommand");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fin execution commande
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
}
|
||||
|
||||
// MYSQL NO BIN
|
||||
if ($what == 'mysqlnobin')
|
||||
{
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
$outputfiletemp = $outputfile.'-TMP.sql';
|
||||
// for compression format, we add extension
|
||||
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
|
||||
if ($compression == 'gz') $outputfile.='.gz';
|
||||
if ($compression == 'bz') $outputfile.='.bz2';
|
||||
$outputerror = $outputfile.'.err';
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
|
||||
if ($compression == 'gz' or $compression == 'bz')
|
||||
{
|
||||
backup_tables($outputfiletemp);
|
||||
dol_compress_file($outputfiletemp, $outputfile, $compression);
|
||||
unlink($outputfiletemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
backup_tables($outputfile);
|
||||
}
|
||||
|
||||
$_SESSION["commandbackuplastdone"]="";
|
||||
$_SESSION["commandbackuptorun"]="";
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
}
|
||||
|
||||
// POSTGRESQL
|
||||
@ -291,65 +151,13 @@ if ($what == 'postgresql')
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
// for compression format, we add extension
|
||||
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
|
||||
if ($compression == 'gz') $outputfile.='.gz';
|
||||
if ($compression == 'bz') $outputfile.='.bz2';
|
||||
$outputerror = $outputfile.'.err';
|
||||
dol_mkdir($conf->admin->dir_output.'/backup');
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
|
||||
$errormsg=$utils->error;
|
||||
$_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone'];
|
||||
$_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun'];
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
//$param="-F c";
|
||||
$param="-F p";
|
||||
$param.=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host;
|
||||
$param.=" -U ".$dolibarr_main_db_user;
|
||||
if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port;
|
||||
if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting";
|
||||
if (GETPOST("drop_database")) $param.=" -c -C";
|
||||
if (GETPOST("sql_structure"))
|
||||
{
|
||||
if (GETPOST("drop")) $param.=" --add-drop-table";
|
||||
if (! GETPOST("sql_data")) $param.=" -s";
|
||||
}
|
||||
if (GETPOST("sql_data"))
|
||||
{
|
||||
if (! GETPOST("sql_structure")) $param.=" -a";
|
||||
if (GETPOST("showcolumns")) $param.=" -c";
|
||||
}
|
||||
$param.=' -f "'.$outputfile.'"';
|
||||
//if ($compression == 'none')
|
||||
if ($compression == 'gz') $param.=' -Z 9';
|
||||
//if ($compression == 'bz')
|
||||
$paramcrypted=$param;
|
||||
$paramclear=$param;
|
||||
/*if (! empty($dolibarr_main_db_pass))
|
||||
{
|
||||
$paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass);
|
||||
$paramclear.=" -W".$dolibarr_main_db_pass;
|
||||
}*/
|
||||
$paramcrypted.=" -w ".$dolibarr_main_db_name;
|
||||
$paramclear.=" -w ".$dolibarr_main_db_name;
|
||||
|
||||
$_SESSION["commandbackuplastdone"]="";
|
||||
$_SESSION["commandbackuptorun"]=$command." ".$paramcrypted;
|
||||
/*print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
|
||||
print '<textarea rows="'.ROWS_3.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Now show to ask to run command
|
||||
print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user);
|
||||
|
||||
print '<br>';
|
||||
print '<br>';*/
|
||||
|
||||
$what='';
|
||||
$what=''; // Clear to show message to run command
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ $form = new Form($db);
|
||||
$title=$langs->trans("SystemToolsArea");
|
||||
if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
||||
|
||||
llxHeader(array(),$title);
|
||||
llxHeader('', $title);
|
||||
|
||||
print load_fiche_titre($title,'','title_setup');
|
||||
|
||||
|
||||
@ -61,11 +61,13 @@ $search_user = GETPOST("search_user");
|
||||
$search_desc = GETPOST("search_desc");
|
||||
$search_ua = GETPOST("search_ua");
|
||||
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
else $date_start=-1;
|
||||
if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
else $date_end=-1;
|
||||
|
||||
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
||||
if ($date_start > $date_end) $date_end=$date_start+86400;
|
||||
if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date_start+86400;
|
||||
|
||||
$now = dol_now();
|
||||
$nowarray = dol_getdate($now);
|
||||
@ -94,6 +96,18 @@ if (empty($date_end))
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// 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
|
||||
{
|
||||
$date_start=-1;
|
||||
$date_end=-1;
|
||||
$search_code='';
|
||||
$search_ip='';
|
||||
$search_user='';
|
||||
$search_desc='';
|
||||
$search_ua='';
|
||||
}
|
||||
|
||||
// Purge audit events
|
||||
if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
|
||||
{
|
||||
@ -152,12 +166,13 @@ $sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")";
|
||||
$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'";
|
||||
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; }
|
||||
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
|
||||
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; }
|
||||
if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$db->escape($search_desc)."%'"; }
|
||||
if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$db->escape($search_ua)."%'"; }
|
||||
if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'";
|
||||
if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'";
|
||||
if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); }
|
||||
if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); }
|
||||
if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); }
|
||||
if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); }
|
||||
if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); }
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
//print $sql;
|
||||
@ -169,13 +184,18 @@ if ($result)
|
||||
|
||||
$param='';
|
||||
if ($search_code) $param.='&search_code='.$search_code;
|
||||
if ($search_ip) $param.='&search_ip='.$search_ip;
|
||||
if ($search_ip) $param.='&search_ip='.$search_ip;
|
||||
if ($search_user) $param.='&search_user='.$search_user;
|
||||
if ($search_desc) $param.='&search_desc='.$search_desc;
|
||||
if ($search_ua) $param.='&search_ua='.$search_ua;
|
||||
if ($search_ua) $param.='&search_ua='.$search_ua;
|
||||
|
||||
$langs->load('withdrawals');
|
||||
print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup');
|
||||
$langs->load('withdrawals');
|
||||
if ($num)
|
||||
{
|
||||
$center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup');
|
||||
|
||||
if ($action == 'purge')
|
||||
{
|
||||
@ -218,7 +238,8 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -284,13 +305,6 @@ if ($result)
|
||||
}
|
||||
print "</table></form>";
|
||||
$db->free($result);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -40,8 +40,8 @@ if (GETPOST('msg','alpha')) {
|
||||
|
||||
|
||||
$urldolibarr='http://www.dolibarr.org/downloads/';
|
||||
$urldolibarrmodules='http://www.dolistore.com/';
|
||||
$urldolibarrthemes='http://www.dolistore.com/';
|
||||
$urldolibarrmodules='https://www.dolistore.com/';
|
||||
$urldolibarrthemes='https://www.dolistore.com/';
|
||||
$dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
|
||||
$dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
|
||||
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("products");
|
||||
@ -107,6 +108,8 @@ if ($action == 'delete')
|
||||
* View
|
||||
*/
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración';
|
||||
llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||
|
||||
@ -118,7 +121,7 @@ print "<br>\n";
|
||||
print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>';
|
||||
print '<br>';
|
||||
|
||||
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
|
||||
$urlwikitranslatordoc='http://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print $langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a><br>';
|
||||
|
||||
@ -134,7 +137,7 @@ print '<input type="hidden" id="action" name="action" value="">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Language").'</td>';
|
||||
print '<td>'.$langs->trans("Language").' (en_US, es_MX, ...)</td>';
|
||||
print '<td>'.$langs->trans("Key").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
|
||||
@ -146,7 +149,10 @@ print "</tr>\n";
|
||||
$var=false;
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td><input type="text" class="flat" size="24" name="langcode" value="'.GETPOST('langcode').'"></td>'."\n";
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1);
|
||||
//print '<input type="text" class="flat" size="24" name="langcode" value="'.GETPOST('langcode').'">';
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="30" name="transkey" value="">';
|
||||
print '</td><td>';
|
||||
|
||||
@ -59,7 +59,7 @@ exit;*/
|
||||
print '<div class="inline-block" style="vertical-align: top">';
|
||||
print '<div class="principal">';
|
||||
|
||||
$page=GETPOST('menu','alpha');
|
||||
$page=GETPOST('menutpl','alpha');
|
||||
if (empty($page)) $page='facturation';
|
||||
|
||||
if (in_array(
|
||||
|
||||
@ -42,7 +42,7 @@ $langs->load("cashdesk");
|
||||
*/
|
||||
|
||||
//header("Content-type: text/html; charset=UTF-8");
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
//header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array('/cashdesk/css/style.css');
|
||||
@ -62,8 +62,6 @@ print '<div class="conteneur">'."\n";
|
||||
print '<div class="conteneur_img_gauche">'."\n";
|
||||
print '<div class="conteneur_img_droite">'."\n";
|
||||
|
||||
print '<h1 class="entete"><span>POINT OF SALE</span></h1>'."\n";
|
||||
|
||||
print '<div class="menu_principal">'."\n";
|
||||
include_once 'tpl/menu.tpl.php';
|
||||
print '</div>'."\n";
|
||||
|
||||
@ -99,31 +99,24 @@ class Facturation
|
||||
$product = new Product($db);
|
||||
$product->fetch($this->id);
|
||||
|
||||
$sql = "SELECT taux";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva";
|
||||
$sql.= " WHERE rowid = ".$this->tva();
|
||||
|
||||
dol_syslog("ajoutArticle", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$vat_rate=$obj->taux;
|
||||
//var_dump($vat_rate);exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
$vatrowid = $this->tva();
|
||||
|
||||
$tmp = getTaxesFromId($vatrowid);
|
||||
$vat_rate = $tmp['rate'];
|
||||
$vat_npr = $tmp['npr'];
|
||||
|
||||
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
|
||||
|
||||
// Define part of HT, VAT, TTC
|
||||
$resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,$mysoc);
|
||||
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
|
||||
|
||||
// Calcul du total ht sans remise
|
||||
$total_ht = $resultarray[0];
|
||||
$total_vat = $resultarray[1];
|
||||
$total_ttc = $resultarray[2];
|
||||
$total_localtax1 = $resultarray[9];
|
||||
$total_localtax2 = $resultarray[10];
|
||||
|
||||
// Calcul du montant de la remise
|
||||
if ($this->remisePercent())
|
||||
@ -143,7 +136,7 @@ class Facturation
|
||||
$newcartarray[$i]['label']=$product->label;
|
||||
$newcartarray[$i]['price']=$product->price;
|
||||
$newcartarray[$i]['price_ttc']=$product->price_ttc;
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
@ -160,6 +153,9 @@ class Facturation
|
||||
$newcartarray[$i]['remise']=price2num($montant_remise_ht);
|
||||
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
|
||||
$newcartarray[$i]['total_ttc']=price2num($total_ttc,'MT');
|
||||
$newcartarray[$i]['total_vat']=price2num($total_vat, 'MT');
|
||||
$newcartarray[$i]['total_localtax1']=price2num($total_localtax1, 'MT');
|
||||
$newcartarray[$i]['total_localtax2']=price2num($total_localtax2, 'MT');
|
||||
$_SESSION['poscart']=$newcartarray;
|
||||
|
||||
$this->raz();
|
||||
@ -213,12 +209,18 @@ class Facturation
|
||||
// Total HT
|
||||
$remise = $tab[$i]['remise'];
|
||||
$total_ht += ($tab[$i]['total_ht']);
|
||||
$total_vat += ($tab[$i]['total_vat']);
|
||||
$total_ttc += ($tab[$i]['total_ttc']);
|
||||
$total_localtax1 += ($tab[$i]['total_localtax1']);
|
||||
$total_localtax2 += ($tab[$i]['total_localtax2']);
|
||||
}
|
||||
|
||||
$this->prix_total_ttc = $total_ttc;
|
||||
$this->prix_total_ht = $total_ht;
|
||||
|
||||
$this->prix_total_vat = $total_vat;
|
||||
$this->prix_total_localtax1 = $total_localtax1;
|
||||
$this->prix_total_localtax2 = $total_localtax2;
|
||||
|
||||
$this->montant_tva = $total_ttc - $total_ht;
|
||||
//print $this->prix_total_ttc.'eeee'; exit;
|
||||
}
|
||||
@ -442,9 +444,8 @@ class Facturation
|
||||
* @param int $aTva Vat
|
||||
* @return int Vat
|
||||
*/
|
||||
public function tva ( $aTva=null )
|
||||
public function tva($aTva=null)
|
||||
{
|
||||
|
||||
if ( !$aTva ) {
|
||||
|
||||
return $this->tva;
|
||||
@ -467,9 +468,8 @@ class Facturation
|
||||
* @param string $aNumFacture Invoice ref
|
||||
* @return string Invoice ref
|
||||
*/
|
||||
public function numInvoice( $aNumFacture=null )
|
||||
public function numInvoice($aNumFacture=null)
|
||||
{
|
||||
|
||||
if ( !$aNumFacture ) {
|
||||
|
||||
return $this->num_facture;
|
||||
|
||||
@ -20,7 +20,6 @@ body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
font: 0.7em verdana, arial, helvetica;
|
||||
}
|
||||
|
||||
p {
|
||||
@ -46,6 +45,15 @@ p {
|
||||
.contenu {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
text-align: center;
|
||||
}
|
||||
.logopos {
|
||||
padding-top: 20px;
|
||||
max-height: 40px;
|
||||
}
|
||||
|
||||
/* ------------------- Header ------------------- */
|
||||
@ -61,7 +69,7 @@ p {
|
||||
|
||||
/* ------------------- Menu ------------------- */
|
||||
.menu_principal {
|
||||
margin: 0 20px 20px 15px;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
height: 84px;
|
||||
background: #CCCCCC;
|
||||
@ -80,7 +88,7 @@ p {
|
||||
.menu {
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
padding: 10px 0 0;
|
||||
padding: 8px 0 0;
|
||||
}
|
||||
|
||||
.menu li {
|
||||
@ -88,34 +96,6 @@ p {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.menu_choix1,.menu_choix2 {
|
||||
font-size: 1.4em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.menu_choix1 a,.menu_choix2 a {
|
||||
display: block;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
padding-top: 18px;
|
||||
padding-left: 54px;
|
||||
font-size: 14px;
|
||||
height: 48px;
|
||||
background: url('../img/new.png') top left no-repeat;
|
||||
}
|
||||
|
||||
.menu_choix1 a {
|
||||
background: url('../img/new.png') top left no-repeat;
|
||||
}
|
||||
|
||||
.menu_choix2 a {
|
||||
background: url('../img/gescom.png') top left no-repeat;
|
||||
}
|
||||
|
||||
.menu_choix1 a:hover,.menu_choix2 a:hover {
|
||||
color: #6d3f6d;
|
||||
}
|
||||
|
||||
.menu_choix0 {
|
||||
font-size: 10px;
|
||||
text-align: right;
|
||||
|
||||
@ -37,7 +37,7 @@ switch ( $_GET['action'] )
|
||||
default:
|
||||
if ( $_POST['hdnSource'] != 'NULL' )
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx";
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||
@ -66,19 +66,23 @@ switch ( $_GET['action'] )
|
||||
{
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
|
||||
|
||||
$productid = $ret['rowid'];
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
/** add Ditto for MultiPrix*/
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$societe,$productid);
|
||||
$tva_npr = get_default_npr($mysoc,$societe,$productid);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr);
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level))
|
||||
{
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
$productid = $ret['rowid'];
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($thirdpartyid);
|
||||
|
||||
$product = new Product($db);
|
||||
$product->fetch($productid);
|
||||
|
||||
if(isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
@ -86,16 +90,39 @@ switch ( $_GET['action'] )
|
||||
// $product->multiprices_min[$societe->price_level];
|
||||
// $product->multiprices_min_ttc[$societe->price_level];
|
||||
// $product->multiprices_base_type[$societe->price_level];
|
||||
$ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** end add Ditto */
|
||||
|
||||
$ret['tva_tx'] = $tva_tx;
|
||||
$ret['tva_npr'] = $tva_npr;
|
||||
//var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit;
|
||||
|
||||
$obj_facturation->id($ret['rowid']);
|
||||
$obj_facturation->ref($ret['ref']);
|
||||
$obj_facturation->stock($ret['reel']);
|
||||
$obj_facturation->prix($ret['price']);
|
||||
$obj_facturation->tva($ret['tva_tx']);
|
||||
|
||||
// Use $ret['tva_tx'] / ret['tva_npr'] to find vat id
|
||||
$vatrowid = null;
|
||||
$sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva';
|
||||
$sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr'];
|
||||
$sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id;
|
||||
$resqlfindvatid=$db->query($sqlfindvatid);
|
||||
if ($resqlfindvatid)
|
||||
{
|
||||
$obj = $db->fetch_object($resqlfindvatid);
|
||||
if ($obj) $vatrowid = $obj->rowid;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
dol_syslog("save vatrowid=".$vatrowid);
|
||||
$obj_facturation->tva($vatrowid); // Save vat it for next use
|
||||
|
||||
// Definition du filtre pour n'afficher que le produit concerne
|
||||
if ( $_POST['hdnSource'] == 'LISTE' )
|
||||
@ -107,7 +134,7 @@ switch ( $_GET['action'] )
|
||||
$filtre = $_POST['txtRef'];
|
||||
}
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$filtre;
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$filtre;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -115,11 +142,11 @@ switch ( $_GET['action'] )
|
||||
|
||||
if ( $_POST['hdnSource'] == 'REF' )
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$_POST['txtRef'];
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$_POST['txtRef'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,40 +157,38 @@ switch ( $_GET['action'] )
|
||||
}
|
||||
else
|
||||
{
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'ajout_article': // We have clicked on button "Add product"
|
||||
|
||||
//var_dump('ajout_article');
|
||||
//exit;
|
||||
|
||||
if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it
|
||||
{
|
||||
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
|
||||
$obj_facturation->qte($_POST['txtQte']);
|
||||
$obj_facturation->tva($_POST['selTva']);
|
||||
$obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product
|
||||
$obj_facturation->remisePercent($_POST['txtRemise']);
|
||||
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
|
||||
// We update prixTotalTtc
|
||||
|
||||
}
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
case 'suppr_article':
|
||||
$obj_facturation->supprArticle($_GET['suppr_id']);
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// We saved object obj_facturation
|
||||
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
|
||||
|
||||
//var_dump($_SESSION['serObjFacturation']);
|
||||
header('Location: '.$redirection);
|
||||
exit;
|
||||
|
||||
|
||||
@ -58,9 +58,8 @@ top_htmlhead('','',0,0,'',$arrayofcss);
|
||||
<div class="conteneur_img_gauche">
|
||||
<div class="conteneur_img_droite">
|
||||
|
||||
<h1 class="entete"></h1>
|
||||
|
||||
<div class="menu_principal hideonsmartphone">
|
||||
<div class="logo"><?php print '<img class="logopos" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
|
||||
</div>
|
||||
|
||||
<div class="contenu">
|
||||
|
||||
@ -125,7 +125,7 @@ if ( $retour >= 0 )
|
||||
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
|
||||
//var_dump($_SESSION);exit;
|
||||
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV');
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
@ -119,7 +119,7 @@ $langs->load("cashdesk");
|
||||
<td></td>
|
||||
<!-- Choix de la remise -->
|
||||
<td><input class="texte1" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
|
||||
<?php print genkeypad("txtRemise", "frmQte");?>
|
||||
<?php print genkeypad("txtRemise", "frmQte");?>
|
||||
</td>
|
||||
<!-- Affichage du total HT -->
|
||||
<td><input class="texte1_off" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
||||
@ -128,16 +128,17 @@ $langs->load("cashdesk");
|
||||
<?php //var_dump($tab_tva); ?>
|
||||
<select name="selTva" onchange="javascript: modif();" >
|
||||
<?php
|
||||
$tva_tx = $obj_facturation->tva();
|
||||
$tab_tva_size=count($tab_tva);
|
||||
for($i=0;$i < $tab_tva_size;$i++) {
|
||||
$tva_tx = $obj_facturation->tva(); // Try to get a previously entered VAT rowid. First time, this will return empty.
|
||||
|
||||
if ( $tva_tx == $tab_tva[$i]['taux'] )
|
||||
$tab_tva_size=count($tab_tva); // $tab_tva contains list of possible vat array('rowid'=> , 'taux'=> )
|
||||
for ($i=0;$i < $tab_tva_size;$i++)
|
||||
{
|
||||
if ($tva_tx == $tab_tva[$i]['rowid'])
|
||||
$selected = 'selected';
|
||||
else
|
||||
$selected = '';
|
||||
$selected = '';
|
||||
|
||||
echo ('<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ");
|
||||
echo '<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n ";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
@ -62,7 +62,7 @@ $langs->load("main");
|
||||
print '<div class="menu_bloc">';
|
||||
print '<ul class="menu">';
|
||||
// Link to new sell
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menu=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
// Open new tab on backoffice (this is not a disconnect from POS)
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
// Disconnect
|
||||
|
||||
@ -113,7 +113,7 @@ $langs->load("bills");
|
||||
<p class="note_label"><?php echo $langs->trans("Notes"); ?><br><textarea class="textarea_note" name="txtaNotes"></textarea></p>
|
||||
|
||||
<div class="center"><input class="button" type="submit" name="btnValider" value="<?php echo $langs->trans("ValidateInvoice"); ?>" /><br>
|
||||
<br><a class="lien1" href="affIndex.php?menu=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
|
||||
<br><a class="lien1" href="affIndex.php?menutpl=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ switch ($action)
|
||||
|
||||
default:
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=validation';
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
|
||||
break;
|
||||
|
||||
|
||||
@ -85,13 +85,13 @@ switch ($action)
|
||||
$obj_facturation->paiementLe($txtDatePaiement);
|
||||
}
|
||||
|
||||
$redirection = 'affIndex.php?menu=validation';
|
||||
$redirection = 'affIndex.php?menutpl=validation';
|
||||
break;
|
||||
|
||||
|
||||
case 'retour':
|
||||
|
||||
$redirection = 'affIndex.php?menu=facturation';
|
||||
$redirection = 'affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
|
||||
@ -158,45 +158,30 @@ switch ($action)
|
||||
// Get content of cart
|
||||
$tab_liste = $_SESSION['poscart'];
|
||||
|
||||
// Loop on each product
|
||||
// Loop on each line into cart
|
||||
$tab_liste_size=count($tab_liste);
|
||||
for ($i=0;$i < $tab_liste_size;$i++)
|
||||
for ($i=0; $i < $tab_liste_size; $i++)
|
||||
{
|
||||
// Recuperation de l'article
|
||||
$product = new Product($db);
|
||||
$product->fetch($tab_liste[$i]['fk_article']);
|
||||
$ret=array('label'=>$product->label,'tva_tx'=>$product->tva_tx,'price'=>$product->price);
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
$ret['price'] = $product->multiprices[$societe->price_level];
|
||||
}
|
||||
}
|
||||
$tab_article = $ret;
|
||||
|
||||
$res = $db->query('SELECT taux FROM '.MAIN_DB_PREFIX.'c_tva WHERE rowid = '.$tab_liste[$i]['fk_tva']);
|
||||
$ret=array();
|
||||
$tab = $db->fetch_array($res);
|
||||
foreach ( $tab as $cle => $valeur )
|
||||
{
|
||||
$ret[$cle] = $valeur;
|
||||
}
|
||||
$tab_tva = $ret;
|
||||
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
|
||||
$vat_rate = $tmp['rate'];
|
||||
$vat_npr = $tmp['npr'];
|
||||
|
||||
$invoiceline=new FactureLigne($db);
|
||||
$invoiceline->fk_product=$tab_liste[$i]['fk_article'];
|
||||
$invoiceline->desc=$tab_article['label'];
|
||||
$invoiceline->tva_tx=empty($tab_tva['taux'])?0:$tab_tva['taux']; // works even if vat_rate is ''
|
||||
//$invoiceline->tva_tx=$tab_tva['taux'];
|
||||
$invoiceline->desc=$tab_liste[$i]['label'];
|
||||
$invoiceline->qty=$tab_liste[$i]['qte'];
|
||||
$invoiceline->remise_percent=$tab_liste[$i]['remise_percent'];
|
||||
$invoiceline->price=$tab_article['price'];
|
||||
$invoiceline->subprice=$tab_article['price'];
|
||||
$invoiceline->price=$tab_liste[$i]['price'];
|
||||
$invoiceline->subprice=$tab_liste[$i]['price'];
|
||||
|
||||
$invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is ''
|
||||
$invoiceline->info_bits=empty($vat_npr)?0:$vat_npr;
|
||||
|
||||
$invoiceline->total_ht=$tab_liste[$i]['total_ht'];
|
||||
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
|
||||
$invoiceline->total_tva=($tab_liste[$i]['total_ttc']-$tab_liste[$i]['total_ht']);
|
||||
$invoiceline->total_tva=$tab_liste[$i]['total_vat'];
|
||||
$invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1'];
|
||||
$invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2'];
|
||||
$invoice->lines[]=$invoiceline;
|
||||
}
|
||||
|
||||
@ -336,7 +321,7 @@ switch ($action)
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$redirection = 'affIndex.php?menu=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
|
||||
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1451,8 +1451,8 @@ class Categorie extends CommonObject
|
||||
|
||||
if (file_exists($originImage))
|
||||
{
|
||||
// Cree fichier en taille vignette
|
||||
$this->add_thumb($originImage);
|
||||
// Create thumbs
|
||||
$this->addThumbs($originImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1478,7 +1478,7 @@ class Categorie extends CommonObject
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) != false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->
|
||||
|
||||
if ($action == 'addthumb' && $_GET["file"])
|
||||
{
|
||||
$object->add_thumb($upload_dir."/".$_GET["file"]);
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -649,14 +649,14 @@ if ($action == 'create')
|
||||
// Type of event
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||
$default=(empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)?'':$conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
|
||||
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):($object->type_code?$object->type_code:$default), "actioncode", "systemauto", 0, -1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
||||
@ -664,7 +664,7 @@ if ($action == 'create')
|
||||
// Date start
|
||||
$datep=($datep?$datep:$object->datep);
|
||||
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
|
||||
print '<tr><td width="30%" class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
|
||||
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
@ -684,7 +684,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent=-1;
|
||||
if (isset($_GET['status']) || isset($_POST['status'])) $percent=GETPOST('status');
|
||||
@ -743,7 +743,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Societe, contact
|
||||
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
if (GETPOST('socid','int') > 0)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
@ -834,7 +834,7 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
@ -1090,17 +1090,22 @@ if ($id > 0)
|
||||
// Thirdparty - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$events=array();
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid,'socid','',1,1,0,$events);
|
||||
print '</td>';
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0);
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Contact
|
||||
print '<td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
@ -1108,10 +1113,10 @@ if ($id > 0)
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
$langs->load("project");
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").'</a>';
|
||||
@ -1120,7 +1125,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1136,7 +1141,7 @@ if ($id > 0)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1281,7 +1286,7 @@ if ($id > 0)
|
||||
// Third party - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
print '<tr><td>'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->thirdparty->fetch($object->thirdparty->id))
|
||||
|
||||
@ -81,7 +81,7 @@ $modulepart='contract';
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -634,7 +634,7 @@ else
|
||||
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
|
||||
$sql.= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user',1).")";
|
||||
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
|
||||
//if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
|
||||
//print $sql;
|
||||
|
||||
@ -124,6 +124,14 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id','int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
{
|
||||
@ -239,8 +247,8 @@ if ($id > 0)
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
@ -431,6 +439,27 @@ if ($id > 0)
|
||||
print '</div></td></tr>';
|
||||
}
|
||||
|
||||
// Preferred shipping Method
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
|
||||
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
|
||||
|
||||
@ -118,8 +118,8 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -765,8 +765,11 @@ if (empty($reshook))
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -908,6 +911,7 @@ if (empty($reshook))
|
||||
unset($_POST['type']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1037,6 +1041,7 @@ if (empty($reshook))
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1302,7 +1307,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
|
||||
@ -1317,9 +1322,12 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '</td>';
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1);
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
@ -1394,7 +1402,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
|
||||
print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
|
||||
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1459,7 +1467,7 @@ if ($action == 'create')
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1869,7 +1877,7 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
|
||||
// Delivery delay
|
||||
print '<tr><td>';
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('AvailabilityPeriod');
|
||||
if (! empty($conf->commande->enabled))
|
||||
@ -1972,9 +1980,9 @@ if ($action == 'create')
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2418,10 +2426,7 @@ if ($action == 'create')
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='pro'.$object->id;
|
||||
}
|
||||
$formmail->trackid='pro'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
@ -547,7 +547,7 @@ class Propal extends CommonObject
|
||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||
|
||||
// Mise a jour informations denormalisees au niveau de la propale 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)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -2037,9 +2037,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
global $user;
|
||||
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
return $this->classifyBilled();
|
||||
return $this->classifyBilled($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2841,11 +2842,13 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Retrieve an array of propal lines
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
// For other object, here we call fetch_lines. But fetch_lines does not exists on proposal
|
||||
|
||||
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||
@ -2875,9 +2878,11 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->id = $obj->rowid; // for backward compatibility
|
||||
$this->lines[$i]->rowid = $obj->rowid;
|
||||
$this->lines[$i]->label = $obj->custom_label;
|
||||
$this->lines[$i]->desc = $obj->description;
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->product_ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
|
||||
@ -67,7 +67,7 @@ if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -35,7 +35,9 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -55,17 +57,24 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al
|
||||
$search_refcustomer=GETPOST('search_refcustomer','alpha');
|
||||
$search_societe=GETPOST('search_societe','alpha');
|
||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_author=GETPOST('search_author','alpha');
|
||||
$search_montant_vat=GETPOST('search_montant_vat','alpha');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
|
||||
$search_login=GETPOST('search_login','alpha');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_state=trim(GETPOST("search_state"));
|
||||
$search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
$object_statut=GETPOST('propal_statut');
|
||||
|
||||
$sall=GETPOST("sall");
|
||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
$day=GETPOST("day","int");
|
||||
$year=GETPOST("year","int");
|
||||
$month=GETPOST("month","int");
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -78,9 +87,8 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
|
||||
// Nombre de ligne pour choix de produit/service predefinis
|
||||
$NBLINES=4;
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='proposallist';
|
||||
|
||||
// Security check
|
||||
$module='propal';
|
||||
@ -95,30 +103,15 @@ if (! empty($socid))
|
||||
}
|
||||
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
|
||||
if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_author='';
|
||||
$search_product_category='';
|
||||
$search_town='';
|
||||
$year='';
|
||||
$month='';
|
||||
$viewstatut='';
|
||||
$object_statut='';
|
||||
}
|
||||
|
||||
if($object_statut != '')
|
||||
$viewstatut=$object_statut;
|
||||
|
||||
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('propallist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('propal');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
@ -131,15 +124,98 @@ $fieldstosearchall = array(
|
||||
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
|
||||
'p.fin_validite'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
|
||||
'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
|
||||
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||
'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Do we click on 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
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_ref='';
|
||||
$search_refcustomer='';
|
||||
$search_societe='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
$search_montant_ttc='';
|
||||
$search_login='';
|
||||
$search_product_category='';
|
||||
$search_town='';
|
||||
$search_zip="";
|
||||
$search_state="";
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_type_thirdparty='';
|
||||
$year='';
|
||||
$month='';
|
||||
$day='';
|
||||
$viewstatut='';
|
||||
$object_statut='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if ($object_statut != '') $viewstatut=$object_statut;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -153,16 +229,31 @@ $formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formpropal = new FormPropal($db);
|
||||
$companystatic=new Societe($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
$sql.= ' s.rowid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
$sql.= ' p.datec as date_creation, p.tms as date_update,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'propal as p';
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
@ -179,26 +270,18 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($search_town) {//restriction
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('p.ref', $search_ref);
|
||||
}
|
||||
if ($search_refcustomer) {
|
||||
$sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
}
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_author)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
}
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
}
|
||||
if ($search_town) $sql.= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_login) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_login))."%'";
|
||||
if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
@ -226,19 +309,38 @@ if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.=', p.ref DESC';
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$result=$db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$objectstatic=new Propal($db);
|
||||
@ -261,14 +363,24 @@ if ($result)
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_author) $param.='&search_author='.$search_author;
|
||||
if ($search_login) $param.='&search_login='.$search_login;
|
||||
if ($search_town) $param.='&search_town='.$search_town;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
@ -320,181 +432,445 @@ if ($result)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Town'),$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="10" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.ref_client']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Company type
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
}
|
||||
// Date
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
if (! empty($arrayfields['p.date']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// Date end
|
||||
if (! empty($arrayfields['p.fin_validite']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.total_ht']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.total_vat']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.$search_montant_vat.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="4" type="text" name="search_login" value="'.$search_login.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td>';
|
||||
// Author
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" size="6" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" name="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" name="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$now = dol_now();
|
||||
$i=0;
|
||||
$var=true;
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$now = dol_now();
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$objectstatic->id=$objp->propalid;
|
||||
$objectstatic->ref=$objp->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if (! empty($objp->note_private))
|
||||
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$objp->propalid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$objectstatic->id=$obj->propalid;
|
||||
$objectstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if (! empty($obj->note_private))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$obj->propalid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->propalid;
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
// Customer ref
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
print $objp->ref_client;
|
||||
print '</td>';
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$objp->rowid;
|
||||
$companystatic->name=$objp->name;
|
||||
$companystatic->client=$objp->client;
|
||||
$companystatic->code_client=$objp->code_client;
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['p.ref_client']['checked']))
|
||||
{
|
||||
// Customer ref
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
print $obj->ref_client;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid;
|
||||
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
|
||||
// Thirdparty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Town
|
||||
print '<td class="nocellnopadd">';
|
||||
print $objp->town;
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type ent
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date proposal
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->dp), 'day');
|
||||
print "</td>\n";
|
||||
|
||||
if (! empty($arrayfields['p.date']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->dp), 'day');
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date end validity
|
||||
if ($objp->dfv)
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dfv),'day');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.fin_validite']['checked']))
|
||||
{
|
||||
if ($obj->dfv)
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dfv),'day');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['p.total_ht']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['p.total_vat']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($obj->total_vat)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalvat'] += $obj->total_vat;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['p.total_ttc']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
$userstatic->id=$objp->fk_user_author;
|
||||
$userstatic->login=$objp->login;
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
|
||||
print '<td align="right">'.$objectstatic->LibStatut($objp->fk_statut,5)."</td>\n";
|
||||
|
||||
print '<td> </td>';
|
||||
// Author
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">'.$objectstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total += $objp->total_ht;
|
||||
$subtotal += $objp->total_ht;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($total>0)
|
||||
{
|
||||
if($num<$limit){
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td colspan="6" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHTforthispage").'</td>';
|
||||
print '<td colspan="6" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
// Show total line
|
||||
if (isset($totalarray['totalhtfield']))
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
|
||||
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
|
||||
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -178,7 +178,7 @@ if (! $mesg)
|
||||
$px2->draw($filenameamount,$fileurlamount);
|
||||
}
|
||||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter);
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$fileurl_avg='';
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
|
||||
@ -33,19 +33,8 @@ global $user;
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedCommercialProposals'), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><?php echo $langs->trans('RefCustomer'); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$langs->load("propal");
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
@ -53,6 +42,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
@ -66,17 +56,6 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -466,7 +466,7 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == 'classifybilled' && $user->rights->commande->creer)
|
||||
{
|
||||
$ret=$object->classifyBilled();
|
||||
$ret=$object->classifyBilled($user);
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -681,7 +681,7 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
@ -694,10 +694,11 @@ if (empty($reshook))
|
||||
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
|
||||
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
|
||||
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
@ -832,6 +833,7 @@ if (empty($reshook))
|
||||
unset($_POST['type']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -962,6 +964,7 @@ if (empty($reshook))
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1321,6 +1324,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
$projectid = 0;
|
||||
$remise_absolue = 0;
|
||||
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
if (! empty($origin) && ! empty($originid)) {
|
||||
@ -1333,7 +1337,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
if ($element == 'project') {
|
||||
$projectid = $originid;
|
||||
|
||||
|
||||
if (!$cond_reglement_id) {
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
}
|
||||
@ -1440,7 +1444,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
|
||||
|
||||
// Reference client
|
||||
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
|
||||
@ -1465,7 +1469,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
$("#socid").change(function() {
|
||||
var socid = $(this).val();
|
||||
// reload page
|
||||
@ -1669,7 +1673,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
|
||||
@ -1730,8 +1734,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
dol_fiche_end();
|
||||
|
||||
// Button "Create Draft"
|
||||
print '<div class="center"><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '"></div>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
// Show origin lines
|
||||
@ -1931,7 +1939,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
*/
|
||||
$nbrow = 9;
|
||||
if (! empty($conf->projet->enabled))
|
||||
$nbrow ++;
|
||||
@ -1947,7 +1955,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">' . $langs->trans('Ref') . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
@ -1987,10 +1995,23 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action == 'editthirdparty') {
|
||||
$form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0');
|
||||
} else {
|
||||
print ' ' . $soc->getNomUrl(1, 'compta');
|
||||
print $soc->getNomUrl(1, 'compta');
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if ($soc->outstanding_limit)
|
||||
{
|
||||
// Outstanding Bill
|
||||
print '<tr><td>';
|
||||
print $langs->trans('OutstandingBill');
|
||||
print '</td><td colspan="3">';
|
||||
print price($soc->get_OutstandingBill()) . ' / ';
|
||||
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Relative and absolute discounts
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
|
||||
// invoice
|
||||
@ -2000,7 +2021,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'";
|
||||
}
|
||||
|
||||
// Relative and absolute discounts
|
||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
||||
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
|
||||
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
||||
@ -2050,6 +2070,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</form>';
|
||||
} else {
|
||||
print $object->date ? dol_print_date($object->date, 'daytext') : ' ';
|
||||
if ($object->hasDelay() && empty($object->date_livraison)) {
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -2072,6 +2095,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</form>';
|
||||
} else {
|
||||
print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : ' ';
|
||||
if ($object->hasDelay() && ! empty($object->date_livraison)) {
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -2181,9 +2207,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2224,6 +2250,19 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// print '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=22&origin=order&originid='.$object->id.'">'.$langs->trans("DictionarySource").'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
if ($totalWeight || $totalVolume)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CalculatedWeight").' / '.$langs->trans("CalculatedVolume").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||
print ' / ';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
// Project
|
||||
@ -2247,18 +2286,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->outstanding_limit)
|
||||
{
|
||||
// Outstanding Bill
|
||||
print '<tr><td>';
|
||||
print $langs->trans('OutstandingBill');
|
||||
print '</td><td align=right colspan=3>';
|
||||
print price($soc->get_OutstandingBill()) . ' / ';
|
||||
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
@ -2463,7 +2490,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||
}
|
||||
|
||||
|
||||
// Create intervention
|
||||
if ($conf->ficheinter->enabled) {
|
||||
$langs->load("interventions");
|
||||
@ -2480,12 +2507,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) {
|
||||
$langs->load("contracts");
|
||||
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ship
|
||||
$numshipping = 0;
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
@ -2552,6 +2579,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
@ -2599,6 +2631,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
@ -2641,15 +2674,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
|
||||
@ -186,7 +186,7 @@ class CommandeApi extends DolibarrApi
|
||||
*
|
||||
* @url POST order/
|
||||
*
|
||||
* @return int ID of commande
|
||||
* @return string ID of commande
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
|
||||
@ -140,10 +140,6 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
var $lines = array();
|
||||
|
||||
// Pour board
|
||||
var $nbtodo;
|
||||
var $nbtodolate;
|
||||
|
||||
// Multicurrency
|
||||
var $fk_multicurrency;
|
||||
var $multicurrency_code;
|
||||
@ -170,9 +166,13 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Accepted/On process not managed for customer orders
|
||||
* Accepted (supplier orders)
|
||||
*/
|
||||
const STATUS_ACCEPTED = 2;
|
||||
/**
|
||||
* Shipment on process (customer orders)
|
||||
*/
|
||||
const STATUS_SHIPMENTONPROCESS = 2;
|
||||
/**
|
||||
* Closed (Sent/Received, billed or not)
|
||||
*/
|
||||
@ -1718,12 +1718,13 @@ class Commande extends CommonOrder
|
||||
$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.weight, p.weight_units, p.volume, p.volume_units';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
||||
$sql .= ' ORDER BY l.rang';
|
||||
$sql .= ' ORDER BY l.rang, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1744,6 +1745,7 @@ class Commande extends CommonOrder
|
||||
$line->commande_id = $objp->fk_commande;
|
||||
$line->label = $objp->custom_label;
|
||||
$line->desc = $objp->description;
|
||||
$line->description = $objp->description; // Description line
|
||||
$line->product_type = $objp->product_type;
|
||||
$line->qty = $objp->qty;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
@ -1776,6 +1778,11 @@ class Commande extends CommonOrder
|
||||
$line->product_desc = $objp->product_desc;
|
||||
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
$line->weight = $objp->weight;
|
||||
$line->weight_units = $objp->weight_units;
|
||||
$line->volume = $objp->volume;
|
||||
$line->volume_units = $objp->volume_units;
|
||||
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_end = $this->db->jdate($objp->date_end);
|
||||
@ -1836,7 +1843,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* Load array this->expeditions of nb of products sent by line in order
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
*
|
||||
* @param int $filtre_statut Filter on status
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
@ -2413,9 +2420,10 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Classify the order as invoiced
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @param User $user Object user making the change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function classifyBilled()
|
||||
function classifyBilled(User $user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
@ -2469,9 +2477,10 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
global $user;
|
||||
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
return $this->classifyBilled();
|
||||
return $this->classifyBilled($user);
|
||||
}
|
||||
|
||||
|
||||
@ -2552,7 +2561,14 @@ class Commande extends CommonOrder
|
||||
|
||||
// Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
$subprice = $pu;
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$subprice = $tabprice[5];
|
||||
}
|
||||
else
|
||||
{
|
||||
$subprice = $pu;
|
||||
}
|
||||
$remise = 0;
|
||||
if ($remise_percent > 0)
|
||||
{
|
||||
@ -3280,91 +3296,13 @@ class Commande extends CommonOrder
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of order lines
|
||||
*
|
||||
* @return array Lines of order
|
||||
* Create an array of order lines
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
$lines = array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, ';
|
||||
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
|
||||
$sql.= ' l.date_start, l.date_end,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
|
||||
$sql.= ' p.description as product_desc, p.stock as stock_reel,';
|
||||
$sql.= ' p.entity';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->lines[$i] = new OrderLine($this->db);
|
||||
$this->lines[$i]->id = $obj->rowid;
|
||||
$this->lines[$i]->label = $obj->custom_label;
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
|
||||
$this->lines[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i]->qty = $obj->qty;
|
||||
$this->lines[$i]->subprice = $obj->subprice;
|
||||
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
|
||||
$this->lines[$i]->remise_percent = $obj->remise_percent;
|
||||
$this->lines[$i]->tva_tx = $obj->tva_tx;
|
||||
$this->lines[$i]->info_bits = $obj->info_bits;
|
||||
$this->lines[$i]->total_ht = $obj->total_ht;
|
||||
$this->lines[$i]->total_tva = $obj->total_tva;
|
||||
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
||||
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
||||
$this->lines[$i]->special_code = $obj->special_code;
|
||||
$this->lines[$i]->stock = $obj->stock_reel;
|
||||
$this->lines[$i]->rang = $obj->rang;
|
||||
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
|
||||
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
|
||||
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
|
||||
$this->lines[$i]->pa_ht = $marginInfos[0];
|
||||
$this->lines[$i]->marge_tx = $marginInfos[1];
|
||||
$this->lines[$i]->marque_tx = $marginInfos[2];
|
||||
$this->lines[$i]->fk_unit = $obj->fk_unit;
|
||||
|
||||
// Multicurrency
|
||||
$this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency;
|
||||
$this->lines[$i]->multicurrency_code = $obj->multicurrency_code;
|
||||
$this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||
$this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3436,6 +3374,22 @@ class Commande extends CommonOrder
|
||||
|
||||
return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the customer delayed info
|
||||
*
|
||||
* @return string Show delayed information
|
||||
*/
|
||||
public function showDelay()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
|
||||
else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day');
|
||||
$text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today");
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ if ($object->fetch($id))
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -220,7 +220,7 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
{
|
||||
if ($closeOrders)
|
||||
{
|
||||
$objectsrc->classifyBilled();
|
||||
$objectsrc->classifyBilled($user);
|
||||
$objectsrc->setStatut(3);
|
||||
}
|
||||
$lines = $objectsrc->lines;
|
||||
@ -622,8 +622,10 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
//SEARCH BUTTON
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
print '</td>';
|
||||
|
||||
//ALL/NONE
|
||||
print '<td align="center" class="liste_titre">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
print '</td>';
|
||||
|
||||
@ -697,7 +699,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<br><div class="center"><input type="checkbox" checked name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
|
||||
print '<br><div class="center"><input type="checkbox" '.(empty($conf->global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE)?' checked="checked"':'').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
|
||||
print '<div align="right">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
|
||||
@ -27,22 +27,8 @@ global $user;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("orders");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedCustomerOrders'), '', '');
|
||||
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("RefCustomer"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
@ -50,6 +36,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
@ -63,17 +50,6 @@ foreach($linkedObjectBlock as $key => $objectlink)
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@ -209,29 +209,13 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$result=$object->fetch($id, $ref);
|
||||
|
||||
// Chargement des categories bancaires dans $options
|
||||
$nbcategories=0;
|
||||
// Load bank groups
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
$bankcateg = new BankCateg($db);
|
||||
$options = array();
|
||||
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$options = '<option value="0" selected> </option>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$options.= '<option value="'.$obj->rowid.'">'.$obj->label.'</option>'."\n";
|
||||
$nbcategories++;
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
foreach ($bankcateg->fetchAll() as $bankcategory) {
|
||||
$options[$bankcategory->id] = $bankcategory->label;
|
||||
}
|
||||
|
||||
// Definition de sql_rech et param
|
||||
@ -397,15 +381,11 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->type != 2 && $object->rappro)
|
||||
{
|
||||
if ($object->canBeConciliated() > 0) {
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($user->rights->banque->consolidate) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline ? '&vline='.$vline : '').'">'.$langs->trans("Conciliate").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
@ -494,9 +474,9 @@ if ($id > 0 || ! empty($ref))
|
||||
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 ($nbcategories)
|
||||
{
|
||||
print '<br>'.$langs->trans("Rubrique").': <select class="flat" name="cat1">'.$options.'</select>';
|
||||
if ($options) {
|
||||
print '<br>'.$langs->trans("Rubrique").': ';
|
||||
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align=right><input name="debit" class="flat" type="text" size="4" value="'.GETPOST("debit").'"></td>';
|
||||
@ -529,8 +509,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right" width="80">'.$langs->trans("BankBalance").'</td>';
|
||||
print '<td align="center" width="60">';
|
||||
if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort");
|
||||
else print ' ';
|
||||
if ($object->canBeConciliated() > 0) {
|
||||
print $langs->trans("AccountStatementShort");
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" name="search" method="POST">';
|
||||
@ -538,9 +521,9 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
$period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1);
|
||||
$period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,0,1);
|
||||
$period_filter .= ' ';
|
||||
$period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1);
|
||||
$period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,0,1);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$period_filter.'</td>';
|
||||
|
||||
@ -276,7 +276,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
|
||||
|
||||
// Label
|
||||
@ -286,13 +286,13 @@ if ($action == 'create')
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]:1,"type");
|
||||
$formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT,"type");
|
||||
print '</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
$selectedcode=$account->currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
|
||||
//print $langs->trans("Currency".$conf->currency);
|
||||
@ -360,7 +360,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Sold
|
||||
print '<tr><td width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
@ -369,20 +369,20 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->account_min_allowed).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->min_desired).'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -447,9 +447,8 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
}
|
||||
$ibankey="IBANNumber";
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
@ -483,14 +482,14 @@ if ($action == 'create')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
@ -498,14 +497,14 @@ if ($action == 'create')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
@ -567,7 +566,7 @@ else
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
|
||||
print '</td></tr>';
|
||||
@ -583,7 +582,7 @@ else
|
||||
// Currency
|
||||
print '<tr><td>'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
$selectedcode=$account->currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
print '</td></tr>';
|
||||
@ -647,7 +646,7 @@ else
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td valign="top" class="titlefield">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
@ -711,9 +710,8 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
@ -756,7 +754,7 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
@ -833,7 +831,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
@ -851,7 +849,7 @@ else
|
||||
print '<input type="hidden" value="'.$account->currency_code.'">';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
$selectedcode=$account->currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
|
||||
//print $langs->trans("Currency".$conf->currency);
|
||||
@ -895,7 +893,7 @@ else
|
||||
$conciliate=$account->canBeConciliated();
|
||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
||||
else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked').'"> '.$langs->trans("DisableConciliation");
|
||||
else print '<input type="checkbox" class="flat" name="norappro"'.(($conciliate > 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
|
||||
print '</td></tr>';
|
||||
|
||||
// Balance
|
||||
@ -929,12 +927,12 @@ else
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
if ($_POST["type"] == Account::TYPE_SAVINGS || $_POST["type"] == Account::TYPE_CURRENT)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1000,9 +998,8 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
@ -1033,36 +1030,20 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST("account_number"):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
$tdextra = ' class="titlefieldcreate"';
|
||||
|
||||
if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
|
||||
$tdextra = ' class="fieldrequired titlefieldcreate"';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST("account_number"):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
} else {
|
||||
print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $account->account_number).'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user