Merge branch 'develop' into Bookkeeping-V6
This commit is contained in:
commit
c5267154b9
@ -11,7 +11,7 @@ php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6.29'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- nightly
|
||||
@ -305,6 +305,9 @@ script:
|
||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
|
||||
@ -53,6 +53,7 @@ jQuery Tiptip 1.3 GPL and MIT License Yes
|
||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.gnu.org/licenses/licenses.en.html
|
||||
|
||||
122
ChangeLog
122
ChangeLog
@ -2,12 +2,134 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||
NEW: Add a payment module for Stripe.
|
||||
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
|
||||
NEW: Add a tracking id into mass emailing.
|
||||
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
|
||||
NEW: Add calculation function for Loan schedule
|
||||
NEW: Add "depends on" and "required by" into module informations
|
||||
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
|
||||
NEW: Add key __USERID__ and __ENTITYID__ as key for dynamic filters.
|
||||
NEW: Add last activation author and ip of modules
|
||||
NEW: Add mass actions (pdf merge and delete) for interventions
|
||||
NEW: Add module resources import/export
|
||||
NEW: Add option PROJECT_THIRDPARTY_REQUIRED
|
||||
NEW: Add page statistics for project tasks
|
||||
NEW: add property to show warnings when activating modules
|
||||
NEW: add rapport file for supplier paiement
|
||||
NEW: Add statistics on supplier tab.
|
||||
NEW: Add tooltip help on shipment weight and volume calculation
|
||||
NEW: An external module can hook and add mass actions
|
||||
NEW: Better reponsive design
|
||||
NEW: Bookmarks are into a combo list.
|
||||
NEW: Bulk actions available on supplier orders
|
||||
NEW: Can add a background image on login page
|
||||
NEW: Can change customer from POS
|
||||
NEW: Can clone expense report on another user
|
||||
NEW: Can control constants values into file integrity checker
|
||||
NEW: Can define default values for create forms.
|
||||
NEW: Can define default filters for list pages.
|
||||
NEW: Can define default sort order for list pages.
|
||||
NEW: Can deploy an external module from the module setup area.
|
||||
NEW: Can disable all overwrote translations in one click.
|
||||
NEW: Can edit background color for odd and even lines in tables
|
||||
NEW: Can filter on code in dictionnaries
|
||||
NEW: Can filter on year and product tags on the product statistic page
|
||||
NEW: Can import users
|
||||
NEW: Can read time spent of others (hierarchy only or all if granted)
|
||||
NEW: Can send an email to a user from its card.
|
||||
NEW: Can send email to multiple destinaries from the mailform combo list.
|
||||
NEW: Can set margins of PDFs
|
||||
NEW: Can set number of dump to keep with job "local database backup"
|
||||
NEW: Can sort customer balance summary on date.
|
||||
NEW: Can sort thumbs visible on product card.
|
||||
NEW: Can use a credit note into a "down payment/deposit".
|
||||
NEW: Can use dol_fiche_end without showing bottom border.
|
||||
NEW: Can use translations into all substitutions (watermark, freetext...)
|
||||
NEW: Change to allow a specific numbering rule for invoice with POS module.
|
||||
NEW: convert exceiss received to reduc
|
||||
NEW: custom dir is enabled dy default on first install.
|
||||
NEW: Description of feature of a module visible into a dedicated popup.
|
||||
NEW: Direct open of card after a search if one record only found.
|
||||
NEW: download button
|
||||
NEW: Enable bulk actions delete on supplier invoices.
|
||||
NEW: Extrafields support formulas to be computed using PHP expressions.
|
||||
NEW: Feature to crop/resize images available on user and expense reports.
|
||||
NEW: Filechecker can include custom dir and report added files.
|
||||
NEW: fix listview class and add a demo for product list
|
||||
NEW: [FP17] Accountancy - Add select field in list of accounts
|
||||
NEW: get amount base on hourly rate for ficheinter
|
||||
NEW: hidden Easter egg to display commitstrip strip on login page
|
||||
NEW: Include an hourglass icon when we click on online payment button
|
||||
NEW: Index upload files into database.
|
||||
NEW: Introduce mass action on product list ('delete' for the moment)
|
||||
NEW: Introduce mass actions on contacts
|
||||
NEW: Introduce option MAIN_HTTP_CONTENT_SECURITY_POLICY
|
||||
NEW: It's easier to switch between sandbox and live for paypal
|
||||
NEW: Mass action delete available on project and tasks
|
||||
NEW: Move login information on home page into a widget
|
||||
NEW: new demo entry page
|
||||
NEW: No external check of version without explicit click in about page.
|
||||
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
|
||||
NEW: odt usergroup
|
||||
NEW: On invoices generated by template, we save if invoice come from a source template.
|
||||
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
|
||||
NEW: PDF with numbertoword
|
||||
NEW: Permit multiple file upload in linked documents
|
||||
NEW: PHP 7.1 compatibility
|
||||
NEW: Reduce memory usage by removing deprecated constant loading.
|
||||
NEW: Report page and menu for suppliers paiements
|
||||
NEW: Show by default README.md file found into root dir of ext module.
|
||||
NEW: Show company into combo list of projects
|
||||
NEW: show files in the bank statement + download
|
||||
NEW: Show local taxes in facture list
|
||||
NEW: Show local taxes in supplier facture list
|
||||
NEW: Small PDF template for products
|
||||
NEW: Option SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT
|
||||
NEW: The substitution keys available for emailing edition are now visible into a popup.
|
||||
NEW: Uniformize behaviour: Action to make order is an action button.
|
||||
NEW: Use autocompletion on the "Add widget list".
|
||||
NEW: Use html5 type "number" on select field for year and duration.
|
||||
NEW: Can use pdktk to concat mass pdf because tcpdf generate avoid to split large file into multiple smaller file (all have same size) encounter issue with mailer provider virtual delivery service
|
||||
NEW: Default theme of v6 is cleaner.
|
||||
NEW: When down payment is entered, discount to reuse into final invoice is automatically created. This save one click into invoice workflow.
|
||||
NEW: Add UI to configure MEMBER_NEWFORM_FORCETYPE
|
||||
NEW: #2763 Go to document block after clicking in Generate document button
|
||||
NEW: #6280: Generate PDF after creating an invoice from a customer order
|
||||
NEW: #6915 Simplest change.
|
||||
NEW: Uniformize the look and feel with v6 new look.
|
||||
|
||||
For developers:
|
||||
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
|
||||
NEW: Big refactorization of multicompany transverse mode.
|
||||
NEW: getEntity function use true $shared value by default.
|
||||
NEW: Add font-awesome css.
|
||||
NEW: Add function ajax_autoselect
|
||||
NEW: Add function dolMd2Html
|
||||
NEW: Add hook doUpgrade2
|
||||
NEW: Add hook "formatNotificationMessage"
|
||||
NEW: Add index and constraints keys on supplier proposal detail table
|
||||
NEW: Add phpunit to check the engine is defined into sql create files.
|
||||
NEW: Add project and Hook to Loan
|
||||
NEW: Add REST API to push a file.
|
||||
NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list
|
||||
NEW: Architecture to manage search criteria persistance (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links)
|
||||
NEW: data files are now also parsed by phpunit for sql syntax
|
||||
NEW: Hook to allow inserting custom product head #6001
|
||||
NEW: Introduce fields that can be computed during export in export profiles.
|
||||
NEW: Introduce function dol_compress_dir
|
||||
NEW: Removed commande_pdf_create, contract_pdf_create,expedition_pdf_create, facture_pdf_create, delivery_order_pdf_create, task_pdf_create, project_pdf_create, propale_pdf_create, supplier_invoice_pdf_create, supplier_order_pdf_create, supplier_proposal_pdf_create deprecated functions
|
||||
NEW: tooltip can be on hover or on click with textwithpicto function.
|
||||
NEW: Upgrade jquery to 3.3.1 and jquery-ui to 1.12
|
||||
|
||||
WARNING:
|
||||
|
||||
|
||||
@ -353,10 +353,12 @@ begin
|
||||
begin
|
||||
// TODO Copy file or ask to install package ?
|
||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
end;
|
||||
|
||||
|
||||
// Pb seems similar with msvcp110.dll
|
||||
//vcredist_x64.exe
|
||||
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
// Install of service and stop/start scripts are already rebuild by installer.
|
||||
|
||||
@ -592,6 +592,8 @@ if ($nboftargetok) {
|
||||
print "Remove subdir of custom dir\n";
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
|
||||
}
|
||||
|
||||
# Build package for each target
|
||||
@ -972,9 +974,11 @@ if ($nboftargetok) {
|
||||
$ret=`$cmd`;
|
||||
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_myobject.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject_api_class.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
|
||||
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`;
|
||||
|
||||
@ -162,6 +162,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -242,6 +242,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -159,6 +159,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -170,6 +170,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/cashdesk
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
|
||||
@ -5,7 +5,7 @@ in Dolibarr root.
|
||||
|
||||
ALL:
|
||||
----
|
||||
Check "DOL_CHANGE"
|
||||
Check "@CHANGE"
|
||||
|
||||
|
||||
CKEDITOR (4.6.2):
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
||||
JOURNALCODE JOURNALLIB ECRITURENUM ECRITUREDATE COMPTENUM COMPTELIB COMPAUXNUM COMPAUXLIB PIECEREF PIECEDATE ECRITURELIB DEBIT CREDIT ECRITURELET DATELET VALIDDATE MONTANTDEVISE IDEVISE
|
||||
Banque Banque 17293 20170109 401PPRO PUBLI-PROV L08 20170109 PPRO domiciliation 1TR 187,20 0,00 20170109
|
||||
Banque Banque 17293 20170109 5121CRA CR AGRICOLE L08 20170109 PPRO domiciliation 1TR 0,00 187,20 20170109
|
||||
Banque Banque 17295 20170109 401ORPA ORANGE PARIS Report 20170109 ORPA adsl par 12 96,00 0,00 20170109
|
||||
|
||||
@ -1 +1,4 @@
|
||||
http://www.taxrates.cc/index.html
|
||||
http://www.taxrates.cc/index.html
|
||||
|
||||
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst
|
||||
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim:ft=sh:ts=3:sts=3:sw=3:et:
|
||||
|
||||
###
|
||||
# Strips the closing php tag `?>` and any following blank lines from the
|
||||
# end of any PHP file in the current working directory and sub-directories. Files
|
||||
# with non-whitespace characters following the closing tag will not be affected.
|
||||
#
|
||||
# Author: Bryan C. Geraghty <bryan@ravensight.org>
|
||||
# Date: 2009-10-28
|
||||
# Source: http://bryan.ravensight.org/2010/07/remove-php-closing-tag/
|
||||
##
|
||||
|
||||
FILES=$(pcregrep -rnM --include='^.*\.php$' '^\?\>(?=([\s\n]+)?$(?!\n))' .);
|
||||
|
||||
for MATCH in $FILES;
|
||||
do
|
||||
FILE=`echo $MATCH | awk -F ':' '{print $1}'`;
|
||||
TARGET=`echo $MATCH | awk -F ':' '{print $2}'`;
|
||||
LINE_COUNT=`wc -l $FILE | awk -F " " '{print $1}'`;
|
||||
echo "Removing lines ${TARGET} through ${LINE_COUNT} from file $FILE...";
|
||||
sed -i "${TARGET},${LINE_COUNT}d" $FILE;
|
||||
done;
|
||||
@ -12,3 +12,6 @@ Balance ?? Net profit
|
||||
Subledger account Subledger account ??
|
||||
|
||||
|
||||
Proposal ?? Quotation Proposal is ok but proposition looks better (proposal is for a detailed proposition). We can say also "business proposition or business proposal".
|
||||
Indian are using "Quotation".
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ $path=dirname(__FILE__).'/';
|
||||
$web=0;
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
if (substr($sapi_type, 0, 3) == 'cgi')
|
||||
{
|
||||
$web=1;
|
||||
}
|
||||
@ -35,9 +35,9 @@ if ($web)
|
||||
{
|
||||
echo "<html>";
|
||||
echo "<head>";
|
||||
|
||||
|
||||
echo "<STYLE type=\"text/css\">
|
||||
|
||||
|
||||
table {
|
||||
background: #f5f5f5;
|
||||
border-collapse: separate;
|
||||
@ -48,7 +48,7 @@ if ($web)
|
||||
text-align: left;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
background-color: #777;
|
||||
border-left: 1px solid #555;
|
||||
@ -61,7 +61,7 @@ if ($web)
|
||||
position: relative;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #e8e8e8;
|
||||
@ -70,19 +70,19 @@ if ($web)
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
tr {
|
||||
background-color: #f1f1f1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
tr:nth-child(odd) td {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
|
||||
</STYLE>";
|
||||
|
||||
|
||||
echo "<body>";
|
||||
}
|
||||
|
||||
@ -142,9 +142,9 @@ foreach ($files AS $file) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($langstrings_3d AS $filename => $file)
|
||||
foreach ($langstrings_3d AS $filename => $file)
|
||||
{
|
||||
foreach ($file AS $linenum => $value)
|
||||
foreach ($file AS $linenum => $value)
|
||||
{
|
||||
$keys = array_keys($langstrings_full, $value);
|
||||
if (count($keys)>1)
|
||||
@ -173,11 +173,11 @@ $sininstallandadmin='';
|
||||
$sother='';
|
||||
|
||||
$count = 0;
|
||||
foreach ($dups as $string => $pages)
|
||||
foreach ($dups as $string => $pages)
|
||||
{
|
||||
$count++;
|
||||
$s='';
|
||||
|
||||
|
||||
// Keyword $string
|
||||
if ($web) $s.="<tr>";
|
||||
if ($web) $s.="<td align=\"center\">";
|
||||
@ -188,32 +188,32 @@ foreach ($dups as $string => $pages)
|
||||
if ($web) $s.="</td>";
|
||||
if ($web) $s.="<td>";
|
||||
if (! $web) $s.= ' : ';
|
||||
|
||||
|
||||
// Loop on each files keyword was found
|
||||
$duplicateinsamefile=0;
|
||||
$inmain=0;
|
||||
$inadmin=0;
|
||||
foreach ($pages AS $file => $lines)
|
||||
foreach ($pages AS $file => $lines)
|
||||
{
|
||||
if ($file == 'main.lang') { $inmain=1; $inadmin=0; }
|
||||
if ($file == 'admin.lang' && ! $inmain) { $inadmin=1; }
|
||||
|
||||
|
||||
$s.=$file." ";
|
||||
|
||||
|
||||
// Loop on each line keword was found into file.
|
||||
$listoffilesforthisentry=array();
|
||||
foreach ($lines as $line => $translatedvalue)
|
||||
foreach ($lines as $line => $translatedvalue)
|
||||
{
|
||||
if (! empty($listoffilesforthisentry[$file])) $duplicateinsamefile=1;
|
||||
$listoffilesforthisentry[$file]=1;
|
||||
|
||||
|
||||
$s.= "(".$line." - ".htmlentities($translatedvalue).") ";
|
||||
}
|
||||
if ($web) $s.="<br>";
|
||||
}
|
||||
if ($web) $s.="</td></tr>";
|
||||
$s.="\n";
|
||||
|
||||
|
||||
if ($duplicateinsamefile) $sduplicateinsamefile .= $s;
|
||||
else if ($inmain) $sinmainandother .= $s;
|
||||
else if ($inadmin) $sininstallandadmin .= $s;
|
||||
@ -252,7 +252,7 @@ if ($web)
|
||||
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true'))
|
||||
{
|
||||
print "***** Strings in en_US that are never used:\n";
|
||||
|
||||
|
||||
$unused=array();
|
||||
foreach ($langstrings_dist AS $value => $line)
|
||||
{
|
||||
@ -288,7 +288,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^LT[0-9]/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
|
||||
@ -315,7 +315,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
// orders
|
||||
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
|
||||
// other.lang
|
||||
// other.lang
|
||||
if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
|
||||
@ -336,17 +336,17 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
|
||||
|
||||
|
||||
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
|
||||
if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
|
||||
|
||||
|
||||
if (! $qualifiedforclean)
|
||||
{
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//$search = '\'trans("'.$value.'")\'';
|
||||
$search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')" -e "('.$value.',"';
|
||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*';
|
||||
@ -356,7 +356,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
$unused[$value] = $line;
|
||||
echo $line; // $trad contains the \n
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
unset($output);
|
||||
//print 'X'.$output.'Y';
|
||||
@ -364,7 +364,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
||||
}
|
||||
|
||||
if (empty($unused)) print "No string not used found.\n";
|
||||
else
|
||||
else
|
||||
{
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
|
||||
@ -303,6 +303,8 @@ foreach($filesToProcess as $fileToProcess)
|
||||
|
||||
// ----- Process output now -----
|
||||
|
||||
//print "Found primary key = ".$key."\n";
|
||||
|
||||
// Key not in other file
|
||||
if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key))
|
||||
{
|
||||
@ -321,7 +323,7 @@ foreach($filesToProcess as $fileToProcess)
|
||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/',$key) || preg_match('/^FormatHour/',$key)
|
||||
)
|
||||
{
|
||||
//print "Key $key differs so we add it into new secondary language (line: $cnt).\n";
|
||||
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_account = "";
|
||||
$search_label = "";
|
||||
|
||||
@ -46,7 +46,7 @@ if ($cat_id == 0) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -104,7 +104,7 @@ $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($cat_id))
|
||||
if (! empty($cat_id))
|
||||
{
|
||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||
if ($return < 0) {
|
||||
@ -164,4 +164,4 @@ if ($action == 'display' || $action == 'delete') {
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -57,7 +57,7 @@ $rowid=GETPOST('rowid','alpha');
|
||||
$code=GETPOST('code','alpha');
|
||||
|
||||
// Security access
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ $langs->load("salaries");
|
||||
$langs->load("loan");
|
||||
|
||||
// Security check
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ $langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin) || ! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -43,10 +43,10 @@ $id = GETPOST('id', 'int');
|
||||
// List of statut
|
||||
static $tmpstatut2label = array (
|
||||
'0' => 'OpenFiscalYear',
|
||||
'1' => 'CloseFiscalYear'
|
||||
'1' => 'CloseFiscalYear'
|
||||
);
|
||||
$statut2label = array (
|
||||
''
|
||||
''
|
||||
);
|
||||
foreach ( $tmpstatut2label as $key => $val )
|
||||
$statut2label[$key] = $langs->trans($val);
|
||||
@ -69,7 +69,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'add') {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
@ -113,7 +113,7 @@ else if ($action == 'add') {
|
||||
header("Location: ./fiscalyear.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
else if ($action == 'update') {
|
||||
@ -126,7 +126,7 @@ else if ($action == 'update') {
|
||||
$object->statut = GETPOST('statut', 'int');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit();
|
||||
@ -151,7 +151,7 @@ llxHeader("",$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($action == 'create')
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewFiscalYear"));
|
||||
|
||||
@ -184,7 +184,7 @@ if ($action == 'create')
|
||||
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -306,9 +306,9 @@ if ($action == 'create')
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
|
||||
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ if (! empty($user->admin))
|
||||
}
|
||||
|
||||
|
||||
// Param a user $user->rights->accountancy->chartofaccount can access
|
||||
// Param a user $user->rights->accounting->chartofaccount can access
|
||||
foreach ($list as $key)
|
||||
{
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
@ -41,7 +41,7 @@ $rowid=GETPOST('rowid','alpha');
|
||||
$code=GETPOST('code','alpha');
|
||||
|
||||
// Security access
|
||||
if (! empty($user->rights->accountancy->chartofaccount))
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -134,6 +134,7 @@ $elementList = array();
|
||||
'2' => $langs->trans('AccountingJournalType2'),
|
||||
'3' => $langs->trans('AccountingJournalType3'),
|
||||
'4' => $langs->trans('AccountingJournalType4'),
|
||||
'5' => $langs->trans('AccountingJournalType5'),
|
||||
'9' => $langs->trans('AccountingJournalType9')
|
||||
);
|
||||
|
||||
@ -743,4 +744,4 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
|
||||
@ -98,7 +98,7 @@ if (! empty($search_accountancy_code_end)) {
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,13 +17,14 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page to show book-entry
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
@ -38,7 +40,7 @@ if ($user->societe_id > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
$action = GETPOST('action','aZ09');
|
||||
$mode = GETPOST('mode');
|
||||
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
||||
$piece_num = GETPOST("piece_num");
|
||||
|
||||
$mesg = '';
|
||||
@ -53,29 +55,41 @@ $label_operation= GETPOST('label_operation');
|
||||
$debit = price2num(GETPOST('debit'));
|
||||
$credit = price2num(GETPOST('credit'));
|
||||
|
||||
$save = GETPOST('save');
|
||||
if (! empty($save)) {
|
||||
$action = 'add';
|
||||
}
|
||||
$update = GETPOST('update');
|
||||
if (! empty($update)) {
|
||||
$action = 'confirm_update';
|
||||
}
|
||||
$save = GETPOST('save','alpha');
|
||||
if (! empty($save)) $action = 'add';
|
||||
$update = GETPOST('update','alpha');
|
||||
if (! empty($update)) $action = 'confirm_update';
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == "confirm_update") {
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action='update';
|
||||
}
|
||||
if (empty($account_number) || $account_number == '-1')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action='update';
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $error)
|
||||
{
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id, null, $mode);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
$book->numero_compte = $account_number;
|
||||
@ -98,7 +112,14 @@ if ($action == "confirm_update") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -108,12 +129,20 @@ if ($action == "confirm_update") {
|
||||
else if ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$error ++;
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
if (empty($account_number) || $account_number == '-1')
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $error) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->numero_compte = $account_number;
|
||||
@ -144,7 +173,14 @@ else if ($action == "add") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -172,6 +208,11 @@ else if ($action == "confirm_create") {
|
||||
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||
$action='create';
|
||||
$error++;
|
||||
}
|
||||
if (! GETPOST('next_num_mvt'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
||||
@ -196,7 +237,10 @@ else if ($action == "confirm_create") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = 'update';
|
||||
$id=$book->id;
|
||||
$piece_num = $book->piece_num;
|
||||
@ -210,39 +254,43 @@ if ($action == 'setdate') {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setjournal') {
|
||||
$journaldoc = trim(GETPOST('code_journal'));
|
||||
if (!empty($journaldoc)) {
|
||||
$journaldoc='\''.$journaldoc.'\'';
|
||||
}
|
||||
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdocref') {
|
||||
$refdoc = trim(GETPOST('doc_ref'));
|
||||
if (!empty($refdoc)) {
|
||||
$refdoc='\''.$refdoc.'\'';
|
||||
}
|
||||
$result = $object->updateByMvt(doc_ref,'code_journal',$refdoc,$mode);
|
||||
$result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Validate transaction
|
||||
if ($action == 'valid') {
|
||||
$result = $object->transformTransaction(0,$piece_num);
|
||||
if ($result < 0) {
|
||||
@ -253,14 +301,17 @@ if ($action == 'valid') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader();
|
||||
|
||||
$html = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$accountjournal = new AccountingJournal($db);
|
||||
|
||||
llxHeader('', $langs->trans("CreateMvts"));
|
||||
|
||||
// Confirmation to delete the command
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||
@ -300,7 +351,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
|
||||
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,0,array(),1,1) . '</td>';
|
||||
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,1,array(),1,1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
@ -328,29 +379,45 @@ if ($action == 'create') {
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! empty($book->piece_num)) {
|
||||
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
|
||||
$backlink = '<a href="list.php">' . $langs->trans('BackToList') . '</a>';
|
||||
|
||||
dol_fiche_head();
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||
|
||||
$head=array();
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("Transaction");
|
||||
$head[$h][2] = 'transaction';
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head, 'transaction', '', -1);
|
||||
|
||||
|
||||
//dol_banner_tab($book, '', $backlink);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// account movement
|
||||
print '<tr class="pair">';
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $book->piece_num . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// date
|
||||
print '<tr class="impair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Docdate');
|
||||
print '</td>';
|
||||
if ($action != 'editdate')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate') {
|
||||
@ -361,18 +428,18 @@ if ($action == 'create') {
|
||||
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||
} else {
|
||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//journal
|
||||
print '<tr class="pair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Codejournal');
|
||||
print '</td>';
|
||||
if ($action != 'editjournal')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editjournal') {
|
||||
@ -389,12 +456,12 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//docref
|
||||
print '<tr class="impair"><td>';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Docref');
|
||||
print '</td>';
|
||||
if ($action != 'editdocref')
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdocref') {
|
||||
@ -410,21 +477,25 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
//doctype
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Doc type
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Validate
|
||||
print '<tr class="pair">';
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||
print '<td>';
|
||||
if (empty($book->validated)) {
|
||||
@ -438,10 +509,12 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// check data
|
||||
print '<tr class="impair">';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
if ($book->doc_type == 'customer_invoice')
|
||||
{
|
||||
$sqlmid = 'SELECT rowid as ref';
|
||||
@ -457,14 +530,19 @@ if ($action == 'create') {
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
print '<td>' . $ref .'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($book->error, $book->errors, 'errors');
|
||||
@ -490,11 +568,11 @@ if ($action == 'create') {
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||
print_liste_field_titre($langs->trans("Subledger_account"));
|
||||
print_liste_field_titre($langs->trans("SubledgerAccount"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Labeloperation"));
|
||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
||||
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"');
|
||||
print_liste_field_titre($langs->trans("Label"));
|
||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
|
||||
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
|
||||
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
||||
|
||||
print "</tr>\n";
|
||||
@ -506,15 +584,24 @@ if ($action == 'create') {
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
|
||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
||||
@ -528,10 +615,14 @@ if ($action == 'create') {
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print '</a> ';
|
||||
|
||||
$actiontodelete='detele';
|
||||
if ($mode == '_tmp') $actiontodelete='confirm_delete';
|
||||
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action='.$actiontodelete.'&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
print img_delete();
|
||||
|
||||
print '</a>';
|
||||
@ -548,22 +639,46 @@ if ($action == 'create') {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="subledger_account" value="">';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
|
||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
if ($mode=='_tmp' && $total_debit == $total_credit && $action=='') {
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
|
||||
|
||||
if ($mode=='_tmp' && $action=='')
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit)
|
||||
{
|
||||
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||
}
|
||||
|
||||
print ' ';
|
||||
print '<a class="button" href="' . DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,7 +16,6 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -112,7 +111,7 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_mvt_num = '';
|
||||
$search_doc_type = '';
|
||||
@ -377,33 +376,51 @@ print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From');
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to');
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
@ -437,7 +454,10 @@ print "</tr>\n";
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ($object->lines as $line ) {
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
@ -463,6 +483,8 @@ foreach ($object->lines as $line ) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
|
||||
@ -92,7 +92,7 @@ if (! empty($search_doc_date)) {
|
||||
}
|
||||
|
||||
|
||||
if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (! GETPOST('button_removefilter_x','alpha') && ! GETPOST('button_removefilter.x','alpha') && ! GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||
@ -121,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
@ -160,7 +160,6 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By"
|
||||
llxHeader('', $title_page);
|
||||
|
||||
// List
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||
@ -173,7 +172,9 @@ $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $f
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$nbtotalofrecords = $result;
|
||||
|
||||
$num=count($object->lines);
|
||||
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||
@ -204,7 +205,7 @@ if ($action == 'delbookkeepingyear') {
|
||||
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
|
||||
@ -236,7 +237,7 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
|
||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre" align="right" colspan="2">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
@ -250,7 +251,7 @@ print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_re
|
||||
print_liste_field_titre($langs->trans("Label"));
|
||||
print_liste_field_titre($langs->trans("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("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -263,7 +264,10 @@ $sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||
|
||||
foreach ( $object->lines as $line ) {
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
@ -323,10 +327,11 @@ foreach ( $object->lines as $line ) {
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
// Comptabilise le sous-total
|
||||
$sous_total_debit += $line->debit;
|
||||
$sous_total_credit += $line->credit;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
||||
|
||||
@ -86,7 +86,7 @@ $offset = $limit * $page;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_type = "";
|
||||
$search_doc_date = "";
|
||||
|
||||
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
331
htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||
|
||||
$search_year = GETPOST ( "search_year" );
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
// if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$BookKeeping = new lettering($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||
|
||||
// var_dump($result);
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $BookKeeping->LettrageTiers($socid);
|
||||
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
llxHeader ( '', 'Compta - Grand Livre' );
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||
|
||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||
$object->next_prev_filter="te.fournisseur = 1";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">'.$langs->trans("CustomerCode"). '</td><td colspan="3">';
|
||||
print $object->code_client;
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$langs->load('compta');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
||||
print '</td><td colspan="3">';
|
||||
print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
//$img=picto_from_langcode($object->country_code);
|
||||
$img='';
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
||||
|
||||
|
||||
|
||||
if (dol_strlen ( $search_year )) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||
}
|
||||
|
||||
|
||||
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||
|
||||
// echo $sql;
|
||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="lettering">';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td></td>';
|
||||
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
|
||||
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
|
||||
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
|
||||
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
|
||||
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="" method="GET">';
|
||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
// print '<td> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</form>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
|
||||
if($tmp !=$obj->lettering_code || empty($tmp) )
|
||||
$tmp =$obj->lettering_code;
|
||||
|
||||
if($tmp !=$obj->lettering_code || empty($obj->lettering_code))
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$debit+= $obj->debit;
|
||||
$credit+= $obj->credit;
|
||||
|
||||
$solde+=($obj->credit-$obj->debit);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . $obj->rowid . '</td>';
|
||||
if(empty($obj->lettering_code)){
|
||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit ();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
else
|
||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||
|
||||
|
||||
|
||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
// print '<td>' . $obj->numero_compte . '</td>';
|
||||
// print '<td>' . $obj->code_tiers . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td>' . $obj->debit . '</td>';
|
||||
print '<td>' . $obj->credit . '</td>';
|
||||
// print '<td>' . $obj->montant . '</td>';
|
||||
// print '<td>' . $obj->sens . '</td>';
|
||||
print '<td>' . $obj->code_journal . '</td>';
|
||||
print '<td>' . round($solde, 2) . '</td>';
|
||||
|
||||
if(empty($obj->lettering_code)){
|
||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||
}
|
||||
else
|
||||
print '<td>' . $obj->lettering_code . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||
print '<td></td>';
|
||||
// print '<td></td>';
|
||||
// print '<td></td>';
|
||||
print '<td><strong>' . $debit . '</strong></td>';
|
||||
print '<td><strong>' . $credit . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||
// print '<td></td>';
|
||||
// print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering">';
|
||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||
print "</form>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
335
htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
Normal file
@ -0,0 +1,335 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Tab to setup lettering
|
||||
*/
|
||||
|
||||
// Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
||||
|
||||
$search_year = GETPOST ( "search_year" );
|
||||
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
// if ($user->societe_id) $socid=$user->societe_id;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
$form = new Form($db);
|
||||
$BookKeeping = new lettering($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
||||
|
||||
// var_dump($result);
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'autolettrage') {
|
||||
|
||||
$result = $BookKeeping->LettrageTiers($socid);
|
||||
|
||||
if( $result < 0 ){
|
||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
$error++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
llxHeader ( '', 'Compta - Grand Livre' );
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
||||
|
||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||
$object->next_prev_filter="te.fournisseur = 1";
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">'.$langs->trans("SupplierCode"). '</td><td colspan="3">';
|
||||
print $object->code_fournisseur;
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$langs->load('compta');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
||||
print '</td><td colspan="3">';
|
||||
print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
//$img=picto_from_langcode($object->country_code);
|
||||
$img='';
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// print_r($soc);
|
||||
// exit;
|
||||
// [code_compta] => 411DOUA
|
||||
// [code_compta_fournisseur] => 401SUPPCODE
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
||||
|
||||
|
||||
|
||||
if (dol_strlen ( $search_year )) {
|
||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
||||
}
|
||||
|
||||
|
||||
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
||||
|
||||
// echo $sql;
|
||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="lettering">';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td></td>';
|
||||
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
|
||||
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
|
||||
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
|
||||
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
|
||||
print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
|
||||
print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
|
||||
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="" method="GET">';
|
||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</form>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
|
||||
if($tmp !=$obj->lettering || empty($tmp) )
|
||||
$tmp =$obj->lettering;
|
||||
|
||||
if($tmp !=$obj->lettering || empty($obj->lettering))
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$debit+= $obj->debit;
|
||||
$credit+= $obj->credit;
|
||||
|
||||
$solde+=($obj->credit-$obj->debit);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . $obj->rowid . '</td>';
|
||||
if(empty($obj->lettering)){
|
||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit ();
|
||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||
}
|
||||
else
|
||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
||||
|
||||
|
||||
|
||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
// print '<td>' . $obj->numero_compte . '</td>';
|
||||
// print '<td>' . $obj->code_tiers . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td>' . $obj->debit . '</td>';
|
||||
print '<td>' . $obj->credit . '</td>';
|
||||
print '<td>' . $obj->montant . '</td>';
|
||||
print '<td>' . $obj->sens . '</td>';
|
||||
print '<td>' . $obj->code_journal . '</td>';
|
||||
print '<td>' . round($solde, 2) . '</td>';
|
||||
|
||||
if(empty($obj->lettering)){
|
||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
||||
}
|
||||
else
|
||||
print '<td>' . $obj->lettering . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . $debit . '</strong></td>';
|
||||
print '<td><strong>' . $credit . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<input class="butAction" type="submit" value="lettering">';
|
||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
||||
print "</form>";
|
||||
$db->free ( $resql );
|
||||
} else {
|
||||
dol_print_error ( $db );
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -539,8 +539,9 @@ class AccountancyCategory
|
||||
/**
|
||||
* get cpts of category
|
||||
*
|
||||
* @param int $cat_id Category id
|
||||
* @return array Result in table
|
||||
* @param int $cat_id Id accounting account category
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCptsCat($cat_id) {
|
||||
global $mysoc;
|
||||
|
||||
@ -177,7 +177,7 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->credit)) $this->credit = 0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->numero_compte) || $this->numero_compte == '-1')
|
||||
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
|
||||
{
|
||||
$langs->load("errors");
|
||||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||
@ -433,6 +433,9 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->debit)) $this->debit = 0;
|
||||
if (empty($this->credit)) $this->credit = 0;
|
||||
|
||||
$this->debit = price2num($this->debit, 'MT');
|
||||
$this->credit = price2num($this->credit, 'MT');
|
||||
|
||||
$now = dol_now();
|
||||
if (empty($this->date_create)) {
|
||||
$this->date_create = $now;
|
||||
@ -616,6 +619,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
@ -806,7 +810,7 @@ class BookKeeping extends CommonObject
|
||||
if (! empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array ();
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1005,6 +1009,9 @@ class BookKeeping extends CommonObject
|
||||
$this->piece_num = trim($this->piece_num);
|
||||
}
|
||||
|
||||
$this->debit = price2num($this->debit, 'MT');
|
||||
$this->credit = price2num($this->credit, 'MT');
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
@ -1075,9 +1082,10 @@ class BookKeeping extends CommonObject
|
||||
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
||||
$this->db->begin();
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
||||
$sql .= ' SET ab.' . $field . '=' . $value;
|
||||
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
||||
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
@ -1100,7 +1108,6 @@ class BookKeeping extends CommonObject
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @param string $mode Mode
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false, $mode='') {
|
||||
@ -1260,7 +1267,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Accountingbookkeeping($this->db);
|
||||
$object = new BookKeeping($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1583,6 +1590,7 @@ class BookKeeping extends CommonObject
|
||||
$this->db->rollback();
|
||||
return - 1;
|
||||
}
|
||||
/*
|
||||
$sql = "DELETE FROM ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
@ -1591,6 +1599,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1768,4 +1777,4 @@ class BookKeepingLine
|
||||
public $code_journal;
|
||||
public $journal_label;
|
||||
public $piece_num;
|
||||
}
|
||||
}
|
||||
|
||||
330
htdocs/accountancy/class/lettering.class.php
Normal file
330
htdocs/accountancy/class/lettering.class.php
Normal file
@ -0,0 +1,330 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accountancy/class/bookkeeping.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class for lettering
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||
|
||||
|
||||
/**
|
||||
* Class lettering
|
||||
*/
|
||||
class lettering extends BookKeeping
|
||||
{
|
||||
/**
|
||||
* lettrageTiers
|
||||
*
|
||||
* @param int $socid Thirdparty id
|
||||
* @return void
|
||||
*/
|
||||
public function lettrageTiers($socid) {
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
$object = new Societe($this->db);
|
||||
$object->id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
|
||||
if( $object->code_compta == '411CUSTCODE')
|
||||
$object->code_compta = '';
|
||||
|
||||
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
||||
$object->code_compta_fournisseur = '';
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
||||
|
||||
$sql .= " GROUP BY bk.lettering_code ";
|
||||
|
||||
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
$i++;
|
||||
|
||||
$sql = "SELECT bk.rowid ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
// echo $sql;
|
||||
$resql2 = $db->query ( $sql );
|
||||
if ($resql2) {
|
||||
$num2 = $db->num_rows ( $resql2 );
|
||||
$i2 = 0;
|
||||
$ids = array();
|
||||
while ( $i2 < $num2 ) {
|
||||
$obj2 = $db->fetch_object ( $resql2 );
|
||||
$i2++;
|
||||
$ids[] = $obj2->rowid;
|
||||
}
|
||||
|
||||
|
||||
if(count($ids) > 1 ){
|
||||
$result = $this->updatelettrage($ids);
|
||||
|
||||
// var_dump($result);
|
||||
// if( $result < 0 ){
|
||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
// $error++;
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prise en charge des lettering complexe avec prelevment , virement
|
||||
*/
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
|
||||
$sql .= " ) AND date_lettering ='' ";
|
||||
$sql .= " GROUP BY bk.lettering_code ";
|
||||
|
||||
// echo $sql;
|
||||
//
|
||||
$resql = $db->query ( $sql );
|
||||
if ($resql) {
|
||||
$num = $db->num_rows ( $resql );
|
||||
$i = 0;
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object ( $resql );
|
||||
$ids = array();
|
||||
$i++;
|
||||
|
||||
// print_r($obj);
|
||||
|
||||
|
||||
|
||||
if($obj->type =='payment_supplier' ) {
|
||||
$ids[] = $obj->rowid;
|
||||
|
||||
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
||||
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
||||
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
||||
$sql .= " WHERE 1 ";
|
||||
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
||||
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
// echo $sql;
|
||||
// exit;
|
||||
}
|
||||
elseif($obj->type =='payment' ){
|
||||
$ids[] = $obj->rowid;
|
||||
|
||||
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
||||
$sql .= " WHERE 1 ";
|
||||
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
||||
$sql .= " AND ( ";
|
||||
if(!empty($object->code_compta) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
||||
$sql .= " OR ";
|
||||
if(!empty($object->code_compta_fournisseur) )
|
||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
||||
$sql .= " ) ";
|
||||
|
||||
// echo $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$resql2 = $db->query ( $sql );
|
||||
if ($resql2) {
|
||||
$num2 = $db->num_rows ( $resql2 );
|
||||
$i2 = 0;
|
||||
|
||||
while ( $i2 < $num2 ) {
|
||||
$obj2 = $db->fetch_object ( $resql2 );
|
||||
$i2++;
|
||||
$ids[] = $obj2->rowid;
|
||||
}
|
||||
|
||||
// print_r($ids);
|
||||
// exit;
|
||||
if(count($ids) > 1 ){
|
||||
$result = $this->updatelettrage($ids);
|
||||
|
||||
// var_dump($result);
|
||||
// if( $result < 0 ){
|
||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
||||
// $error++;
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
// exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updatelettrage($ids, $notrigger=false){
|
||||
$error = 0;
|
||||
|
||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
||||
// echo $sql;
|
||||
$result = $this->db->query ( $sql );
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object ( $result );
|
||||
$lettre = (empty($obj->lettering_code)? 'AAA' : $obj->lettering_code );
|
||||
if(!empty($obj->lettering_code))
|
||||
$lettre++;
|
||||
}
|
||||
else{
|
||||
$this->errors[] = 'Error'.$this->db->lasterror();;
|
||||
$error++;
|
||||
}
|
||||
// var_dump(__line__, $error);
|
||||
|
||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||
$sql .= " rowid IN (".implode(',', $ids).") ";
|
||||
$result = $this->db->query ( $sql );
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object ( $result );
|
||||
// print_r($obj);
|
||||
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
||||
// echo $sql;
|
||||
// print_r($obj);
|
||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Update request
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
$sql.= " lettering_code='".$lettre."'";
|
||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
||||
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
||||
// echo $sql ;
|
||||
//
|
||||
// var_dump(__line__, $error);
|
||||
// print_r($this->errors);
|
||||
// exit;
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
// var_dump(__line__, $error);
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
// foreach($this->errors as $errmsg)
|
||||
// {
|
||||
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
// }
|
||||
$this->db->rollback();
|
||||
// echo $this->error;
|
||||
// var_dump(__line__, $error);
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card customer ventilation
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -47,11 +47,11 @@ if ($user->societe_id > 0)
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
if ($codeventil < 0) $codeventil = 0;
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer journalization page
|
||||
* \brief Home customer journalization page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -363,7 +363,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -85,7 +85,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -153,7 +153,7 @@ print '<script type="text/javascript">
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||
$sql .= " 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";
|
||||
@ -270,9 +270,9 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -287,9 +287,9 @@ if ($result) {
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("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, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
$clickpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
||||
@ -332,14 +332,14 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td>';
|
||||
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
print '<td align="center">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td>' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->country .'</td>';
|
||||
|
||||
print '<td>' . $objp->tva_intra . '</td>';
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -179,7 +179,7 @@ llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
@ -189,7 +189,8 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accounta
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND product_type <= 2";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||
// Add search filter like
|
||||
if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
@ -387,7 +388,7 @@ if ($result) {
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card expense report ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
@ -56,7 +56,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -82,7 +82,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
@ -146,7 +146,7 @@ print '<script type="text/javascript">
|
||||
* Expense reports lines
|
||||
*/
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||
$sql .= " aa.label, aa.account_number,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
@ -241,8 +241,8 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
@ -258,7 +258,7 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
$checkpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -293,7 +293,7 @@ if ($result) {
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
|
||||
print '<td>' . $codeCompta . '</td>';
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
@ -174,7 +174,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
|
||||
// Expense report lines
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
@ -284,8 +284,8 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
@ -333,7 +333,7 @@ if ($result) {
|
||||
|
||||
// Vat rate
|
||||
print '<td align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -36,12 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("trips");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -53,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -90,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||
@ -105,26 +101,31 @@ $sql .= " AND erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
$sql .= " ORDER BY er.date_debut";
|
||||
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$taber = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabuser = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -135,6 +136,8 @@ if ($result) {
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
@ -146,9 +149,19 @@ if ($result) {
|
||||
$taber[$obj->rowid]["ref"] = $obj->ref;
|
||||
$taber[$obj->rowid]["comments"] = $obj->comments;
|
||||
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
||||
|
||||
// Avoid warnings
|
||||
if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabuser[$obj->rowid] = array (
|
||||
'id' => $obj->uid,
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
@ -166,7 +179,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($taber as $key => $val)
|
||||
foreach ($taber as $key => $val) // Loop on each expense report
|
||||
{
|
||||
$errorforline = 0;
|
||||
|
||||
@ -177,7 +190,6 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -187,8 +199,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||
@ -203,7 +215,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,8 +232,6 @@ if ($action == 'writebookkeeping') {
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -235,8 +245,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -251,7 +261,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -268,9 +278,15 @@ if ($action == 'writebookkeeping') {
|
||||
// VAT
|
||||
if (! $errorforline)
|
||||
{
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@ -281,8 +297,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -297,7 +313,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -306,6 +322,7 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,7 +343,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error) && count($tabpay)) {
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
@ -339,6 +356,21 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -350,7 +382,7 @@ $form = new Form($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
/*if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
@ -469,26 +501,32 @@ if (empty($action) || $action == 'view') {
|
||||
$builddate = time();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
@ -510,7 +548,8 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td></td>";
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("Account") . "</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
@ -540,6 +579,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -547,7 +587,10 @@ if (empty($action) || $action == 'view') {
|
||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||
@ -557,28 +600,6 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
@ -587,19 +608,63 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->name = $tabuser[$key]['name'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -36,11 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -52,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -89,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||
@ -109,26 +106,30 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
}
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -139,9 +140,9 @@ if ($result) {
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
@ -167,10 +168,14 @@ if ($result) {
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -189,8 +194,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($tabfac as $key => $val) // Loop on each invoice
|
||||
{
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -198,12 +202,6 @@ if ($action == 'writebookkeeping') {
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
@ -212,6 +210,12 @@ if ($action == 'writebookkeeping') {
|
||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = (string) $val["refsologest"];
|
||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||
|
||||
// Thirdparty
|
||||
if (! $errorforline)
|
||||
{
|
||||
@ -228,8 +232,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account");
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||
@ -244,7 +248,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,8 +265,6 @@ if ($action == 'writebookkeeping') {
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -274,12 +276,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -294,7 +296,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -312,9 +314,15 @@ if ($action == 'writebookkeeping') {
|
||||
// var_dump($tabtva);
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
@ -326,8 +334,8 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -342,7 +350,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -354,6 +362,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
{
|
||||
@ -371,7 +380,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error) && count($tabpay)) {
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
}
|
||||
elseif (count($tabpay) == $error)
|
||||
@ -382,7 +391,23 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -391,30 +416,47 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv') {
|
||||
if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val )
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->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));
|
||||
$invoicestatic->description = dol_trunc($val["description"], 32);
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
@ -432,12 +474,18 @@ if ($action == 'export_csv') {
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
@ -446,35 +494,17 @@ if ($action == 'export_csv') {
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print '"' . $journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
@ -485,7 +515,6 @@ if (empty($action) || $action == 'view') {
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
//$description = $langs->trans("DescPurchasesJournal") . '<br>';
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
@ -493,18 +522,13 @@ if (empty($action) || $action == 'view') {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
@ -523,7 +547,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
@ -546,7 +570,8 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("Type") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
@ -554,19 +579,52 @@ if (empty($action) || $action == 'view') {
|
||||
$r = '';
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Fournisseur($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
|
||||
$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($val["date"], 'day');
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -577,6 +635,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td><!-- Product --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -585,10 +644,12 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</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>";
|
||||
@ -596,50 +657,37 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- Thirdparty --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
||||
// print "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with sells journal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
@ -38,15 +39,10 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
$langs->load("commercial");
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
$date_startmonth = GETPOST('date_startmonth');
|
||||
$date_startday = GETPOST('date_startday');
|
||||
@ -55,6 +51,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -93,7 +90,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
//$sql .= " ct.accountancy_code_sell as account_tva";
|
||||
@ -114,8 +111,10 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )";
|
||||
if ($in_bookkeeping == 'already')
|
||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
@ -126,13 +125,15 @@ if ($result) {
|
||||
$tabtva = array ();
|
||||
$def_tva = array ();
|
||||
$tabttc = array ();
|
||||
$tablocaltax1 = array ();
|
||||
$tablocaltax2 = array ();
|
||||
$tabcompany = array ();
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
@ -144,13 +145,15 @@ if ($result) {
|
||||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
}
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
@ -185,10 +188,14 @@ if ($result) {
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -207,7 +214,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ( $tabfac as $key => $val ) { // Loop on each invoice
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
|
||||
@ -244,7 +251,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account");
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
@ -259,7 +266,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -287,7 +294,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@ -307,7 +314,7 @@ if ($action == 'writebookkeeping') {
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,42 +332,50 @@ if ($action == 'writebookkeeping') {
|
||||
// var_dump($tabtva);
|
||||
if (! $errorforline)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$listoftax=array(0, 1, 2);
|
||||
foreach($listoftax as $numtax)
|
||||
{
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -397,6 +412,21 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
$action='';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
$param='id_journal='.$id_journal;
|
||||
$param.='&date_startday='.$date_startday;
|
||||
$param.='&date_startmonth='.$date_startmonth;
|
||||
$param.='&date_startyear='.$date_startyear;
|
||||
$param.='&date_endday='.$date_endday;
|
||||
$param.='&date_endmonth='.$date_endmonth;
|
||||
$param.='&date_endyear='.$date_endyear;
|
||||
$param.='&in_bookeeping='.$in_bookeeping;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -408,89 +438,92 @@ if ($action == 'writebookkeeping') {
|
||||
$form = new Form($db);
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv') {
|
||||
if ($action == 'exportcsv') {
|
||||
|
||||
$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);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
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"];
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode (dol_trunc($companystatic->name, 16) ) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key]. '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -503,13 +536,14 @@ if (empty($action) || $action == 'view') {
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
//$description = $langs->trans("DescSellsJournal") . '<br>';
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
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). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -533,7 +567,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
@ -556,6 +590,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Date") . "</td>";
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
@ -581,7 +616,17 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->customer_code = $tabcompany[$key]['code_client'];
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -589,12 +634,10 @@ if (empty($action) || $action == 'view') {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
@ -608,6 +651,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td><!-- Product --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
@ -616,7 +660,11 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// print "<td>" . $accountingaccount->label . "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
@ -625,26 +673,36 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
$arrayofvat = $tabtva;
|
||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||
|
||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td><!-- VAT --></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else print $accountoshow;
|
||||
print "</td>";
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
print "</td>";
|
||||
// print "<td>" . $langs->trans("VAT") . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card supplier ventilation
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card supplier ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ $id = GETPOST('id');
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -97,14 +97,14 @@ if (! empty($id)) {
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
|
||||
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num_lines) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ $formaccounting = new FormAccounting($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -154,7 +154,8 @@ print '<script type="text/javascript">
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql.= " aa.label, aa.account_number, ";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
@ -266,8 +267,8 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -285,10 +286,10 @@ if ($result) {
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
@ -336,7 +337,7 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||
print '<td align="left">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
|
||||
@ -100,7 +100,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
@ -181,7 +181,7 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, ";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql.= " aa.rowid as aarowid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
@ -191,7 +191,8 @@ $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountan
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql.= " AND product_type <= 2";
|
||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
||||
// Add search filter like
|
||||
if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
@ -393,7 +394,7 @@ if ($result) {
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||
print price($objp->tva_tx_line);
|
||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
|
||||
@ -151,7 +151,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
|
||||
@ -101,7 +101,7 @@ else
|
||||
|
||||
$head = member_stats_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
|
||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
|
||||
|
||||
|
||||
// Print title
|
||||
|
||||
@ -198,7 +198,7 @@ if ($mode)
|
||||
|
||||
$head = member_stats_prepare_head($adh);
|
||||
|
||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
|
||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
|
||||
|
||||
|
||||
// Print title
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
@ -788,7 +789,7 @@ if ($rowid > 0)
|
||||
$sql.= " c.datef,";
|
||||
$sql.= " c.fk_bank,";
|
||||
$sql.= " b.rowid as bid,";
|
||||
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.accountancy_journal, ba.number";
|
||||
$sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
@ -837,7 +838,12 @@ if ($rowid > 0)
|
||||
$accountstatic->id=$objp->baid;
|
||||
$accountstatic->number=$objp->number;
|
||||
$accountstatic->account_number=$objp->account_number;
|
||||
$accountstatic->accountancy_journal=$objp->accountancy_journal;
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objp->fk_accountancy_journal);
|
||||
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
|
||||
$accountstatic->ref=$objp->ref;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
|
||||
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$object->fk_bank."\">";
|
||||
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
@ -199,7 +199,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
@ -248,15 +248,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
print "\n";
|
||||
}
|
||||
@ -274,7 +274,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete')
|
||||
@ -292,13 +292,13 @@ if ($rowid && $action != 'edit')
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
@ -349,7 +349,7 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -379,11 +379,11 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
// Documents generes
|
||||
/*
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
@ -391,18 +391,18 @@ if ($rowid && $action != 'edit')
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
$genallowed = $user->rights->facture->creer;
|
||||
$delallowed = $user->rights->facture->supprimer;
|
||||
|
||||
|
||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
*/
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
|
||||
// Link for paypal payment
|
||||
/*
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
@ -411,15 +411,15 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
*/
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -53,7 +53,17 @@ $result = $object->fetch($rowid);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment');
|
||||
dol_fiche_head($head, 'info', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$object->info($rowid);
|
||||
|
||||
@ -64,5 +74,7 @@ print '</td></tr></table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -88,7 +88,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
|
||||
@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lastname="";
|
||||
$search_login="";
|
||||
@ -347,8 +347,9 @@ if ($rowid > 0)
|
||||
|
||||
|
||||
/*
|
||||
* Hotbar
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
@ -482,18 +483,8 @@ if ($rowid > 0)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
|
||||
@ -516,6 +507,16 @@ if ($rowid > 0)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@ -645,9 +646,9 @@ if ($rowid > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("subscription",$object->subscription,1);
|
||||
|
||||
@ -385,7 +385,7 @@ print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_list'=>$langs->trans("ViewList"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
@ -174,8 +174,8 @@ $message.='<br>';
|
||||
print $message;
|
||||
|
||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$defaulturl='';
|
||||
$defaultkey='';
|
||||
|
||||
@ -249,7 +249,7 @@ $tabfield[6] = "code,libelle,type,color,position";
|
||||
$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
|
||||
$tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||
$tabfield[9] = "code,label,unicode";
|
||||
$tabfield[10]= "country_id,country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[11]= "element,source,code,libelle,position";
|
||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfield[13]= "code,libelle,type,accountancy_code";
|
||||
@ -286,7 +286,7 @@ $tabfieldvalue[6] = "code,libelle,type,color,position";
|
||||
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
|
||||
$tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||
$tabfieldvalue[9] = "code,label,unicode";
|
||||
$tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[11]= "element,source,code,libelle,position";
|
||||
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
|
||||
@ -323,7 +323,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position";
|
||||
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
|
||||
$tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
|
||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||
$tabfieldinsert[10]= "fk_pays,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[11]= "element,source,code,libelle,position";
|
||||
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
|
||||
@ -1752,8 +1752,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
{
|
||||
$type = (! empty($obj->type)?$obj->type:'user'); // Check if type is different of 'user' (external module)
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print $type.'<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
|
||||
@ -676,6 +676,8 @@ else
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@ -714,7 +716,7 @@ else
|
||||
|
||||
print $formmail->get_form('addfile','removefile');
|
||||
|
||||
print '<br>';
|
||||
dol_fiche_end();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_label='';
|
||||
$toselect='';
|
||||
|
||||
@ -100,7 +100,7 @@ elseif ($action == 'update_currency')
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = GETPOST('rate', 'float');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
@ -178,7 +178,7 @@ print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").'</td>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
|
||||
@ -55,7 +55,7 @@ if ($action == 'setvalue' && $user->admin)
|
||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (! $error && is_array($_POST))
|
||||
{
|
||||
//var_dump($_POST);
|
||||
foreach($_POST as $key => $val)
|
||||
@ -172,7 +172,7 @@ $var=true;
|
||||
$i=0;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
|
||||
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
|
||||
@ -183,7 +183,7 @@ foreach($listofnotifiedevents as $notifiedevent)
|
||||
|
||||
if ($i) print ', ';
|
||||
print $label;
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -213,7 +213,7 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
$var=true;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
|
||||
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
|
||||
|
||||
@ -116,7 +116,7 @@ print load_fiche_titre($langs->trans("Backup"),'','title_setup');
|
||||
print '<div class="center">';
|
||||
print $langs->trans("BackupDesc",DOL_DATA_ROOT);
|
||||
print '</div>';
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ print load_fiche_titre($langs->trans("Restore"),'','title_setup');
|
||||
print '<div class="center">';
|
||||
print $langs->trans("RestoreDesc",DOL_DATA_ROOT);
|
||||
print '</div>';
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
?>
|
||||
<fieldset>
|
||||
@ -156,7 +156,7 @@ if (in_array($type, array('mysql', 'mysqli')))
|
||||
print '<br>';
|
||||
print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand",$command,($showpass?$paramclear:$paramcrypted)).'</textarea><br>';
|
||||
print ajax_autoselect('restorecommand');
|
||||
|
||||
|
||||
if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
|
||||
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
|
||||
?>
|
||||
|
||||
@ -100,7 +100,7 @@ $date_endyear = $tmp['year'];
|
||||
$now=dol_now();
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$date_start=-1;
|
||||
$date_end=-1;
|
||||
|
||||
@ -31,7 +31,7 @@ if (! $user->admin)
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$choice=GETPOST('choice');
|
||||
$choice=GETPOST('choice','aZ09');
|
||||
|
||||
|
||||
// Define filelog to discard it from purge
|
||||
|
||||
@ -74,7 +74,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$transkey='';
|
||||
$transvalue='';
|
||||
|
||||
@ -27,6 +27,10 @@ $langs->load("admin");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$sortfield='file';
|
||||
$sortorder='ASC';
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
@ -50,20 +54,21 @@ print "<br>\n";
|
||||
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList();
|
||||
$param = ''; $align = '';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder">
|
||||
<tr class="liste_titre">
|
||||
<td colspan="2">'.$langs->trans("File").'</td>
|
||||
<td align="center">'.$langs->trans("Active").'</td>
|
||||
<td align="center"> </td>
|
||||
</tr>
|
||||
';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print getTitleFieldOfList($langs->trans("File"), 0, $_SERVER["PHP_SELF"], 'file', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, '', $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList($langs->trans("Active"), 0, $_SERVER["PHP_SELF"], 'active', "", $param, 'align="center"', $sortfield, $sortorder, '', 1)."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], 'none', "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder, '', 1)."\n";
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
foreach ($triggers as $trigger)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td valign="top" width="14" align="center">'.$trigger['picto'].'</td>';
|
||||
print '<td class="tdtop">'.$trigger['file'].'</td>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -25,8 +25,10 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
@ -35,7 +37,6 @@ $langs->load("website");
|
||||
|
||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
$rowid=GETPOST('rowid','alpha');
|
||||
|
||||
$id=1;
|
||||
@ -47,24 +48,21 @@ $acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset');
|
||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
||||
$status = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin'));
|
||||
|
||||
// This page is a generic page to edit dictionaries
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname[1] = MAIN_DB_PREFIX."website";
|
||||
@ -75,7 +73,7 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -83,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[1] = "ref,description";
|
||||
$tabfield[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[1] = "ref,description";
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[1] = "ref,description,entity";
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -105,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp[1] = array();
|
||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -116,8 +114,8 @@ $tabfieldcheck[1] = array();
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||
@ -128,16 +126,29 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (! empty($_POST['ref']))
|
||||
{
|
||||
$websitekey=strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
if ($ok && GETPOST('actionadd','alpha'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
@ -155,6 +166,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
}
|
||||
|
||||
/* $website=new Website($db);
|
||||
$website->ref=
|
||||
$website->description=
|
||||
$website->virtualhost=
|
||||
$website->create($user); */
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
@ -173,6 +190,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
@ -184,8 +204,31 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
global $dolibarr_main_data_root;
|
||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||
$filecss=$pathofwebsite.'/styles.css.php';
|
||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||
$fileindex=$pathofwebsite.'/index.php';
|
||||
|
||||
// Css file
|
||||
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
|
||||
$csscontent.= '<?php '."\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "?>"."\n";
|
||||
$csscontent.= '<!-- END -->'."\n";
|
||||
$csscontent.= 'body { margin: 0; }'."\n";
|
||||
|
||||
dol_syslog("Save file css into ".$filecss);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -199,11 +242,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
if ($ok && GETPOST('actionmodify','alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
$website=new Website($db);
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$website->fetch($rowid);
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
@ -229,7 +276,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
if ($resql)
|
||||
{
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
||||
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
||||
@rename($srcfile, $destfile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
@ -237,7 +294,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel'))
|
||||
if (GETPOST('actioncancel','alpha'))
|
||||
{
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
@ -247,9 +304,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_pages WHERE fk_website ='".$rowid."'";
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
@ -321,12 +378,12 @@ print "<br>\n";
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
/*
|
||||
* Show a dictionary
|
||||
* Show website list
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
@ -350,12 +407,12 @@ if ($id)
|
||||
$sql.=" ORDER BY ";
|
||||
}
|
||||
$sql.=$tabsqlsort[$id];
|
||||
$sql.=$db->plimit($listlimit+1,$offset);
|
||||
$sql.=$db->plimit($limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -381,16 +438,18 @@ if ($id)
|
||||
{
|
||||
print '<td class="'.$align.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||
elseif (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
}
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td colspan="4">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -399,11 +458,11 @@ if ($id)
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
if (GETPOST('actionadd','alpha'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val))
|
||||
if (GETPOST($val,'alpha'))
|
||||
$obj->$val=GETPOST($val);
|
||||
}
|
||||
}
|
||||
@ -434,8 +493,7 @@ if ($id)
|
||||
|
||||
|
||||
|
||||
// List of available values in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
// List of websites in database
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -444,21 +502,13 @@ if ($id)
|
||||
if ($num)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
@ -486,11 +536,11 @@ if ($id)
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':''),"","align=".$align,$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':''),"",'align="center"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
@ -539,7 +589,7 @@ if ($id)
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$isdisable=1; // true by default
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
@ -558,9 +608,9 @@ if ($id)
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,11 +77,11 @@ $workflowcodes=array(
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
// Automatic classification
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>''),
|
||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
);
|
||||
|
||||
|
||||
@ -131,9 +131,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$regmod))
|
||||
{
|
||||
$module = strtolower($reg[1]);
|
||||
$module = strtolower($regmod[1]);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
$moduleforperm = $module;
|
||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||
@ -159,9 +159,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
|
||||
// Support of the deprecated API.
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
{
|
||||
$classname = ucwords($reg[1]).'Api';
|
||||
$classname = ucwords($regapi[1]).'Api';
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
@ -173,9 +173,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
|
||||
{
|
||||
$classname = ucwords($reg[1]);
|
||||
$classname = ucwords($regapi[1]);
|
||||
$classname = str_replace('_', '', $classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
@ -206,7 +206,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
}
|
||||
|
||||
// Call one APIs or one definition of an API
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
|
||||
{
|
||||
$module = $reg[1];
|
||||
if ($module == 'explorer') // If we call page to explore details of a service
|
||||
|
||||
@ -53,11 +53,13 @@ function printBookmarksList($aDb, $aLangs)
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
foreach($_POST as $key => $val)
|
||||
if (is_array($_POST))
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ $action=GETPOST('action','aZ09');
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
@ -82,7 +83,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup')
|
||||
|
||||
$head=categoriesadmin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'setup', $langs->trans("Categories"), 0, 'category');
|
||||
dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category');
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='categories'; //Must be the $element of the class that manage extrafield
|
||||
$elementtype='categorie'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -68,7 +68,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup')
|
||||
|
||||
$head = categoriesadmin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category');
|
||||
dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), -1, 'category');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
|
||||
@ -43,22 +43,23 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
class Categorie extends CommonObject
|
||||
{
|
||||
// Categories types
|
||||
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
|
||||
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
|
||||
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
|
||||
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
|
||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||
const TYPE_PROJECT = 6;
|
||||
const TYPE_PRODUCT = 'product';
|
||||
const TYPE_SUPPLIER = 'supplier';
|
||||
const TYPE_CUSTOMER = 'customer';
|
||||
const TYPE_MEMBER = 'member';
|
||||
const TYPE_CONTACT = 'contact';
|
||||
const TYPE_USER = 'user';
|
||||
const TYPE_PROJECT = 'project';
|
||||
const TYPE_ACCOUNT = 'bank_account';
|
||||
const TYPE_BANK_LINE = 'bank_line';
|
||||
|
||||
public $picto = 'category';
|
||||
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
*
|
||||
* @note This array should be remove in future, once previous constants are moved to the string value.
|
||||
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
||||
*/
|
||||
private $MAP_ID = array(
|
||||
'product' => 0,
|
||||
@ -66,10 +67,21 @@ class Categorie extends CommonObject
|
||||
'customer' => 2,
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
'project' => 6,
|
||||
'user' => 7,
|
||||
);
|
||||
public static $MAP_ID_TO_CODE = array(
|
||||
0 => 'product',
|
||||
1 => 'supplier',
|
||||
2 => 'customer',
|
||||
3 => 'member',
|
||||
4 => 'contact',
|
||||
5 => 'account',
|
||||
6 => 'project',
|
||||
7 => 'user',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array Foreign keys mapping from type string
|
||||
*
|
||||
@ -81,9 +93,9 @@ class Categorie extends CommonObject
|
||||
'supplier' => 'soc',
|
||||
'member' => 'member',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Category tables mapping from type string
|
||||
@ -96,9 +108,9 @@ class Categorie extends CommonObject
|
||||
'supplier' => 'fournisseur',
|
||||
'member' => 'member',
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Object class mapping from type string
|
||||
@ -112,8 +124,8 @@ class Categorie extends CommonObject
|
||||
'member' => 'Adherent',
|
||||
'contact' => 'Contact',
|
||||
'user' => 'User',
|
||||
'account' => 'Account',
|
||||
'project' => 'Project',
|
||||
'account' => 'Account',
|
||||
'project' => 'Project',
|
||||
);
|
||||
/**
|
||||
* @var array Object table mapping from type string
|
||||
@ -127,12 +139,12 @@ class Categorie extends CommonObject
|
||||
'member' => 'adherent',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
);
|
||||
|
||||
public $element='category';
|
||||
public $table_element='categories';
|
||||
public $table_element='categorie';
|
||||
|
||||
public $fk_parent;
|
||||
public $label;
|
||||
@ -447,9 +459,10 @@ class Categorie extends CommonObject
|
||||
* Delete a category from database
|
||||
*
|
||||
* @param User $user Object user that ask to delete
|
||||
* @return int <0 KO >0 OK
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
function delete($user)
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -462,6 +475,14 @@ class Categorie extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
/* FIX #1317 : Check for child category and move up 1 level*/
|
||||
if (! $error)
|
||||
{
|
||||
@ -580,25 +601,16 @@ class Categorie extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
// Removed extrafields
|
||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
// Removed extrafields
|
||||
if (! $error)
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1174,11 +1186,11 @@ class Categorie extends CommonObject
|
||||
*/
|
||||
if($obj[0] > 0 && $obj[0] != $this->id)
|
||||
{
|
||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." exist rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::already_exists category with name=".$this->label." and parent ".$this->fk_parent." exists: rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." rowid=".$obj[0]." current_id=".$this->id, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
@ -39,6 +39,8 @@ $id=GETPOST('id','int');
|
||||
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
||||
$catname=GETPOST('catname','alpha');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -53,8 +55,8 @@ elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCat
|
||||
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
|
||||
@ -42,6 +42,8 @@ $type=GETPOST('type');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
if ($id == "")
|
||||
{
|
||||
dol_print_error('','Missing parameter id');
|
||||
@ -100,15 +102,16 @@ if ($object->id)
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
|
||||
|
||||
dol_fiche_head($head, 'photos', $title, -1, 'category');
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$object->ref = $object->label;
|
||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
@ -117,9 +120,9 @@ if ($object->id)
|
||||
$morehtmlref.=$way."<br>\n";
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression de photo
|
||||
*/
|
||||
@ -129,7 +132,7 @@ if ($object->id)
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -148,7 +151,7 @@ if ($object->id)
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print dol_fiche_end();
|
||||
|
||||
|
||||
@ -258,7 +261,7 @@ if ($object->id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
if ($nbphoto < 1)
|
||||
{
|
||||
print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>";
|
||||
|
||||
@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$langs->load("categories");
|
||||
$langs->load("languages");
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$type=GETPOST('type');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$type = GETPOST('type','aZ09');
|
||||
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||
@ -153,6 +155,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@ -256,9 +259,9 @@ if ($action == 'edit')
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
@ -271,7 +274,7 @@ if ($action == 'edit')
|
||||
else if ($action != 'add')
|
||||
{
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
if (! empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
|
||||
@ -34,15 +34,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("categories");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref');
|
||||
$type=GETPOST('type');
|
||||
$id = GETPOST('id','int');
|
||||
$label= GETPOST('label','alpha');
|
||||
$type = GETPOST('type','az09');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$removeelem = GETPOST('removeelem','int');
|
||||
$elemid=GETPOST('elemid');
|
||||
$elemid = GETPOST('elemid','alpha');
|
||||
|
||||
if ($id == "")
|
||||
if ($id == "" && $label == "")
|
||||
{
|
||||
dol_print_error('','Missing parameter id');
|
||||
exit();
|
||||
@ -52,7 +52,7 @@ if ($id == "")
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
$object = new Categorie($db);
|
||||
$result=$object->fetch($id);
|
||||
$result=$object->fetch($id, $label);
|
||||
$object->fetch_optionals($id,$extralabels);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@ -61,6 +61,7 @@ if ($result <= 0)
|
||||
}
|
||||
|
||||
$type=$object->type;
|
||||
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
@ -187,6 +188,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@ -195,7 +197,7 @@ $head = categories_prepare_head($object,$type);
|
||||
dol_fiche_head($head, 'card', $title, -1, 'category');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$object->next_prev_filter=" type = ".$object->type;
|
||||
$object->ref = $object->label;
|
||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
@ -205,7 +207,7 @@ foreach ($ways as $way)
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -49,7 +49,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
print '<body id="mainbody">';
|
||||
|
||||
|
||||
// top menu and left menu area
|
||||
if (empty($conf->dol_hide_topmenu))
|
||||
{
|
||||
@ -108,7 +108,7 @@ if (empty($action)) $action='preview';
|
||||
*/
|
||||
|
||||
if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid.
|
||||
if (GETPOST('refreshpage')) $action='preview';
|
||||
if (GETPOST('refreshpage')) $action='preview';
|
||||
|
||||
|
||||
// Add a collab page
|
||||
@ -146,7 +146,7 @@ if ($action == 'add')
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
|
||||
$action = 'preview';
|
||||
$id = $objectpage->id;
|
||||
}
|
||||
@ -173,7 +173,7 @@ if ($action == 'delete')
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs');
|
||||
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website);
|
||||
exit;
|
||||
}
|
||||
@ -218,7 +218,7 @@ print '<div class="centpercent websitebar">';
|
||||
if (count($object->records) > 0)
|
||||
{
|
||||
// ***** Part for web sites
|
||||
|
||||
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print $langs->trans("Website").': ';
|
||||
print '</div>';
|
||||
@ -252,20 +252,20 @@ if (count($object->records) > 0)
|
||||
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
|
||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
||||
}
|
||||
|
||||
|
||||
if ($website && $action == 'preview')
|
||||
{
|
||||
$disabled='';
|
||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
||||
|
||||
|
||||
print ' ';
|
||||
|
||||
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
// Button for websites
|
||||
@ -279,7 +279,7 @@ if (count($object->records) > 0)
|
||||
$htmltext=$langs->trans("SetHereVirtualHost", $dataroot);
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</div>';
|
||||
|
||||
|
||||
$urlext=$virtualurl;
|
||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
||||
//if (! empty($object->virtualhost))
|
||||
@ -288,7 +288,7 @@ if (count($object->records) > 0)
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
//}
|
||||
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||
print '</a>';
|
||||
@ -300,12 +300,12 @@ if (count($object->records) > 0)
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// ***** Part for pages
|
||||
|
||||
|
||||
if ($website)
|
||||
{
|
||||
print '</div>';
|
||||
@ -313,13 +313,13 @@ if (count($object->records) > 0)
|
||||
$array=$objectpage->fetchAll($object->id);
|
||||
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
||||
|
||||
|
||||
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print $langs->trans("Page").': ';
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
|
||||
|
||||
if ($action != 'add')
|
||||
{
|
||||
$out='';
|
||||
@ -336,7 +336,7 @@ if (count($object->records) > 0)
|
||||
}
|
||||
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
}
|
||||
|
||||
|
||||
foreach($array as $key => $valpage)
|
||||
{
|
||||
$out.='<option value="'.$key.'"';
|
||||
@ -359,16 +359,16 @@ if (count($object->records) > 0)
|
||||
|
||||
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
//print $form->selectarray('page', $array);
|
||||
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
$disabled='';
|
||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
||||
|
||||
|
||||
if ($pageid > 0)
|
||||
{
|
||||
print ' ';
|
||||
|
||||
|
||||
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
@ -378,7 +378,7 @@ if (count($object->records) > 0)
|
||||
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
print '</div>';
|
||||
@ -389,17 +389,17 @@ if (count($object->records) > 0)
|
||||
{
|
||||
$websitepage = new WebSitePage($db);
|
||||
$websitepage->fetch($pageid);
|
||||
|
||||
|
||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
|
||||
$pagealias = $websitepage->pageurl;
|
||||
|
||||
|
||||
print '<div class="websiteinputurl">';
|
||||
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias);
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (! empty($object->virtualhost))
|
||||
{
|
||||
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
||||
@ -413,12 +413,12 @@ if (count($object->records) > 0)
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
|
||||
print '</a>'; // View page in new Tab
|
||||
//print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';
|
||||
|
||||
|
||||
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
|
||||
}
|
||||
if (! in_array($action, array('editcss','editmenu','create')))
|
||||
@ -427,7 +427,7 @@ if (count($object->records) > 0)
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action == 'preview')
|
||||
@ -454,7 +454,7 @@ if (count($object->records) > 0)
|
||||
},
|
||||
context: document.body
|
||||
});
|
||||
|
||||
|
||||
jQuery("#previewsiteext").attr("href",newurl);
|
||||
jQuery("#previewpageext").attr("href",newpage);
|
||||
});
|
||||
@ -483,15 +483,15 @@ if ($action == 'editcontent')
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
|
||||
|
||||
$contentforedit = '';
|
||||
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||
$contentforedit.=$csscontent;
|
||||
$contentforedit.='</style>'."\n";*/
|
||||
$contentforedit .= $objectpage->content;
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%');
|
||||
$doleditor->Create(0, '', false);
|
||||
|
||||
@ -955,8 +955,15 @@ if ($id > 0)
|
||||
// Type of event
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
||||
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto");
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
|
||||
if ($object->type_code != 'AC_OTH_AUTO')
|
||||
{
|
||||
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto");
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'.$langs->trans("Action".$object->type_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class ActionComm extends CommonObject
|
||||
public $table_rowid = 'id';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto='action';
|
||||
|
||||
|
||||
/**
|
||||
* Id of the event
|
||||
* @var int
|
||||
@ -168,7 +168,7 @@ class ActionComm extends CommonObject
|
||||
var $email_subject;
|
||||
var $errors_to;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -444,7 +444,7 @@ class ActionComm extends CommonObject
|
||||
$u->fetch($fuser);
|
||||
$fuser = $u;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$fuser = $user;
|
||||
}
|
||||
@ -657,11 +657,11 @@ class ActionComm extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources";
|
||||
$sql.= " WHERE fk_actioncomm=".$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$res=$this->db->query($sql);
|
||||
if ($res < 0) {
|
||||
@ -669,7 +669,7 @@ class ActionComm extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Removed extrafields
|
||||
if (! $error) {
|
||||
$result=$this->deleteExtraFields();
|
||||
@ -1091,7 +1091,7 @@ class ActionComm extends CommonObject
|
||||
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
|
||||
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6');
|
||||
}
|
||||
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -1112,20 +1112,20 @@ class ActionComm extends CommonObject
|
||||
global $conf, $langs, $user, $hookmanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
$result='';
|
||||
|
||||
|
||||
// Set label of typ
|
||||
$labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
@ -1137,7 +1137,7 @@ class ActionComm extends CommonObject
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
$linkclose='';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
||||
|
||||
if (empty($notooltip))
|
||||
@ -1149,7 +1149,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
$linkclose.=' class="'.$classname.' classfortooltip"';
|
||||
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
@ -1161,17 +1161,17 @@ class ActionComm extends CommonObject
|
||||
$linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose);
|
||||
}
|
||||
else $linkclose.=' class="'.$classname.'"';
|
||||
|
||||
|
||||
$url='';
|
||||
if ($option=='birthday')
|
||||
if ($option=='birthday')
|
||||
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
|
||||
else
|
||||
else
|
||||
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
|
||||
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
//print 'rrr'.$this->libelle.'-'.$withpicto;
|
||||
|
||||
if ($withpicto == 2)
|
||||
@ -1279,7 +1279,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||
// We must filter on assignement table
|
||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($filters['logint']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||
foreach ($filters as $key => $value)
|
||||
@ -1291,20 +1291,34 @@ class ActionComm extends CommonObject
|
||||
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
||||
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||
// We must filter on assignement table
|
||||
if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($key == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($key == 'logina')
|
||||
{
|
||||
$logina=$value;
|
||||
$condition='=';
|
||||
if (preg_match('/^!/',$logina))
|
||||
{
|
||||
$logina=preg_replace('/^!/','',$logina);
|
||||
$condition='<>';
|
||||
}
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
||||
$result=$userforfilter->fetch('',$logina);
|
||||
if ($result > 0) $sql.= " AND a.fk_user_author ".$condition." ".$userforfilter->id;
|
||||
elseif ($result < 0 || $condition == '=') $sql.= " AND a.fk_user_author = 0";
|
||||
}
|
||||
if ($key == 'logint' || $key == 'login')
|
||||
if ($key == 'logint')
|
||||
{
|
||||
$logint=$value;
|
||||
$condition='=';
|
||||
if (preg_match('/^!/',$logint))
|
||||
{
|
||||
$logint=preg_replace('/^!/','',$logint);
|
||||
$condition='<>';
|
||||
}
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||
$result=$userforfilter->fetch('',$logint);
|
||||
if ($result > 0) $sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||
elseif ($result < 0 || $condition == '=') $sql.= " AND ar.fk_element = 0";
|
||||
}
|
||||
}
|
||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||
|
||||
@ -129,10 +129,13 @@ $hookmanager->initHooks(array('agenda'));
|
||||
if (GETPOST("viewlist") || $action == 'show_list')
|
||||
{
|
||||
$param='';
|
||||
foreach($_POST as $key => $val)
|
||||
if (is_array($_POST))
|
||||
{
|
||||
if ($key=='token') continue;
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if ($key=='token') continue;
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
//print $param;
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
|
||||
@ -142,10 +145,13 @@ if (GETPOST("viewlist") || $action == 'show_list')
|
||||
if (GETPOST("viewperuser") || $action == 'show_peruser')
|
||||
{
|
||||
$param='';
|
||||
foreach($_POST as $key => $val)
|
||||
if (is_array($_POST))
|
||||
{
|
||||
if ($key=='token') continue;
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if ($key=='token') continue;
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
//print $param;
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
||||
@ -537,8 +543,10 @@ $resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$MAXONSAMEPAGE=10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
while ($i < $num && $i < $MAXONSAMEPAGE)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
@ -59,9 +59,9 @@ else
|
||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
$search_title=GETPOST('search_title','alpha');
|
||||
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
||||
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear'));
|
||||
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear'));
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
|
||||
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth','int'), GETPOST('datestartday','int'), GETPOST('datestartyear','int'));
|
||||
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth','int'), GETPOST('dateendday','int'), GETPOST('dateendyear','int'));
|
||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||
|
||||
@ -120,10 +120,13 @@ $hookmanager->initHooks(array('agendalist'));
|
||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||
{
|
||||
$param='';
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
}
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
$param.='&'.$key.'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
//print $param;
|
||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
||||
exit;
|
||||
@ -134,7 +137,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$actioncode='';
|
||||
$search_title='';
|
||||
@ -168,7 +171,7 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($actioncode != '') $param.="&actioncode=".$actioncode;
|
||||
if ($resourceid > 0) $param.="&resourceid=".$resourceid;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($status != '' && $status > -1) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
@ -177,6 +180,13 @@ if ($pid) $param.="&projectid=".$pid;
|
||||
if ($type) $param.="&type=".$type;
|
||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_title != '') $param.='&search_title='.$search_title;
|
||||
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
|
||||
if (GETPOST('datestartmonth','int')) $param.='&datestartmonth='.GETPOST('datestartmonth','int');
|
||||
if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestartyear','int');
|
||||
if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int');
|
||||
if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int');
|
||||
if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int');
|
||||
|
||||
$sql = "SELECT";
|
||||
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||
@ -340,11 +350,13 @@ if ($resql)
|
||||
|
||||
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
||||
{
|
||||
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
||||
$tmpforcreatebutton=dol_getdate(dol_now(), true);
|
||||
|
||||
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
|
||||
|
||||
//$param='month='.$monthshown.'&year='.$year;
|
||||
$hourminsec='100000';
|
||||
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||
$link.= $langs->trans("NewAction");
|
||||
$link.= '</a>';
|
||||
}
|
||||
@ -520,7 +532,7 @@ if ($resql)
|
||||
|
||||
// Status/Percent
|
||||
$datep=$db->jdate($obj->datep);
|
||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,1,$datep).'</td>';
|
||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
@ -534,81 +534,86 @@ if ($id > 0)
|
||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
|
||||
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
||||
|
||||
if ($conf->propal->enabled)
|
||||
if (! empty($conf->propal->enabled))
|
||||
{
|
||||
// Box proposals
|
||||
$tmp = $object->getOutstandingProposals();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$text=$langs->trans("OverAllProposals");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
// Box proposals
|
||||
$tmp = $object->getOutstandingProposals();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$text=$langs->trans("OverAllProposals");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
}
|
||||
|
||||
if ($conf->commande->enabled)
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
// Box proposals
|
||||
$tmp = $object->getOutstandingOrders();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$text=$langs->trans("OverAllOrders");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
// Box proposals
|
||||
$tmp = $object->getOutstandingOrders();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$text=$langs->trans("OverAllOrders");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
}
|
||||
|
||||
if ($conf->facture->enabled)
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
$tmp = $object->getOutstandingBills();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$tmp = $object->getOutstandingBills();
|
||||
$outstandingOpened=$tmp['opened'];
|
||||
$outstandingTotal=$tmp['total_ht'];
|
||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||
$text=$langs->trans("OverAllInvoices");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
|
||||
$text=$langs->trans("OverAllInvoices");
|
||||
$link='';
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
|
||||
// Box outstanding bill
|
||||
$warn = '';
|
||||
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened)
|
||||
{
|
||||
$warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
|
||||
}
|
||||
$text=$langs->trans("CurrentOutstandingBill");
|
||||
$link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator'.($outstandingOpened>0?' amountremaintopay':'').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
// Box outstanding bill
|
||||
$warn = '';
|
||||
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened)
|
||||
{
|
||||
$warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
|
||||
}
|
||||
$text=$langs->trans("CurrentOutstandingBill");
|
||||
$link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
|
||||
$icon='bill';
|
||||
if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator'.($outstandingOpened>0?' amountremaintopay':'').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||
$boxstat.='</div>';
|
||||
if ($link) $boxstat.='</a>';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);
|
||||
if(empty($reshook)){
|
||||
$boxstat.= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$boxstat.='</td></tr>';
|
||||
$boxstat.='</table>';
|
||||
$boxstat.='</div>';
|
||||
|
||||
print $boxstat;
|
||||
print $boxstat;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
* \brief Page to define emailing targets
|
||||
*/
|
||||
|
||||
if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
||||
@ -66,7 +68,7 @@ $search_email = GETPOST("search_email");
|
||||
$template_id = GETPOST('template_id', 'int');
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x")) {
|
||||
if (GETPOST('button_removefilter_x','alpha')) {
|
||||
$search_nom = '';
|
||||
$search_prenom = '';
|
||||
$search_email = '';
|
||||
@ -404,14 +406,8 @@ if ($_POST["button_removefilter"]) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$extrajs = array (
|
||||
'/includes/jquery/plugins/multiselect/js/ui.multiselect.js'
|
||||
);
|
||||
$extracss = array (
|
||||
'/includes/jquery/plugins/multiselect/css/ui.multiselect.css',
|
||||
);
|
||||
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss);
|
||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"));
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -474,7 +474,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
||||
}
|
||||
if (array_key_exists('cust_categ', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid ";
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=t.rowid ";
|
||||
}
|
||||
|
||||
if (!empty($arrayquery['cust_name'])) {
|
||||
|
||||
@ -89,7 +89,7 @@ class FormAdvTargetEmailing extends Form
|
||||
|
||||
$langs->load("dict");
|
||||
$maxlength = 0;
|
||||
|
||||
|
||||
$out = '';
|
||||
$countryArray = array();
|
||||
$label = array ();
|
||||
@ -252,7 +252,7 @@ class FormAdvTargetEmailing extends Form
|
||||
// $sql.= ' WHERE entity = '.$conf->entity;
|
||||
|
||||
$options_array = array();
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -335,49 +335,8 @@ class FormAdvTargetEmailing extends Form
|
||||
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
||||
global $conf, $langs;
|
||||
|
||||
$return = '';
|
||||
$return .= '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
$.extend($.ui.multiselect.locale, {
|
||||
addAll:\'' . $langs->transnoentities ( "AddAll" ) . '\',
|
||||
removeAll:\'' . $langs->transnoentities ( "RemoveAll" ) . '\',
|
||||
itemsCount:\'' . $langs->transnoentities ( "ItemsCount" ) . '\'
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$("#' . $htmlname . '").addClass("' . $htmlname . '").attr("multiple","multiple").attr("name","' . $htmlname . '[]");
|
||||
$(".multiselect").multiselect({sortable: false, searchable: false});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]" style="display: none;">';
|
||||
//$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]">';
|
||||
|
||||
if ($showempty)
|
||||
$return .= '<option value=""> </option>';
|
||||
|
||||
// Find if keys is in selected array value
|
||||
if (is_array($selected_array) && count($selected_array)>0) {
|
||||
$intersect_array = array_intersect_key($options_array, array_flip($selected_array));
|
||||
} else {
|
||||
$intersect_array=array();
|
||||
}
|
||||
|
||||
if (count($options_array) > 0) {
|
||||
foreach ($options_array as $keyoption => $valoption) {
|
||||
// If key is in intersect table then it have to e selected
|
||||
$selected = '';
|
||||
if (count ( $intersect_array ) > 0) {
|
||||
if (array_key_exists ( $keyoption, $intersect_array )) {
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
}
|
||||
$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
|
||||
$form=new Form($this->db);
|
||||
$return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295);
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -448,7 +407,7 @@ class FormAdvTargetEmailing extends Form
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
|
||||
return $this->advMultiselectarray( $htmlname, $options_array, $selected_array );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1250,6 +1250,8 @@ $now = dol_now();
|
||||
// Add new proposal
|
||||
if ($action == 'create')
|
||||
{
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
print load_fiche_titre($langs->trans("NewProp"));
|
||||
|
||||
$soc = new Societe($db);
|
||||
|
||||
@ -618,9 +618,10 @@ class Propal extends CommonObject
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0)
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@ -745,7 +746,7 @@ class Propal extends CommonObject
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
$result=$this->line->update();
|
||||
$result=$this->line->update($notrigger);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Reorder if child line
|
||||
@ -909,23 +910,23 @@ class Propal extends CommonObject
|
||||
$sql.= $this->socid;
|
||||
$sql.= ", 0";
|
||||
$sql.= ", ".$this->remise;
|
||||
$sql.= ", ".($this->remise_percent?$this->db->escape($this->remise_percent):'null');
|
||||
$sql.= ", ".($this->remise_absolue?$this->db->escape($this->remise_absolue):'null');
|
||||
$sql.= ", ".($this->remise_percent?$this->db->escape($this->remise_percent):'NULL');
|
||||
$sql.= ", ".($this->remise_absolue?$this->db->escape($this->remise_absolue):'NULL');
|
||||
$sql.= ", 0";
|
||||
$sql.= ", 0";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", '(PROV)'";
|
||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"NULL");
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", '".$this->db->escape($this->modelpdf)."'";
|
||||
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null");
|
||||
$sql.= ", ".$this->cond_reglement_id;
|
||||
$sql.= ", ".$this->mode_reglement_id;
|
||||
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"NULL");
|
||||
$sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
|
||||
$sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
|
||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
||||
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"NULL");
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
@ -2361,7 +2362,7 @@ class Propal extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -3501,7 +3502,7 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* Class to manage commercial proposal lines
|
||||
*/
|
||||
class PropaleLigne extends CommonObjectLine
|
||||
class PropaleLigne extends CommonObjectLine
|
||||
{
|
||||
public $element='propaldet';
|
||||
public $table_element='propaldet';
|
||||
|
||||
@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
@ -355,6 +355,7 @@ if ($resql)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
|
||||
if (empty($search_societe)) $search_societe = $soc->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2039,7 +2039,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</form>';
|
||||
} else {
|
||||
print $object->date ? dol_print_date($object->date, 'day') : ' ';
|
||||
if ($object->hasDelay() && empty($object->date_livraison)) {
|
||||
if ($object->hasDelay() && ! empty($object->date_livraison)) {
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,9 +65,8 @@ class Commande extends CommonOrder
|
||||
public $contactid;
|
||||
|
||||
/**
|
||||
* Status of the order. Check the following constants:
|
||||
* Status of the order
|
||||
* @var int
|
||||
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
||||
*/
|
||||
public $statut;
|
||||
/**
|
||||
@ -1359,10 +1358,10 @@ class Commande extends CommonOrder
|
||||
|
||||
$this->line->vat_src_code=$vat_src_code;
|
||||
$this->line->tva_tx=$txtva;
|
||||
$this->line->localtax1_tx=$txlocaltax1;
|
||||
$this->line->localtax2_tx=$txlocaltax2;
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->localtax1_tx=$localtaxes_type[1];
|
||||
$this->line->localtax2_tx=$localtaxes_type[3];
|
||||
$this->line->localtax1_type=$localtaxes_type[0];
|
||||
$this->line->localtax2_type=$localtaxes_type[2];
|
||||
$this->line->fk_product=$fk_product;
|
||||
$this->line->product_type=$product_type;
|
||||
$this->line->fk_remise_except=$fk_remise_except;
|
||||
@ -1411,7 +1410,7 @@ class Commande extends CommonOrder
|
||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||
|
||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -2778,9 +2777,10 @@ class Commande extends CommonOrder
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @param int $notrigger disable line update trigger
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0)
|
||||
{
|
||||
global $conf, $mysoc, $langs, $user;
|
||||
|
||||
@ -2935,7 +2935,7 @@ class Commande extends CommonOrder
|
||||
$this->line->array_options=$array_options;
|
||||
}
|
||||
|
||||
$result=$this->line->update($user);
|
||||
$result=$this->line->update($user, $notrigger);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Reorder if child line
|
||||
@ -3243,7 +3243,8 @@ class Commande extends CommonOrder
|
||||
$response->nbtodo++;
|
||||
|
||||
$generic_commande->statut = $obj->fk_statut;
|
||||
$generic_commande->date_livraison = $obj->delivery_date;
|
||||
$generic_commande->date_commande = $this->db->jdate($obj->date_commande);
|
||||
$generic_commande->date_livraison = $this->db->jdate($obj->delivery_date);
|
||||
|
||||
if ($generic_commande->hasDelay()) {
|
||||
$response->nbtodolate++;
|
||||
@ -3370,14 +3371,14 @@ class Commande extends CommonOrder
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param int $option Where point the link (0=> main card, 1,2 => shipment)
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @param int $max Max length to show
|
||||
* @param int $short ???
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@ -3385,7 +3386,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$result='';
|
||||
|
||||
if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
|
||||
if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
|
||||
else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;
|
||||
|
||||
if ($option !== 'nolink')
|
||||
|
||||
@ -162,7 +162,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_categ='';
|
||||
$search_user='';
|
||||
@ -191,6 +191,11 @@ if (empty($reshook))
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||
{
|
||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Commande';
|
||||
@ -371,7 +376,7 @@ if (empty($reshook))
|
||||
|
||||
}
|
||||
|
||||
$cmd->classifyBilled($user);
|
||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||
|
||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
||||
else $TFact[$object->id] = $object;
|
||||
@ -573,6 +578,7 @@ if ($resql)
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
|
||||
if (empty($search_company)) $search_company = $soc->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -754,7 +760,7 @@ if ($resql)
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
|
||||
print '<table class="border" width="100%" >';
|
||||
print '<table class="noborder" width="100%" >';
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">';
|
||||
print $langs->trans('DateInvoice');
|
||||
@ -776,7 +782,15 @@ if ($resql)
|
||||
print $langs->trans('ValidateInvoices');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectyesno('valdate_invoices', 1, 1);
|
||||
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||
{
|
||||
print $form->selectyesno('valdate_invoices', 0, 1, 1);
|
||||
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
@ -838,7 +852,7 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
@ -976,6 +990,7 @@ if ($resql)
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
);
|
||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||
@ -1033,7 +1048,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>'."\n";
|
||||
|
||||
$total=0;
|
||||
|
||||
@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
@ -46,17 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load("categories");
|
||||
$langs->load("companies");
|
||||
$langs->load("margins");
|
||||
$langs->load("salaries");
|
||||
$langs->load("loan");
|
||||
$langs->load("donations");
|
||||
$langs->load("trips");
|
||||
$langs->load("members");
|
||||
$langs->load("compta");
|
||||
$langs->loadLangs(array("banks","bills","categories","companies","margins","salaries","loan","donations","trips","members","compta","accountancy"));
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
@ -84,6 +75,7 @@ $debit=GETPOST("debit",'alpha');
|
||||
$credit=GETPOST("credit",'alpha');
|
||||
$type=GETPOST("type",'alpha');
|
||||
$account=GETPOST("account",'int');
|
||||
$accountancy_code=GETPOST('accountancy_code', 'alpha');
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
@ -178,7 +170,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_dt_start='';
|
||||
$search_dt_end='';
|
||||
@ -276,11 +268,11 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
||||
$amount = - price2num($_POST["adddebit"]);
|
||||
}
|
||||
|
||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||
$operation=$_POST["operation"];
|
||||
$num_chq=$_POST["num_chq"];
|
||||
$label=$_POST["label"];
|
||||
$cat1=$_POST["cat1"];
|
||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||
$operation = GETPOST("operation",'alpha');
|
||||
$num_chq = GETPOST("num_chq",'alpha');
|
||||
$label = GETPOST("label",'alpha');
|
||||
$cat1 = GETPOST("cat1",'alpha');
|
||||
|
||||
if (! $dateop) {
|
||||
$error++;
|
||||
@ -290,15 +282,24 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
||||
}
|
||||
if (! $label) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Label")), null, 'errors');
|
||||
}
|
||||
if (! $amount) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
||||
}
|
||||
/*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||
$error++;
|
||||
}*/
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user);
|
||||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||
if ($insertid > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
@ -331,6 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
$companystatic=new Societe($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
@ -365,6 +367,7 @@ if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
||||
if ($search_conciliated != '') $param.='&search_conciliated='.urlencode($search_conciliated);
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
@ -408,19 +411,32 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Buttons actions
|
||||
*/
|
||||
|
||||
if ($action != 'reconcile')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
else // If direct entries is not done using miscellaneous payments
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -431,7 +447,7 @@ if ($id > 0 || ! empty($ref))
|
||||
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/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
@ -637,6 +653,60 @@ if ($resql)
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
|
||||
// Form to add a transaction with no invoice
|
||||
if ($user->rights->banque->modifier && $action == 'addline')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Numero").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("Description").'</td>';
|
||||
print '<td align=right>'.$langs->trans("Debit").'</td>';
|
||||
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||
/*if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $langs->trans("AccountAccounting");
|
||||
print '</td>';
|
||||
}*/
|
||||
print '<td colspan="2" align="center"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr '.$bcnd[false].'>';
|
||||
print '<td class="nowrap" colspan="2">';
|
||||
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||
print '</td><td>';
|
||||
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
|
||||
print '<td colspan="2">';
|
||||
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||
if ($options) {
|
||||
print '<br>'.$langs->trans("Rubrique").': ';
|
||||
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
|
||||
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
|
||||
/*if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||
print '</td>';
|
||||
}*/
|
||||
print '<td colspan="2" align="center">';
|
||||
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/// ajax to adjust value date with plus and less picto
|
||||
print '
|
||||
|
||||
@ -39,7 +39,7 @@ class Account extends CommonObject
|
||||
public $element = 'bank_account';
|
||||
public $table_element = 'bank_account';
|
||||
public $picto = 'account';
|
||||
|
||||
|
||||
/**
|
||||
* @var int Use id instead of rowid
|
||||
* @deprecated
|
||||
@ -394,9 +394,10 @@ class Account extends CommonObject
|
||||
* @param User $user User that create
|
||||
* @param string $emetteur Name of cheque writer
|
||||
* @param string $banque Bank of cheque writer
|
||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||
* @return int Rowid of added entry, <0 if KO
|
||||
*/
|
||||
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='')
|
||||
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='')
|
||||
{
|
||||
// Deprecatîon warning
|
||||
if (is_numeric($oper)) {
|
||||
@ -456,6 +457,7 @@ class Account extends CommonObject
|
||||
$accline->fk_user_author = $user->id;
|
||||
$accline->fk_account = $this->rowid;
|
||||
$accline->fk_type = $oper;
|
||||
$accline->numero_compte = $accountancycode;
|
||||
|
||||
if ($num_chq) {
|
||||
$accline->num_chq = $num_chq;
|
||||
@ -538,7 +540,7 @@ class Account extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (";
|
||||
$sql.= "datec";
|
||||
$sql.= ", ref";
|
||||
@ -619,14 +621,14 @@ class Account extends CommonObject
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BANKACCOUNT_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -670,9 +672,9 @@ class Account extends CommonObject
|
||||
global $langs,$conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Clean parameters
|
||||
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
|
||||
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
|
||||
@ -739,7 +741,7 @@ class Account extends CommonObject
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
@ -754,7 +756,7 @@ class Account extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -906,7 +908,7 @@ class Account extends CommonObject
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_update = $this->db->jdate($obj->date_update);
|
||||
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
@ -983,15 +985,15 @@ class Account extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Delete link between tag and bank account
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
|
||||
$sql.= " WHERE fk_account = ".$this->id;
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
@ -999,15 +1001,15 @@ class Account extends CommonObject
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
if ($result)
|
||||
{
|
||||
// Remove extrafields
|
||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
@ -1020,13 +1022,13 @@ class Account extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -1433,7 +1435,7 @@ class Account extends CommonObject
|
||||
* - DeskCode
|
||||
*
|
||||
* Some countries show less or more bank account properties to the user
|
||||
*
|
||||
*
|
||||
* @param int $includeibanbic 1=Return also key for IBAN and BIC
|
||||
* @return array
|
||||
* @see useDetailedBBAN
|
||||
@ -1554,7 +1556,7 @@ class AccountLine extends CommonObject
|
||||
var $element='bank';
|
||||
var $table_element='bank';
|
||||
var $picto = 'generic';
|
||||
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $datec;
|
||||
@ -1683,8 +1685,9 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", num_chq";
|
||||
$sql .= ", fk_account";
|
||||
$sql .= ", fk_type";
|
||||
$sql .= ",emetteur,banque";
|
||||
$sql .= ", emetteur,banque";
|
||||
$sql .= ", rappro";
|
||||
$sql .= ", numero_compte";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($this->datec)."'";
|
||||
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
||||
@ -1698,6 +1701,7 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
||||
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
||||
$sql .= ", ".(int) $this->rappro;
|
||||
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
@ -1842,7 +1846,7 @@ class AccountLine extends CommonObject
|
||||
function update_conciliation(User $user, $cat)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Check statement field
|
||||
@ -1854,7 +1858,7 @@ class AccountLine extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
|
||||
$sql.= " rappro = 1";
|
||||
$sql.= ", num_releve = '".$this->db->escape($this->num_releve)."'";
|
||||
@ -2042,7 +2046,7 @@ class AccountLine extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return label of status (activity, closed)
|
||||
*
|
||||
@ -2053,7 +2057,7 @@ class AccountLine extends CommonObject
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -2097,6 +2101,6 @@ class AccountLine extends CommonObject
|
||||
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ class BankAccounts extends DolibarrApi
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('bank_account').')';
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
@ -81,7 +81,7 @@ class BankAccounts extends DolibarrApi
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql.= $this->db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
@ -89,10 +89,10 @@ class BankAccounts extends DolibarrApi
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
|
||||
$sql.= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -236,7 +236,7 @@ class BankAccounts extends DolibarrApi
|
||||
function _validate($data)
|
||||
{
|
||||
$account = array();
|
||||
foreach (Accounts::$FIELDS as $field) {
|
||||
foreach (BankAccounts::$FIELDS as $field) {
|
||||
if (! isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$account[$field] = $data[$field];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user