Merge branch '6.0' of https://github.com/Dolibarr/dolibarr into 6.0
This commit is contained in:
commit
04466651d6
@ -11,7 +11,7 @@ php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6.29'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- nightly
|
||||
|
||||
117
ChangeLog
117
ChangeLog
@ -4,10 +4,127 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** 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 +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
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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 = "";
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
@ -72,15 +72,24 @@ 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;
|
||||
@ -120,12 +129,20 @@ if ($action == "confirm_update") {
|
||||
else if ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if (empty($debit) && empty($credit)) {
|
||||
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;
|
||||
@ -567,7 +584,7 @@ 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>';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
@ -583,8 +600,8 @@ if ($action == 'create') {
|
||||
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") . '">';
|
||||
@ -622,7 +639,7 @@ 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>';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
@ -638,24 +655,30 @@ if ($action == 'create') {
|
||||
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="' . ($debit ? price($debit) : '') . '"/></td>';
|
||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . ($credit ? 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' && $action=='')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'">'.$langs->trans("ValidTransaction").'</a>';
|
||||
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,28 +376,28 @@ 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 $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))
|
||||
@ -411,7 +410,7 @@ else
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to');
|
||||
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))
|
||||
@ -455,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;
|
||||
@ -481,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 = "";
|
||||
|
||||
@ -37,7 +37,7 @@ class AccountancySystem
|
||||
var $label;
|
||||
var $account_number;
|
||||
var $account_parent;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -46,8 +46,8 @@ class AccountancySystem
|
||||
function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
@ -55,11 +55,11 @@ class AccountancySystem
|
||||
* @param string $ref ref
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
*/
|
||||
function fetch($rowid = 0, $ref = '')
|
||||
function fetch($rowid = 0, $ref = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
|
||||
if ($rowid > 0 || $ref)
|
||||
{
|
||||
$sql = "SELECT a.pcg_version, a.label, a.active";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||
@ -69,12 +69,12 @@ class AccountancySystem
|
||||
} elseif ($ref) {
|
||||
$sql .= " a.pcg_version = '" . $ref . "'";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
@ -82,7 +82,7 @@ class AccountancySystem
|
||||
$this->ref = $obj->pcg_version;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
@ -94,8 +94,8 @@ class AccountancySystem
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Insert accountancy system name into database
|
||||
*
|
||||
@ -104,16 +104,16 @@ class AccountancySystem
|
||||
*/
|
||||
function create($user) {
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
||||
|
||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
||||
|
||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
|
||||
|
||||
|
||||
if ($id > 0) {
|
||||
$this->rowid = $id;
|
||||
$result = $this->rowid;
|
||||
@ -127,7 +127,7 @@ class AccountancySystem
|
||||
$this->error = "AccountancySystem::Create Erreur $result";
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,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')))
|
||||
@ -803,7 +803,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) {
|
||||
@ -1260,7 +1260,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Accountingbookkeeping($this->db);
|
||||
$object = new BookKeeping($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -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";
|
||||
@ -388,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
|
||||
|
||||
@ -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')
|
||||
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,11 +199,11 @@ 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;
|
||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $journal_label;
|
||||
@ -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>';
|
||||
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,";
|
||||
$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')
|
||||
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);
|
||||
@ -166,10 +167,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,
|
||||
@ -188,8 +193,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();
|
||||
@ -197,12 +201,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'];
|
||||
@ -211,6 +209,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)
|
||||
{
|
||||
@ -226,8 +230,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("SubledgerAccount");
|
||||
$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;
|
||||
@ -242,7 +246,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
|
||||
{
|
||||
@ -259,8 +263,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);
|
||||
@ -271,12 +273,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;
|
||||
@ -291,7 +293,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
|
||||
{
|
||||
@ -309,9 +311,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->doc_ref = $val["ref"];
|
||||
@ -322,8 +330,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;
|
||||
@ -338,7 +346,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
|
||||
{
|
||||
@ -350,6 +358,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $errorforline)
|
||||
{
|
||||
@ -367,7 +376,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)
|
||||
@ -378,7 +387,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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -387,9 +412,6 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
// Export
|
||||
if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
@ -397,20 +419,40 @@ if ($action == 'exportcsv') {
|
||||
|
||||
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 ) {
|
||||
@ -428,12 +470,18 @@ if ($action == 'exportcsv') {
|
||||
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;
|
||||
@ -442,35 +490,17 @@ if ($action == 'exportcsv') {
|
||||
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') {
|
||||
|
||||
@ -481,7 +511,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");
|
||||
@ -489,18 +518,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");
|
||||
@ -542,7 +566,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";
|
||||
@ -550,19 +575,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);
|
||||
@ -573,6 +631,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')
|
||||
@ -581,10 +640,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>";
|
||||
@ -592,50 +653,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("SubledgerAccount") . "</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>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,12 +39,7 @@ 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','aZ09');
|
||||
@ -56,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();
|
||||
|
||||
@ -94,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,";
|
||||
$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";
|
||||
@ -115,7 +111,9 @@ 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')
|
||||
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";
|
||||
|
||||
@ -127,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 ) {
|
||||
@ -145,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 +187,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 +213,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;
|
||||
|
||||
@ -258,7 +264,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
|
||||
{
|
||||
@ -285,7 +291,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 = '';
|
||||
@ -305,7 +311,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
|
||||
{
|
||||
@ -323,41 +329,49 @@ 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->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->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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -394,6 +408,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -410,84 +439,87 @@ 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -500,13 +532,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;
|
||||
|
||||
@ -553,6 +586,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>";
|
||||
@ -578,7 +612,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')
|
||||
@ -586,12 +630,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("SubledgerAccount") . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
@ -605,6 +647,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')
|
||||
@ -613,7 +656,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>";
|
||||
@ -622,26 +669,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>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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";
|
||||
@ -394,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="";
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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="";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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='';
|
||||
|
||||
@ -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
|
||||
@ -48,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";
|
||||
@ -118,7 +115,7 @@ $elementList = array();
|
||||
$sourceList=array();
|
||||
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||
@ -138,7 +135,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
if ($ok && GETPOST('actionadd','alpha'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
@ -200,7 +197,7 @@ 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"; }
|
||||
@ -252,7 +249,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
|
||||
}
|
||||
@ -262,7 +259,7 @@ 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."'";
|
||||
@ -341,7 +338,7 @@ if ($action == 'delete')
|
||||
//var_dump($elementList);
|
||||
|
||||
/*
|
||||
* Show a dictionary
|
||||
* Show website list
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
@ -365,7 +362,7 @@ 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]);
|
||||
@ -412,11 +409,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);
|
||||
}
|
||||
}
|
||||
@ -447,8 +444,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)
|
||||
{
|
||||
@ -465,14 +461,6 @@ if ($id)
|
||||
|
||||
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"], '', ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
|
||||
@ -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'),
|
||||
);
|
||||
|
||||
|
||||
@ -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:'');
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ class Categorie extends CommonObject
|
||||
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_PROJECT = 6; // TODO Replace this value with 'project'
|
||||
const TYPE_BANK_LINE = 'bank_line';
|
||||
public $picto = 'category';
|
||||
|
||||
@ -133,7 +133,7 @@ class Categorie extends CommonObject
|
||||
);
|
||||
|
||||
public $element='category';
|
||||
public $table_element='categories';
|
||||
public $table_element='categorie';
|
||||
|
||||
public $fk_parent;
|
||||
public $label;
|
||||
|
||||
@ -35,14 +35,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$langs->load("categories");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref');
|
||||
$label=GETPOST('label');
|
||||
$type=GETPOST('type');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$removeelem = GETPOST('removeelem','int');
|
||||
$elemid=GETPOST('elemid');
|
||||
|
||||
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)
|
||||
{
|
||||
@ -195,7 +195,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 +205,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);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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='';
|
||||
|
||||
@ -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,74 +534,73 @@ 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>';
|
||||
}
|
||||
|
||||
$boxstat.='</td></tr>';
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -124,7 +124,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
|
||||
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".$this->db->idate(dol_now()).",";
|
||||
$sql.= " '".$this->db->idate(dol_now())."',";
|
||||
$sql.= " ".$user->id;
|
||||
|
||||
|
||||
@ -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);
|
||||
@ -1748,6 +1750,7 @@ if ($action == 'create')
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
|
||||
@ -2362,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);
|
||||
@ -3502,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
|
||||
{
|
||||
|
||||
@ -1924,6 +1924,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
@ -2039,7 +2040,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;
|
||||
/**
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -86,9 +86,9 @@ class PaymentVarious extends CommonObject
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
|
||||
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " sens=".$this->sens.",";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
@ -325,14 +325,14 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", '".$this->sens."'";
|
||||
$sql.= ", '".$this->db->escape($this->sens)."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
$sql.= ", '".$this->type_payment."'";
|
||||
$sql.= ", '".$this->num_payment."'";
|
||||
$sql.= ", '".$this->db->escape($this->type_payment)."'";
|
||||
$sql.= ", '".$this->db->escape($this->num_payment)."'";
|
||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->accountancy_code."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code)."'";
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
@ -342,7 +342,6 @@ class PaymentVarious extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
||||
|
||||
if ($this->id > 0)
|
||||
|
||||
@ -121,7 +121,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$statut = 'all';
|
||||
$search_ref='';
|
||||
|
||||
@ -122,7 +122,7 @@ if ($action=="dl" && $numref > 0)
|
||||
{
|
||||
// TODO Replace this with a standard builddoc action that use a document generation module to build the ZIP
|
||||
$log = '';
|
||||
|
||||
|
||||
$outdir = $conf->bank->dir_temp.'/'.$numref.'-'.$object->label;
|
||||
$outdirinvoices = $outdir.'/'.$langs->trans("BillsCustomers");
|
||||
$outdirsupplierinvoices = $outdir.'/'.$langs->trans("BillsSuppliers");
|
||||
@ -130,7 +130,7 @@ if ($action=="dl" && $numref > 0)
|
||||
dol_mkdir($outdir);
|
||||
dol_mkdir($outdirinvoices);
|
||||
dol_mkdir($outdirsupplierinvoices);
|
||||
|
||||
|
||||
//$zipname = $object->label.'-'.$numref . '.zip';
|
||||
//$zip = new ZipArchive();
|
||||
//$zip->open($zipname, ZipArchive::OVERWRITE);
|
||||
@ -138,7 +138,7 @@ if ($action=="dl" && $numref > 0)
|
||||
$sql = $sqlrequestforbankline;
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
|
||||
$resd = $db->query($sql);
|
||||
if ($resd) {
|
||||
$numd = $db->num_rows($resd);
|
||||
@ -146,7 +146,7 @@ if ($action=="dl" && $numref > 0)
|
||||
if ($numd > 0)
|
||||
{
|
||||
$objd = $db->fetch_object($resd);
|
||||
|
||||
|
||||
$log.='Transaction '.$objd->rowid;
|
||||
$links = $object->get_url($objd->rowid);
|
||||
|
||||
@ -165,7 +165,7 @@ if ($action=="dl" && $numref > 0)
|
||||
{
|
||||
$facturestatic->fetch($billid);
|
||||
$subdir = get_exdir($facturestatic->id, 2, 0, 0, $facturestatic, 'invoice');
|
||||
|
||||
|
||||
$arrayofinclusion=array(); // TODO Find a way to get doc ODT or other
|
||||
// TODO Use get_exdir
|
||||
$arrayofinclusion[]=preg_quote($facturestatic->ref.'.pdf','/');
|
||||
@ -202,7 +202,7 @@ if ($action=="dl" && $numref > 0)
|
||||
{
|
||||
$facturestatic->fetch($billid);
|
||||
$subdir = get_exdir($facturestatic->id, 2, 0, 0, $facturestatic, 'invoice_supplier');
|
||||
|
||||
|
||||
$arrayofinclusion=array(); // TODO Find a way to get doc ODT or other
|
||||
// TODO Use get_exdir
|
||||
$arrayofinclusion[]=preg_quote($facturestatic->ref.'.pdf','/');
|
||||
@ -227,7 +227,7 @@ if ($action=="dl" && $numref > 0)
|
||||
dol_copy($srcfile, $destfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "payment_expensereport":
|
||||
/*$subdir = dol_sanitizeFileName($objd->refe);
|
||||
@ -246,7 +246,7 @@ if ($action=="dl" && $numref > 0)
|
||||
}
|
||||
}
|
||||
$log.="\n";
|
||||
|
||||
|
||||
/*if (! empty($upload_dir))
|
||||
{
|
||||
$files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1);
|
||||
@ -259,24 +259,24 @@ if ($action=="dl" && $numref > 0)
|
||||
} else {
|
||||
$log .= $key . ',' . $langs->trans("Nofile") . "\n";
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$db->free($resd);
|
||||
|
||||
|
||||
|
||||
|
||||
//$zip->addFromString('log '.$numref.'.csv', $log);
|
||||
//$zip->close();
|
||||
|
||||
|
||||
// /Then download the zipped file.
|
||||
/*header('Content-Type: application/zip');
|
||||
header('Content-disposition: attachment; filename=' . $zipname);
|
||||
header('Content-Length: ' . filesize($zipname));
|
||||
|
||||
|
||||
readfile($zipname);
|
||||
|
||||
|
||||
exit;*/
|
||||
}
|
||||
|
||||
@ -329,18 +329,18 @@ if (empty($numref))
|
||||
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
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>';
|
||||
}
|
||||
@ -348,7 +348,7 @@ if (empty($numref))
|
||||
|
||||
print '</div>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder,'',$numrows);
|
||||
|
||||
@ -481,8 +481,8 @@ else
|
||||
//$mesprevnext.=' ';
|
||||
$mesprevnext.='<li class="pagination"><a class="paginationnext" href="'.$_SERVER["PHP_SELF"].'?rel=next&num='.$numref.'&ve='.$ve.'&account='.$object->id.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
|
||||
$mesprevnext.='</ul></div>';
|
||||
|
||||
$title=$langs->trans("AccountStatement").' '.$numref.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0, 'receipts');
|
||||
|
||||
$title=$langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title, $mesprevnext, 'title_bank.png');
|
||||
//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'title_bank.png', 0, '', '', 0, 1);
|
||||
print '<br>';
|
||||
@ -520,7 +520,7 @@ else
|
||||
|
||||
// Recherche les ecritures pour le releve
|
||||
$sql = $sqlrequestforbankline;
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -553,7 +553,7 @@ else
|
||||
print img_edit_add() ."</a>";
|
||||
print "</td>\n";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
|
||||
|
||||
// Type and num
|
||||
if ($objp->fk_type == 'SOLD') {
|
||||
$type_label=' ';
|
||||
@ -753,9 +753,9 @@ else
|
||||
print "</tr>\n";
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
// Add a download button
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Started a rewrite to make this feature more Dolibarr compliant. Still need dev to be completed.
|
||||
{
|
||||
|
||||
@ -29,15 +29,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load("users");
|
||||
$langs->load("accountancy");
|
||||
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$id=GETPOST("id",'int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$label=GETPOST("label","alpha");
|
||||
$sens=GETPOST("sens","int");
|
||||
@ -61,115 +60,139 @@ $hookmanager->initHooks(array('variouscard','globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (! empty($cancel))
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' && empty($cancel))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
|
||||
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
if (empty($datev)) $datev=$datep;
|
||||
|
||||
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
$object->amount=price2num(GETPOST("amount"));
|
||||
$object->label=GETPOST("label");
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->fk_user_author=$user->id;
|
||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
if ($cancel)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->type_payment) || $object->type_payment < 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->create($user);
|
||||
if ($ret > 0)
|
||||
if ($action != 'addlink')
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: index.php");
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||
$action='';
|
||||
}
|
||||
|
||||
$action='create';
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
|
||||
if ($object->rappro == 0)
|
||||
if ($action == 'add')
|
||||
{
|
||||
$db->begin();
|
||||
$error=0;
|
||||
|
||||
$ret=$object->delete($user);
|
||||
if ($ret > 0)
|
||||
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
|
||||
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
|
||||
if (empty($datev)) $datev=$datep;
|
||||
|
||||
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||
$object->datev=$datev;
|
||||
$object->datep=$datep;
|
||||
$object->amount=price2num(GETPOST("amount"));
|
||||
$object->label=GETPOST("label");
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->fk_user_author=$user->id;
|
||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||
$object->sens=GETPOST('sens');
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
{
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
$result=$accountline->fetch($object->fk_bank);
|
||||
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
|
||||
}
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->type_payment) || $object->type_payment < 0)
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($object->amount))
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->create($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->error=$accountline->error;
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
}
|
||||
|
||||
$action='create';
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$object->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($object->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
$result=$accountline->fetch($object->fk_bank);
|
||||
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->error=$accountline->error;
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -200,8 +223,9 @@ if ($id)
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'create')
|
||||
{
|
||||
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png');
|
||||
@ -269,7 +293,7 @@ if ($action == 'create')
|
||||
// Accountancy account
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
@ -292,7 +316,7 @@ if ($action == 'create')
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 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,9 +17,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/various_payment/index.php
|
||||
* \ingroup bank
|
||||
* \brief List of various payments
|
||||
* \file htdocs/compta/bank/various_payment/index.php
|
||||
* \ingroup bank
|
||||
* \brief List of various payments
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
@ -34,6 +35,8 @@ $socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref','int');
|
||||
$search_user = GETPOST('search_user','alpha');
|
||||
@ -50,11 +53,10 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="v.datep";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$filtre=$_GET["filtre"];
|
||||
$filtre=GETPOST("filtre",'alpha');
|
||||
|
||||
if (empty($_REQUEST['typeid']))
|
||||
if (! GETPOST('typeid'))
|
||||
{
|
||||
$newfiltre=str_replace('filtre=','',$filtre);
|
||||
$filterarray=explode('-',$newfiltre);
|
||||
@ -66,10 +68,10 @@ if (empty($_REQUEST['typeid']))
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
$typeid=GETPOST('typeid');
|
||||
}
|
||||
|
||||
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="";
|
||||
@ -240,9 +242,12 @@ if ($result)
|
||||
|
||||
$colspan=4;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total)."</td>";
|
||||
print "<td></td></tr>";
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
@ -57,7 +57,7 @@ if (! $sortfield) $sortfield="d.dated";
|
||||
$year=GETPOST("year");
|
||||
$month=GETPOST("month");
|
||||
|
||||
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','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_name="";
|
||||
|
||||
@ -1440,7 +1440,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorChooseBetweenFreeAntryOrPredefinedProduct'), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorChooseBetweenFreeEntryOrPredefinedProduct'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -3075,6 +3075,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
@ -4185,7 +4186,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if (! $objectidnext && count($object->lines) > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,13 +46,18 @@ $langs->load('compta');
|
||||
$langs->load('admin');
|
||||
$langs->load('other');
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$massaction = GETPOST('massaction','alpha');
|
||||
$show_files = GETPOST('show_files','int');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicetemplatelist'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$lineid=GETPOST('lineid','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$objecttype = 'facture_rec';
|
||||
if ($action == "create" || $action == "add") $objecttype = '';
|
||||
@ -112,7 +117,7 @@ $arrayfields=array(
|
||||
'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbGeneration"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
@ -132,6 +137,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters = array('socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -140,6 +148,9 @@ if (empty($reshook))
|
||||
{
|
||||
if (GETPOST('cancel')) $action='';
|
||||
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Set note
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -148,7 +159,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Do we click on 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_societe='';
|
||||
@ -165,6 +176,14 @@ if (empty($reshook))
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permtoread = $user->rights->mymodule->read;
|
||||
$permtodelete = $user->rights->mymodule->delete;
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/
|
||||
|
||||
// Create predefined invoice
|
||||
if ($action == 'add')
|
||||
{
|
||||
@ -517,7 +536,7 @@ if (empty($reshook))
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
|
||||
// if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ?
|
||||
if (! empty($price_ht))
|
||||
{
|
||||
@ -905,7 +924,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="facid" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
dol_fiche_head(null, '', '', 0);
|
||||
|
||||
$rowspan=4;
|
||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||
@ -942,7 +961,7 @@ if ($action == 'create')
|
||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')'
|
||||
);
|
||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
@ -952,10 +971,10 @@ if ($action == 'create')
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border tdtop">';
|
||||
print '<td class="tdtop">';
|
||||
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
|
||||
print '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<td colspan="2">';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
@ -963,7 +982,7 @@ if ($action == 'create')
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border tdtop">';
|
||||
print '<td class="tdtop">';
|
||||
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
|
||||
print '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
@ -1007,12 +1026,14 @@ if ($action == 'create')
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><br>';
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Autogeneration
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$title, '', '');
|
||||
|
||||
dol_fiche_head(null, '', '', 0);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -1040,7 +1061,8 @@ if ($action == 'create')
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><br>';
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
@ -1078,8 +1100,6 @@ if ($action == 'create')
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
@ -1260,7 +1280,7 @@ else
|
||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')'
|
||||
);
|
||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
@ -1291,7 +1311,7 @@ else
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('RIB');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
|
||||
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
@ -1323,7 +1343,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td colspan="2"><span class="fa fa-calendar"></span> '.$title.'</td></tr>';
|
||||
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td style="width: 50%">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -1558,7 +1578,8 @@ else
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
|
||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when";
|
||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,";
|
||||
$sql.= " f.datec, f.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -1570,10 +1591,10 @@ else
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);
|
||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_frequency > 0) $sql.= natural_search('f.frequency', $search_frequency);
|
||||
if ($search_frequency == '1') $sql.= ' AND f.frequency > 0';
|
||||
if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)';
|
||||
|
||||
@ -1605,23 +1626,24 @@ else
|
||||
}
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param='&socid='.$socid;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($socid) $param.='&socid='.$socid;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
@ -1631,9 +1653,9 @@ else
|
||||
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_frequency) $param.='&search_frequency=' .$search_frequency;
|
||||
if ($search_frequency > 0) $param.='&search_frequency=' .$search_frequency;
|
||||
if ($option) $param.="&option=".$option;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
@ -1646,14 +1668,20 @@ else
|
||||
|
||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
//$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
@ -1776,23 +1804,23 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("NbOfGenerationDone"),$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre(''); // Field may contains ling text
|
||||
if (! empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'],$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'],$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'],$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'],$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
@ -1800,26 +1828,67 @@ else
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
||||
print "</a></td>\n";
|
||||
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
||||
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (! empty($arrayfields['f.titre']['checked']))
|
||||
{
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
||||
print "</a></td>\n";
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
||||
}
|
||||
if (! empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
}
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
}
|
||||
if (! empty($arrayfields['f.frequency']['checked']))
|
||||
{
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '').'</td>';
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center">'.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').'</td>';
|
||||
print '<td align="center">'.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').'</td>';
|
||||
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency ? dol_print_date($db->jdate($objp->date_last_gen),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency ? dol_print_date($db->jdate($objp->date_when),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datec),'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->tms),'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
@ -1842,7 +1911,12 @@ else
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoneF").'</td></tr>';
|
||||
else
|
||||
{
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
@ -191,7 +191,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") || GETPOST("button_removefilter.x")) // All tests are required to be compatible with all browsers
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha') || GETPOST('button_removefilter.x','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
@ -531,6 +531,7 @@ if ($resql)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_societe)) $search_societe = $soc->name;
|
||||
}
|
||||
|
||||
$param='&socid='.$socid;
|
||||
|
||||
@ -378,7 +378,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total;
|
||||
$total += $obj->total_ht;
|
||||
$totalam += $obj->am;
|
||||
|
||||
$i++;
|
||||
|
||||
@ -151,9 +151,9 @@ class Localtax extends CommonObject
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
|
||||
$sql.= " localtaxtype=".$this->ltt.",";
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
|
||||
@ -54,8 +54,9 @@ if (empty($year))
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
|
||||
$date_start = dol_mktime( 0, 0, 0, GETPOST( "date_startmonth" ), GETPOST( "date_startday" ), GETPOST( "date_startyear" ) );
|
||||
$date_end = dol_mktime( 23, 59, 59, GETPOST( "date_endmonth" ), GETPOST( "date_endday" ), GETPOST( "date_endyear" ) );
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
@ -92,12 +93,9 @@ $socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* View
|
||||
*/
|
||||
|
||||
$morequerystring='';
|
||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||
foreach($listofparams as $param)
|
||||
@ -118,6 +116,7 @@ $paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
$fsearch.=' <input type="hidden" name="localTaxType" value="'.$local.'">';
|
||||
|
||||
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
||||
|
||||
@ -196,9 +195,8 @@ $total = 0;
|
||||
$i=0;
|
||||
|
||||
// Load arrays of datas
|
||||
$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
|
||||
$x_coll = tax_by_date('localtax' . $local, $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = tax_by_date('localtax' . $local, $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ if (empty($reshook))
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
|
||||
$tmpinvoice=new Facture($db);
|
||||
$tmpinvoice=new Facture($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
@ -188,7 +188,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Check if payments in both currency
|
||||
if ($totalpayment > 0 && $multicurrency_totalpayment > 0)
|
||||
{
|
||||
@ -228,7 +228,7 @@ if (empty($reshook))
|
||||
$newvalue = price2num($value,'MT');
|
||||
$amounts[$key] = -$newvalue;
|
||||
}
|
||||
|
||||
|
||||
foreach ($multicurrency_amounts as $key => $value) // How payment is dispatch
|
||||
{
|
||||
$newvalue = price2num($value,'MT');
|
||||
@ -319,7 +319,7 @@ llxHeader('', $langs->trans("Payment"));
|
||||
if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement')
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$result=$facture->fetch($facid);
|
||||
$result = $facture->fetch($facid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
@ -389,7 +389,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
subJson[n["name"]] = n["value"];
|
||||
});
|
||||
|
||||
|
||||
return subJson;
|
||||
}
|
||||
function callForResult(imgId)
|
||||
@ -516,31 +516,31 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
||||
print '<td class="tdtop">';
|
||||
print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('comment').'</textarea></td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* List of unpaid invoices
|
||||
*/
|
||||
|
||||
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, ';
|
||||
$sql.= ' f.datef as df, f.fk_soc as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
|
||||
|
||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
|
||||
}
|
||||
|
||||
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
$sql.= ' AND (f.fk_soc = '.$facture->socid;
|
||||
|
||||
|
||||
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
|
||||
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
|
||||
}
|
||||
|
||||
|
||||
$sql.= ') AND f.paye = 0';
|
||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||
if ($facture->type != 2)
|
||||
@ -577,7 +577,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
//print '<tr><td colspan="3">';
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$arraytitle.'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
@ -602,7 +602,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($objp->socid);
|
||||
@ -614,9 +614,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$deposits=$invoice->getSumDepositsUsed();
|
||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||
|
||||
|
||||
// Multicurrency Price
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$multicurrency_payment = $invoice->getSommePaiement(1);
|
||||
$multicurrency_creditnotes=$invoice->getSumCreditNotesUsed(1);
|
||||
@ -624,7 +624,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$multicurrency_alreadypayed=price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,'MT');
|
||||
$multicurrency_remaintopay=price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,'MT');
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>';
|
||||
@ -634,36 +634,36 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n";
|
||||
|
||||
|
||||
// Currency
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="center">'.$objp->multicurrency_code."</td>\n";
|
||||
|
||||
|
||||
// Multicurrency Price
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Multicurrency Price
|
||||
print '<td align="right">';
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
|
||||
{
|
||||
print price($sign * $multicurrency_payment);
|
||||
if ($multicurrency_creditnotes) print '+'.price($multicurrency_creditnotes);
|
||||
if ($multicurrency_deposits) print '+'.price($multicurrency_deposits);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Multicurrency Price
|
||||
print '<td align="right">';
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Price
|
||||
print '<td align="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||
|
||||
|
||||
// Received or paid back
|
||||
print '<td align="right">'.price($sign * $paiement);
|
||||
if ($creditnotes) print '+'.price($creditnotes);
|
||||
@ -685,7 +685,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
||||
print '<input type=hidden class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||
}
|
||||
else
|
||||
@ -696,14 +696,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print "</td>";
|
||||
|
||||
// Multicurrency Price
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<td align="right">';
|
||||
|
||||
|
||||
// Add remind multicurrency amount
|
||||
$namef = 'multicurrency_amount_'.$objp->facid;
|
||||
$nameRemain = 'multicurrency_remain_'.$objp->facid;
|
||||
|
||||
|
||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency)
|
||||
{
|
||||
if ($action != 'add_paiement')
|
||||
@ -723,7 +723,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
|
||||
// Warning
|
||||
print '<td align="center" width="16">';
|
||||
print '<td align="center" width="16">';
|
||||
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
|
||||
if ($amounts[$invoice->id] && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id]))
|
||||
|| $multicurrency_amounts[$invoice->id] && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id])))
|
||||
@ -744,7 +744,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$totalrecudeposits+=$deposits;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if ($i > 1)
|
||||
{
|
||||
// Print total
|
||||
@ -760,7 +760,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
|
||||
print '</b></td>';
|
||||
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
||||
print '<td align="right" id="result" style="font-weight: bold;"></td>';
|
||||
print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
@ -802,9 +802,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
|
||||
print '<br>';
|
||||
if (!empty($totalpayment)) $text=$langs->trans('ConfirmCustomerPayment',$totalpayment,$langs->trans("Currency".$conf->currency));
|
||||
if (!empty($multicurrency_totalpayment))
|
||||
if (!empty($multicurrency_totalpayment))
|
||||
{
|
||||
$text.='<br />'.$langs->trans('ConfirmCustomerPayment',$multicurrency_totalpayment,$langs->trans("paymentInInvoiceCurrency"));
|
||||
$text.='<br>'.$langs->trans('ConfirmCustomerPayment',$multicurrency_totalpayment,$langs->trans("paymentInInvoiceCurrency"));
|
||||
}
|
||||
if (GETPOST('closepaidinvoices'))
|
||||
{
|
||||
@ -864,7 +864,7 @@ if (! GETPOST('action','aZ09'))
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber."</a></td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
|
||||
@ -68,7 +68,7 @@ $accountstatic=new Account($db);
|
||||
*/
|
||||
|
||||
// If 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_ref='';
|
||||
$search_amount='';
|
||||
|
||||
@ -77,7 +77,7 @@ $extrafields = new ExtraFields($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
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','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_account="";
|
||||
|
||||
@ -57,7 +57,7 @@ $search_ref = GETPOST('search_ref','alpha');
|
||||
* 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_ref="";
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ $ligne=new LignePrelevement($db,$user);
|
||||
* 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_line="";
|
||||
$search_bon="";
|
||||
|
||||
@ -44,7 +44,7 @@ $action=GETPOST('action','aZ09');
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
||||
$result = restrictedArea($user, 'salaries', '', '', 'payment');
|
||||
|
||||
$object = new PaymentSalary($db);
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class PaymentSalary extends CommonObject
|
||||
//public $element='payment_salary'; //!< Id that identify managed objects
|
||||
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
||||
public $picto='payment';
|
||||
|
||||
|
||||
public $tms;
|
||||
public $fk_user;
|
||||
public $datep;
|
||||
@ -97,16 +97,16 @@ class PaymentSalary extends CommonObject
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " fk_user=".$this->fk_user.",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " datesp=".$this->db->idate($this->datesp).",";
|
||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
||||
$sql.= " datesp='".$this->db->idate($this->datesp)."',";
|
||||
$sql.= " dateep='".$this->db->idate($this->dateep)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||
@ -548,7 +548,7 @@ class PaymentSalary extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
|
||||
*
|
||||
@ -559,7 +559,7 @@ class PaymentSalary extends CommonObject
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -570,7 +570,7 @@ class PaymentSalary extends CommonObject
|
||||
function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
|
||||
|
||||
|
||||
$langs->load('compta');
|
||||
/*if ($mode == 0)
|
||||
{
|
||||
@ -609,5 +609,5 @@ class PaymentSalary extends CommonObject
|
||||
}*/
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ else
|
||||
* Actions
|
||||
*/
|
||||
|
||||
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="";
|
||||
|
||||
@ -71,7 +71,7 @@ else
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
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="";
|
||||
|
||||
@ -173,9 +173,9 @@ class Tva extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " tms='".$this->db->idate($this->tms)."',";
|
||||
$sql.= " datep='".$this->db->idate($this->datep)."',";
|
||||
$sql.= " datev='".$this->db->idate($this->datev)."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
|
||||
@ -117,7 +117,7 @@ $textprevyear="<a href=\"index.php?year=" . ($year_current-1) . "\">".img_previo
|
||||
$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>";
|
||||
|
||||
print $conf->dol_optimize_smallscreen;
|
||||
print load_fiche_titre($langs->trans("VAT"), $textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, 'title_accountancy.png');
|
||||
print load_fiche_titre($langs->transcountry("VAT", $mysoc->country_code), $textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, 'title_accountancy.png');
|
||||
|
||||
print $langs->trans("VATReportBuildWithOptionDefinedInModule").'<br>';
|
||||
print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')<br>';
|
||||
@ -263,18 +263,18 @@ if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
|
||||
print "<tr>";
|
||||
print '<td align="right">' . $langs->trans("VATDue") . '</td>'; // need to add translation
|
||||
print '<td class="nowrap" align="right">' . price(price2num($total, 1)) . '</td>';
|
||||
print '<td class="nowrap" align="right">' . price(price2num($total, 'MT')) . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>";
|
||||
print '<td align="right">' . $langs->trans("VATPaid") . '</td>';
|
||||
print '<td class="nowrap" align="right">' . price(price2num($obj->mm, 1)) . "</td>\n";
|
||||
print '<td class="nowrap" align="right">' . price(price2num($obj->mm, 'MT')) . "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$restopay = $total - $obj->mm;
|
||||
print "<tr>";
|
||||
print '<td align="right">' . $langs->trans("VATRestopay") . '</td>'; // need to add translation
|
||||
print '<td class="nowrap" align="right">' . price(price2num($restopay, 1)) . '</td>';
|
||||
print '<td class="nowrap" align="right">' . price(price2num($restopay, 'MT')) . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -74,7 +74,7 @@ else
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
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_ref="";
|
||||
$search_label="";
|
||||
|
||||
@ -122,7 +122,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
$actioncode='';
|
||||
$search_agenda_label='';
|
||||
|
||||
@ -625,7 +625,7 @@ else
|
||||
// EMail
|
||||
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party
|
||||
print '<tr><td><label for="email">'.$langs->trans("Email").'</label></td>';
|
||||
print '<td><input name="email" id="email" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.(GETPOST("email",'alpha')?GETPOST("email",'alpha'):$object->email).'"></td>';
|
||||
print '<td><input name="email" id="email" type="text" class="maxwidth100onsmartphone" value="'.(GETPOST("email",'alpha')?GETPOST("email",'alpha'):$object->email).'"></td>';
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
||||
@ -860,7 +860,7 @@ else
|
||||
|
||||
// EMail
|
||||
print '<tr><td><label for="email">'.$langs->trans("EMail").'</label></td>';
|
||||
print '<td><input name="email" id="email" type="text" class="flat maxwidthonsmartphone" maxlength="80" value="'.(isset($_POST["email"])?GETPOST("email"):$object->email).'"></td>';
|
||||
print '<td><input name="email" id="email" type="text" class="flat maxwidthonsmartphone" value="'.(isset($_POST["email"])?GETPOST("email"):$object->email).'"></td>';
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
@ -108,7 +108,7 @@ class Contact extends CommonObject
|
||||
$this->db = $db;
|
||||
$this->statut = 1; // By default, status is enabled
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load indicators into this->nb for board
|
||||
*
|
||||
@ -117,10 +117,10 @@ class Contact extends CommonObject
|
||||
function load_state_board()
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
|
||||
|
||||
$sql = "SELECT count(sp.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
@ -133,7 +133,7 @@ class Contact extends CommonObject
|
||||
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')';
|
||||
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
|
||||
if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -410,7 +410,9 @@ class Contact extends CommonObject
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
// Object classes
|
||||
$info = array();
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
||||
|
||||
$this->fullname=$this->getFullName($langs);
|
||||
@ -486,7 +488,7 @@ class Contact extends CommonObject
|
||||
$result=false;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// Mis a jour contact
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET";
|
||||
$sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
|
||||
@ -544,7 +546,7 @@ class Contact extends CommonObject
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -659,7 +661,7 @@ class Contact extends CommonObject
|
||||
$this->canvas = $obj->canvas;
|
||||
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
|
||||
// Define gender according to civility
|
||||
$this->setGenderFromCivility();
|
||||
|
||||
@ -735,7 +737,7 @@ class Contact extends CommonObject
|
||||
|
||||
/**
|
||||
* Set property ->gender from property ->civility_id
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setGenderFromCivility()
|
||||
@ -746,8 +748,8 @@ class Contact extends CommonObject
|
||||
} else if(in_array($this->civility_id, array('MME','MLE'))) {
|
||||
$this->gender = 'woman';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load number of elements the contact is used as a link for
|
||||
* ref_facturation
|
||||
@ -1007,13 +1009,13 @@ class Contact extends CommonObject
|
||||
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
|
||||
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
|
||||
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"';
|
||||
$linkclose="";
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowContact");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.= ' class="classfortooltip">';
|
||||
@ -1029,15 +1031,15 @@ class Contact extends CommonObject
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
|
||||
$link.=$linkclose;
|
||||
|
||||
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
if ($option == 'xxx')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
|
||||
return $result;
|
||||
|
||||
@ -48,12 +48,14 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $contactid,'');
|
||||
|
||||
$sall=GETPOST('sall', 'alphanohtml');
|
||||
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
|
||||
$search_phone=GETPOST("search_phone");
|
||||
|
||||
$search_firstlast_only=GETPOST("search_firstlast_only");
|
||||
$search_lastname=GETPOST("search_lastname");
|
||||
$search_firstname=GETPOST("search_firstname");
|
||||
$search_societe=GETPOST("search_societe");
|
||||
$search_poste=GETPOST("search_poste");
|
||||
$search_phone=GETPOST("search_phone");
|
||||
$search_phone_perso=GETPOST("search_phone_perso");
|
||||
$search_phone_pro=GETPOST("search_phone_pro");
|
||||
$search_phone_mobile=GETPOST("search_phone_mobile");
|
||||
@ -272,53 +274,25 @@ if ($search_categ > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_ca
|
||||
if ($search_categ == -2) $sql.= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_categ_thirdparty > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty);
|
||||
if ($search_categ_thirdparty == -2) $sql.= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
|
||||
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
|
||||
if ($search_categ_supplier > 0) $sql.= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier);
|
||||
if ($search_categ_supplier == -2) $sql.= " AND cs2.fk_categorie IS NULL";
|
||||
|
||||
if ($search_firstlast_only) {
|
||||
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
|
||||
}
|
||||
if ($search_lastname) { // filter on lastname
|
||||
$sql .= natural_search('p.lastname', $search_lastname);
|
||||
}
|
||||
if ($search_firstname) { // filter on firstname
|
||||
$sql .= natural_search('p.firstname', $search_firstname);
|
||||
}
|
||||
if ($search_societe) { // filtre sur la societe
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if (strlen($search_poste)) { // filtre sur la societe
|
||||
$sql .= natural_search('p.poste', $search_poste);
|
||||
}
|
||||
if (strlen($search_phone))
|
||||
{
|
||||
$sql .= " AND (p.phone LIKE '%".$db->escape($search_phone)."%' OR p.phone_perso LIKE '%".$db->escape($search_phone)."%' OR p.phone_mobile LIKE '%".$db->escape($search_phone)."%')";
|
||||
}
|
||||
if (strlen($search_phone_perso))
|
||||
{
|
||||
$sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phone_perso)."%'";
|
||||
}
|
||||
if (strlen($search_phone_pro))
|
||||
{
|
||||
$sql .= " AND p.phone LIKE '%".$db->escape($search_phone_pro)."%'";
|
||||
}
|
||||
if (strlen($search_phone_mobile))
|
||||
{
|
||||
$sql .= " AND p.phone_mobile LIKE '%".$db->escape($search_phone_mobile)."%'";
|
||||
}
|
||||
if (strlen($search_fax))
|
||||
{
|
||||
$sql .= " AND p.fax LIKE '%".$db->escape($search_fax)."%'";
|
||||
}
|
||||
if (strlen($search_email)) // filtre sur l'email
|
||||
{
|
||||
$sql .= " AND p.email LIKE '%".$db->escape($search_email)."%'";
|
||||
}
|
||||
if (strlen($search_skype)) // filtre sur skype
|
||||
{
|
||||
$sql .= " AND p.skype LIKE '%".$db->escape($search_skype)."%'";
|
||||
}
|
||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if (strlen($search_phone)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_phone);
|
||||
if (strlen($search_cti)) $sql.= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_cti);
|
||||
if (strlen($search_firstlast_only)) $sql.= natural_search(array('p.lastname', 'p.firstname'), $search_firstlast_only);
|
||||
|
||||
if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
|
||||
if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
|
||||
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
|
||||
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
|
||||
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
|
||||
if (strlen($search_fax)) $sql.= natural_search('p.phone_fax', $search_fax);
|
||||
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
|
||||
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
|
||||
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($type == "o") // filtre sur type
|
||||
{
|
||||
$sql .= " AND p.fk_soc IS NULL";
|
||||
@ -335,10 +309,6 @@ else if ($type == "p") // filtre sur type
|
||||
{
|
||||
$sql .= " AND s.client IN (2, 3)";
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if (! empty($socid))
|
||||
{
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
@ -391,7 +361,7 @@ $num = $db->num_rows($result);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != ''))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
|
||||
@ -1278,6 +1278,15 @@ class Contrat extends CommonObject
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
@ -1633,8 +1642,8 @@ class Contrat extends CommonObject
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$contractline->array_options=$array_options;
|
||||
$contractline->id= $rowid;
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
|
||||
@ -146,7 +146,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 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
|
||||
{
|
||||
$day='';
|
||||
$month='';
|
||||
@ -306,6 +306,13 @@ if ($resql)
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_name)) $search_name = $soc->name;
|
||||
}
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
@ -152,7 +152,7 @@ if (empty($reshook))
|
||||
// Selection of new fields
|
||||
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_name="";
|
||||
$search_contract="";
|
||||
@ -332,7 +332,7 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
|
||||
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
|
||||
@ -523,7 +523,6 @@ while ($i < min($num,$limit))
|
||||
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
|
||||
@ -32,16 +32,19 @@ if ($action == 'setModuleOptions')
|
||||
$db->begin();
|
||||
|
||||
// Process common param fields
|
||||
foreach($_POST as $key => $val)
|
||||
if (is_array($_POST))
|
||||
{
|
||||
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
$param=GETPOST("param".$reg[1],'alpha');
|
||||
$value=GETPOST("value".$reg[1],'alpha');
|
||||
if ($param)
|
||||
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
||||
{
|
||||
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$param=GETPOST("param".$reg[1],'alpha');
|
||||
$value=GETPOST("value".$reg[1],'alpha');
|
||||
if ($param)
|
||||
{
|
||||
$res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,17 @@ if (! isset($usedbyinclude) || empty($usedbyinclude))
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN','1');
|
||||
|
||||
$res=@include '../../main.inc.php';
|
||||
if ($res == 'ERROR_NOT_LOGGED')
|
||||
{
|
||||
$langs->load("other");
|
||||
$arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
|
||||
print json_encode($arrayresult);
|
||||
if (is_object($db)) $db->close();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user