Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict Conflicts: htdocs/compta/facture/card.php htdocs/compta/facture/class/facture-rec.class.php
This commit is contained in:
commit
8e8f94df11
31
ChangeLog
31
ChangeLog
@ -158,6 +158,37 @@ content by doing a print into function, sometimes by returning content into "res
|
|||||||
hook specifications so you must return output into "resprint".
|
hook specifications so you must return output into "resprint".
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||||
|
FIX: #7075 : bad path for document
|
||||||
|
FIX: #7156
|
||||||
|
FIX: #7173
|
||||||
|
FIX: #7224
|
||||||
|
FIX: #7226
|
||||||
|
FIX: #7239
|
||||||
|
FIX: add supplierproposaldet without price (new product)
|
||||||
|
FIX: amount overlap other amount when a pagebreak is done due to an image at the bottom of page.
|
||||||
|
FIX: Bad tax calculation with expense report
|
||||||
|
FIX: Best buy price calculation
|
||||||
|
FIX: Buying prices must always be in positive value.
|
||||||
|
FIX: calculate correct remain to pay for planned bank transactions
|
||||||
|
FIX: delete linked element on facture rec
|
||||||
|
FIX: edit sociale was emptying label
|
||||||
|
FIX: Error when updating thirdparty not returned
|
||||||
|
FIX: holidays with postgresql like on rowid integer
|
||||||
|
FIX: id of user not saved when making a payment of expense report
|
||||||
|
FIX: invoice page list
|
||||||
|
FIX: invoice situation VAT total rounding into PDF crabe
|
||||||
|
FIX: PgSQL compatibility.
|
||||||
|
FIX: remove order rights on invoice page
|
||||||
|
FIX: status were wrong on product referent list
|
||||||
|
FIX: supplier id was not passed to hooks
|
||||||
|
FIX: Support of vat code when using price per customer
|
||||||
|
FIX: User id correction on holiday request
|
||||||
|
FIX: value of user id filled to 0 in llx_bank_url when recording an expense report.
|
||||||
|
FIX: we have to check if contact doesn't already exist on add_contact() function
|
||||||
|
FIX: We should be able to insert data with value '0' into const
|
||||||
|
FIX: install process with DoliWamp
|
||||||
|
|
||||||
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
|
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
|
||||||
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
|
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
|
||||||
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
|
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
|
||||||
|
|||||||
31
README.md
31
README.md
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||||
|
|
||||||
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
|
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||||
|
|
||||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||||
|
|
||||||
@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
|||||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||||
|
|
||||||
### Install from composer
|
### Install from composer
|
||||||
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
|
|
||||||
|
|
||||||
|
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
curl -sS https://getcomposer.org/installer | php
|
curl -sS https://getcomposer.org/installer | php
|
||||||
mv composer.phar /usr/local/bin/composer
|
mv composer.phar /usr/local/bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
|
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
|
||||||
|
|
||||||
|
You can then create a new project
|
||||||
|
|
||||||
|
```bash
|
||||||
composer create-project dolibarr/dolibarr erp
|
composer create-project dolibarr/dolibarr erp
|
||||||
|
```
|
||||||
|
|
||||||
### Simple setup
|
### Simple setup
|
||||||
|
|
||||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
|
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||||
|
|
||||||
- DoliWamp for Windows
|
- DoliWamp for Windows
|
||||||
- DoliDeb for Debian or Ubuntu
|
- DoliDeb for Debian or Ubuntu
|
||||||
@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
|
|||||||
|
|
||||||
### Advanced setup
|
### Advanced setup
|
||||||
|
|
||||||
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
|
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||||
|
|
||||||
- Uncompress the downloaded archive
|
- Uncompress the downloaded archive
|
||||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
|
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
|
||||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
|
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
|
||||||
- From your browser, go to the dolibarr "install/" page
|
- From your browser, go to the dolibarr "install/" page
|
||||||
|
|
||||||
The URL will depends on choices made in the first step:
|
The URL will depends on choices made in the first step:
|
||||||
@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
|||||||
## UPGRADING
|
## UPGRADING
|
||||||
|
|
||||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||||
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
|
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
|
||||||
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
|
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||||
|
|
||||||
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||||
|
|
||||||
|
|
||||||
## WHAT'S NEW
|
## WHAT'S NEW
|
||||||
@ -172,7 +179,7 @@ Administrator, user, developer and translator's documentations are available alo
|
|||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
See [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) file
|
||||||
|
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|||||||
@ -49,6 +49,8 @@ if (empty($argv[1]))
|
|||||||
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
|
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
|
||||||
exit -1;
|
exit -1;
|
||||||
}
|
}
|
||||||
|
parse_str($argv[1]);
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $argc)
|
while ($i < $argc)
|
||||||
{
|
{
|
||||||
@ -98,9 +100,9 @@ foreach ($includeconstants as $countrycode => $tmp)
|
|||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||||
$outputdir=dirname(__FILE__).'/../htdocs/install';
|
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
|
||||||
print 'Delete current files '.$outputdir.'/filelist-'.$release.'.xml'."\n";
|
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
|
||||||
dol_delete_file($outputdir.'/filelist-'.$release.'.xml',0,1,1);
|
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
|
||||||
|
|
||||||
$checksumconcat=array();
|
$checksumconcat=array();
|
||||||
|
|
||||||
|
|||||||
9419
dev/initdemo/mysqldump_dolibarr_6.0.0.sql
Normal file
9419
dev/initdemo/mysqldump_dolibarr_6.0.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -192,6 +192,7 @@ export list="
|
|||||||
--ignore-table=$base.llx_cabinetmed_c_ccam
|
--ignore-table=$base.llx_cabinetmed_c_ccam
|
||||||
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
||||||
--ignore-table=$base.llx_cabinetmed_cons
|
--ignore-table=$base.llx_cabinetmed_cons
|
||||||
|
--ignore-table=$base.llx_cabinetmed_cons_extrafields
|
||||||
--ignore-table=$base.llx_cabinetmed_diaglec
|
--ignore-table=$base.llx_cabinetmed_diaglec
|
||||||
--ignore-table=$base.llx_cabinetmed_examaut
|
--ignore-table=$base.llx_cabinetmed_examaut
|
||||||
--ignore-table=$base.llx_cabinetmed_exambio
|
--ignore-table=$base.llx_cabinetmed_exambio
|
||||||
@ -207,7 +208,18 @@ export list="
|
|||||||
--ignore-table=$base.llx_dolicloud_customers
|
--ignore-table=$base.llx_dolicloud_customers
|
||||||
--ignore-table=$base.llx_dolicloud_stats
|
--ignore-table=$base.llx_dolicloud_stats
|
||||||
--ignore-table=$base.llx_dolicloud_emailstemplates
|
--ignore-table=$base.llx_dolicloud_emailstemplates
|
||||||
|
--ignore-table=$base.llx_dolireport_column
|
||||||
|
--ignore-table=$base.llx_dolireport_criteria
|
||||||
|
--ignore-table=$base.llx_dolireport_graph
|
||||||
|
--ignore-table=$base.llx_dolireport_plot
|
||||||
|
--ignore-table=$base.llx_dolireport_report
|
||||||
--ignore-table=$base.llx_domain
|
--ignore-table=$base.llx_domain
|
||||||
|
--ignore-table=$base.llx_ecommerce_commande
|
||||||
|
--ignore-table=$base.llx_ecommerce_facture
|
||||||
|
--ignore-table=$base.llx_ecommerce_product
|
||||||
|
--ignore-table=$base.llx_ecommerce_site
|
||||||
|
--ignore-table=$base.llx_ecommerce_societe
|
||||||
|
--ignore-table=$base.llx_ecommerce_socpeople
|
||||||
--ignore-table=$base.llx_element_rang
|
--ignore-table=$base.llx_element_rang
|
||||||
--ignore-table=$base.llx_entity
|
--ignore-table=$base.llx_entity
|
||||||
--ignore-table=$base.llx_filemanager_roots
|
--ignore-table=$base.llx_filemanager_roots
|
||||||
@ -215,6 +227,8 @@ export list="
|
|||||||
--ignore-table=$base.llx_google_maps
|
--ignore-table=$base.llx_google_maps
|
||||||
--ignore-table=$base.llx_milestone
|
--ignore-table=$base.llx_milestone
|
||||||
--ignore-table=$base.llx_monitoring_probes
|
--ignore-table=$base.llx_monitoring_probes
|
||||||
|
--ignore-table=$base.llx_m
|
||||||
|
--ignore-table=$base.llx_m_extrafields
|
||||||
--ignore-table=$base.llx_notes
|
--ignore-table=$base.llx_notes
|
||||||
--ignore-table=$base.llx_pos_cash
|
--ignore-table=$base.llx_pos_cash
|
||||||
--ignore-table=$base.llx_pos_control_cash
|
--ignore-table=$base.llx_pos_control_cash
|
||||||
|
|||||||
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
@ -4,7 +4,7 @@ use Stripe\BankAccount;
|
|||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
|||||||
@ -158,6 +158,7 @@ class Adherent extends CommonObject
|
|||||||
$from=$conf->email_from;
|
$from=$conf->email_from;
|
||||||
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
|
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
|
||||||
|
|
||||||
|
// Send email (substitutionarray must be done just before this)
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
|
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
|
||||||
if ($mailfile->sendfile())
|
if ($mailfile->sendfile())
|
||||||
|
|||||||
@ -114,7 +114,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans($company->error);
|
|
||||||
setEventMessages($company->error, $company->errors, 'errors');
|
setEventMessages($company->error, $company->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -124,7 +123,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
|
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
|
||||||
}
|
}
|
||||||
$subscription=$_POST["subscription"]; // Amount of subscription
|
$subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
|
||||||
$label=$_POST["label"];
|
$label=$_POST["label"];
|
||||||
|
|
||||||
// Payment informations
|
// Payment informations
|
||||||
@ -230,6 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
if (GETPOST('end') && ! $datesubend)
|
if (GETPOST('end') && ! $datesubend)
|
||||||
@ -237,6 +237,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
if (! $datesubend)
|
if (! $datesubend)
|
||||||
@ -247,16 +248,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$amount = price2num(GETPOST("subscription",'alpha'));
|
||||||
|
|
||||||
// Check if a payment is mandatory or not
|
// Check if a payment is mandatory or not
|
||||||
if (! $error && $adht->subscription) // Member type need subscriptions
|
if (! $error && $adht->subscription) // Member type need subscriptions
|
||||||
{
|
{
|
||||||
if (! is_numeric($_POST["subscription"]))
|
if (! is_numeric($amount))
|
||||||
{
|
{
|
||||||
// If field is '' or not a numeric value
|
// If field is '' or not a numeric value
|
||||||
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
$action='addsubscription';
|
$action='addsubscription';
|
||||||
}
|
}
|
||||||
@ -274,7 +279,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
|
||||||
}
|
}
|
||||||
if ($errmsg) $action='addsubscription';
|
if ($errmsg)
|
||||||
|
{
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
|
$action='addsubscription';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,6 +329,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$db->lasterror();
|
$errmsg=$db->lasterror();
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -327,14 +337,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
$error++;
|
$error++;
|
||||||
$errmsg=$acct->error;
|
$errmsg=$acct->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
}
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg=$acct->error;
|
$errmsg=$acct->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
}
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If option choosed, we create invoice
|
// If option choosed, we create invoice
|
||||||
@ -352,6 +364,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,6 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$customer->error;
|
$errmsg=$customer->error;
|
||||||
$errmsgs=$acct->errors;
|
$errmsgs=$acct->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,6 +393,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg='ErrorNoPaymentTermRECEPFound';
|
$errmsg='ErrorNoPaymentTermRECEPFound';
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$invoice->socid=$object->fk_soc;
|
$invoice->socid=$object->fk_soc;
|
||||||
@ -396,6 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
$errmsgs=$invoice->errors;
|
$errmsgs=$invoice->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,6 +432,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,6 +445,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$invoice->error;
|
$errmsg=$invoice->error;
|
||||||
$errmsgs=$invoice->errors;
|
$errmsgs=$invoice->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,6 +473,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
$errmsg=$paiement->error;
|
||||||
$errmsgs=$paiement->errors;
|
$errmsgs=$paiement->errors;
|
||||||
|
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -536,6 +555,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
|
setEventMessages($errmsg, null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -207,24 +207,26 @@ $head=expensereport_admin_prepare_head();
|
|||||||
|
|
||||||
dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip');
|
dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip');
|
||||||
|
|
||||||
// Interventions numbering model
|
|
||||||
/*
|
/*
|
||||||
print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
|
* Expense report numbering model
|
||||||
|
*/
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("ExpenseReportNumberingModules"),'','');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td>'.$langs->trans("Example").'</td>';
|
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||||
print "</tr>\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/fichinter/");
|
$dir = dol_buildpath($reldir."core/modules/expensereport/");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -235,21 +237,20 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
|
if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||||
{
|
{
|
||||||
$file = $reg[1];
|
$file = substr($file, 0, dol_strlen($file)-4);
|
||||||
$classname = substr($file,4);
|
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file($db);
|
||||||
|
|
||||||
|
// Show modules according to features level
|
||||||
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||||
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||||
|
|
||||||
if ($module->isEnabled())
|
if ($module->isEnabled())
|
||||||
{
|
{
|
||||||
// Show modules according to features level
|
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||||
print $module->info();
|
print $module->info();
|
||||||
@ -264,24 +265,26 @@ foreach ($dirmodels as $reldir)
|
|||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($conf->global->FICHEINTER_ADDON == $classname)
|
if ($conf->global->EXPENSEREPORT_ADDON == $file)
|
||||||
{
|
{
|
||||||
print img_picto($langs->trans("Activated"),'switch_on');
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'">';
|
||||||
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$ficheinter=new Fichinter($db);
|
$exp=new ExpenseReport($db);
|
||||||
$ficheinter->initAsSpecimen();
|
$exp->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip='';
|
$htmltooltip='';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval=$module->getNextValue($mysoc,$ficheinter);
|
$nextval=$module->getNextValue($exp);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval) {
|
if ($nextval) {
|
||||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
@ -291,11 +294,12 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,9 +307,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print "</table><br>\n";
|
||||||
print '</table><br>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents models for Interventions
|
* Documents models for Interventions
|
||||||
|
|||||||
@ -495,7 +495,6 @@ print "<br>";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Other options
|
* Other options
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||||
|
|||||||
@ -101,25 +101,24 @@ if ($action == 'edit')
|
|||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$var=true;
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_UNIT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_UNIT . '"></td></tr>';
|
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_UNIT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_UNIT . '"></td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_TOT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_TOT . '"></td></tr>';
|
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_TOT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_TOT . '"></td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td><input class="flat" name="MAIN_MAX_DECIMALS_SHOWN" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_SHOWN . '"></td></tr>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td><input class="flat" name="MAIN_MAX_DECIMALS_SHOWN" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_SHOWN . '"></td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_ROUNDING_RULE_TOT" size="3" value="' . $conf->global->MAIN_ROUNDING_RULE_TOT . '"></td></tr>';
|
print '</td><td><input class="flat" name="MAIN_ROUNDING_RULE_TOT" size="3" value="' . $conf->global->MAIN_ROUNDING_RULE_TOT . '"></td></tr>';
|
||||||
@ -135,25 +134,23 @@ if ($action == 'edit')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$var=true;
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_UNIT.'</td></tr>';
|
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_UNIT.'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_TOT.'</td></tr>';
|
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_TOT.'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'</td></tr>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td align="right">'.$conf->global->MAIN_ROUNDING_RULE_TOT.'</td></tr>';
|
print '</td><td align="right">'.$conf->global->MAIN_ROUNDING_RULE_TOT.'</td></tr>';
|
||||||
|
|||||||
@ -46,13 +46,18 @@ if ($action == 'test' || $action == 'send')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$substitutionarrayfortest=array(
|
$substitutionarrayfortest=array(
|
||||||
'__LOGIN__' => $user->login,
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
'__ID__' => 'TESTIdRecord',
|
'__ID__' => 'RecipientIdRecord',
|
||||||
'__EMAIL__' => 'TESTEMail',
|
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||||
'__LASTNAME__' => 'TESTLastname',
|
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
|
||||||
'__FIRSTNAME__' => 'TESTFirstname',
|
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''), // Done into actions_sendmails
|
||||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''),
|
'__LOGIN__' => 'RecipientLogin',
|
||||||
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
'__LASTNAME__' => 'RecipientLastname',
|
||||||
|
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||||
|
'__ADDRESS__'=> 'RecipientAddress',
|
||||||
|
'__ZIP__'=> 'RecipientZip',
|
||||||
|
'__TOWN_'=> 'RecipientTown',
|
||||||
|
'__COUNTRY__'=> 'RecipientCountry'
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarrayfortest, $langs);
|
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||||
|
|
||||||
@ -114,7 +119,7 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S
|
|||||||
if (! $server) $server='127.0.0.1';
|
if (! $server) $server='127.0.0.1';
|
||||||
|
|
||||||
|
|
||||||
$wikihelp='EN:Setup EMails|FR:Paramétrage EMails|ES:Configuración EMails';
|
$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
|
||||||
llxHeader('',$langs->trans("Setup"),$wikihelp);
|
llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
|
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
|
||||||
@ -127,6 +132,14 @@ $head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
|||||||
$head[$h][2] = 'common';
|
$head[$h][2] = 'common';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
if ($conf->mailing->enabled)
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
|
||||||
|
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
|
||||||
|
$head[$h][2] = 'common_emailing';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
||||||
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
||||||
$head[$h][2] = 'templates';
|
$head[$h][2] = 'templates';
|
||||||
@ -238,7 +251,7 @@ if ($action == 'edit')
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
// Disable
|
// Disable
|
||||||
|
|
||||||
@ -462,7 +475,7 @@ else
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
// Disable
|
// Disable
|
||||||
|
|
||||||
|
|||||||
643
htdocs/admin/mails_emailing.php
Normal file
643
htdocs/admin/mails_emailing.php
Normal file
@ -0,0 +1,643 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/admin/mails.php
|
||||||
|
* \brief Page to setup emails sending
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("products");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("mails");
|
||||||
|
$langs->load("other");
|
||||||
|
$langs->load("errors");
|
||||||
|
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$usersignature=$user->signature;
|
||||||
|
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||||
|
if ($action == 'test' || $action == 'send')
|
||||||
|
{
|
||||||
|
$usersignature=dol_string_nohtmltag($usersignature);
|
||||||
|
}
|
||||||
|
|
||||||
|
$substitutionarrayfortest=array(
|
||||||
|
'__LOGIN__' => $user->login,
|
||||||
|
'__ID__' => 'TESTIdRecord',
|
||||||
|
'__EMAIL__' => 'TESTEMail',
|
||||||
|
'__LASTNAME__' => 'TESTLastname',
|
||||||
|
'__FIRSTNAME__' => 'TESTFirstname',
|
||||||
|
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''),
|
||||||
|
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
||||||
|
);
|
||||||
|
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'update' && empty($_POST["cancel"]))
|
||||||
|
{
|
||||||
|
// Send mode parameters
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"),'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"),'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"),'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_EMAILING", GETPOST("MAIN_MAIL_SMTPS_ID_EMAILING"), 'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING"), 'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"),'chaine',0,'',$conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Actions to send emails
|
||||||
|
$id=0;
|
||||||
|
$actiontypecode=''; // Not an event for agenda
|
||||||
|
$trigger_name=''; // Disable triggers
|
||||||
|
$paramname='id';
|
||||||
|
$mode='emailfortest';
|
||||||
|
$trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||||
|
$sendcontext='emailing'; // Force to use dedicated context of setup for emailing
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
|
||||||
|
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$linuxlike=1;
|
||||||
|
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||||
|
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING)) $conf->global->MAIN_MAIL_SENDMODE_EMAILING='default';
|
||||||
|
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING)?$conf->global->MAIN_MAIL_SMTP_PORT_EMAILING:ini_get('smtp_port');
|
||||||
|
if (! $port) $port=25;
|
||||||
|
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:ini_get('SMTP');
|
||||||
|
if (! $server) $server='127.0.0.1';
|
||||||
|
|
||||||
|
|
||||||
|
$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
|
||||||
|
llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
|
||||||
|
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
||||||
|
$head[$h][2] = 'common';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
if ($conf->mailing->enabled)
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
|
||||||
|
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
|
||||||
|
$head[$h][2] = 'common_emailing';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
||||||
|
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
||||||
|
$head[$h][2] = 'templates';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
|
||||||
|
// List of sending methods
|
||||||
|
$listofmethods=array();
|
||||||
|
$listofmethods['default']=$langs->trans('DefaultOutgoingEmailSetup');
|
||||||
|
$listofmethods['mail']='PHP mail function';
|
||||||
|
//$listofmethods['simplemail']='Simplemail class';
|
||||||
|
$listofmethods['smtps']='SMTP/SMTPS socket library';
|
||||||
|
$listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||||
|
|
||||||
|
|
||||||
|
if ($action == 'edit')
|
||||||
|
{
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
if ($conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
print 'jQuery(document).ready(function () {
|
||||||
|
function initfields()
|
||||||
|
{
|
||||||
|
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\')
|
||||||
|
{
|
||||||
|
jQuery(".hideifdefault").hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jQuery(".hideifdefault").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\')
|
||||||
|
{
|
||||||
|
jQuery(".drag").hide();
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
|
||||||
|
';
|
||||||
|
if ($linuxlike)
|
||||||
|
{
|
||||||
|
print '
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").hide();
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").hide();
|
||||||
|
jQuery("#smtp_server_mess").show();
|
||||||
|
jQuery("#smtp_port_mess").show();
|
||||||
|
';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true);
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true);
|
||||||
|
jQuery("#smtp_server_mess").hide();
|
||||||
|
jQuery("#smtp_port_mess").hide();
|
||||||
|
';
|
||||||
|
}
|
||||||
|
print '
|
||||||
|
}
|
||||||
|
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\')
|
||||||
|
{
|
||||||
|
jQuery(".drag").show();
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
|
||||||
|
jQuery("#smtp_server_mess").hide();
|
||||||
|
jQuery("#smtp_port_mess").hide();
|
||||||
|
}
|
||||||
|
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
|
||||||
|
{
|
||||||
|
jQuery(".drag").show();
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
|
||||||
|
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
|
||||||
|
jQuery("#smtp_server_mess").hide();
|
||||||
|
jQuery("#smtp_port_mess").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initfields();
|
||||||
|
jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
|
||||||
|
initfields();
|
||||||
|
});
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
|
||||||
|
if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
|
||||||
|
});
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").change(function() {
|
||||||
|
if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
|
||||||
|
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
|
||||||
|
});
|
||||||
|
})';
|
||||||
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'common_emailing', '', -1);
|
||||||
|
|
||||||
|
print $langs->trans("EMailsDesc")."<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
// Method
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||||
|
|
||||||
|
// SuperAdministrator access only
|
||||||
|
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
|
||||||
|
{
|
||||||
|
print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING',$listofmethods,$conf->global->MAIN_MAIL_SENDMODE_EMAILING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
|
||||||
|
if (empty($text)) $text = $langs->trans("Undefined");
|
||||||
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
|
print $form->textwithpicto($text,$htmltext,1,'superadmin');
|
||||||
|
print '<input type="hidden" name="MAIN_MAIL_SENDMODE_EMAILING" value="'.$conf->global->MAIN_MAIL_SENDMODE_EMAILING.'">';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Host server
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>';
|
||||||
|
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')
|
||||||
|
{
|
||||||
|
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||||
|
print '</td><td>';
|
||||||
|
print $langs->trans("SeeLocalSendMailSetup");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:'');
|
||||||
|
$smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined");
|
||||||
|
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||||
|
else print $langs->trans("MAIN_MAIL_SMTP_SERVER",$smtpserver);
|
||||||
|
print '</td><td>';
|
||||||
|
// SuperAdministrator access only
|
||||||
|
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
|
||||||
|
{
|
||||||
|
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="' . $mainserver . '">';
|
||||||
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="' . $mainserver . '">';
|
||||||
|
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text = ! empty($mainserver) ? $mainserver : $smtpserver;
|
||||||
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
|
print $form->textwithpicto($text,$htmltext,1,'superadmin');
|
||||||
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Port
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>';
|
||||||
|
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')
|
||||||
|
{
|
||||||
|
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||||
|
print '</td><td>';
|
||||||
|
print $langs->trans("SeeLocalSendMailSetup");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
|
||||||
|
$smtpport = ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined");
|
||||||
|
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||||
|
else print $langs->trans("MAIN_MAIL_SMTP_PORT",$smtpport);
|
||||||
|
print '</td><td>';
|
||||||
|
// SuperAdministrator access only
|
||||||
|
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
|
||||||
|
{
|
||||||
|
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="' . $mainport . '">';
|
||||||
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="' . $mainport . '">';
|
||||||
|
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text = (! empty($mainport) ? $mainport : $smtpport);
|
||||||
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
|
print $form->textwithpicto($text,$htmltext,1,'superadmin');
|
||||||
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="'.$mainport.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// ID
|
||||||
|
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
|
||||||
|
{
|
||||||
|
|
||||||
|
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:'');
|
||||||
|
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||||
|
// SuperAdministrator access only
|
||||||
|
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||||
|
{
|
||||||
|
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="' . $mainstmpid . '">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
|
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING,$htmltext,1,'superadmin');
|
||||||
|
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="'.$mainstmpid.'">';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// PW
|
||||||
|
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
|
||||||
|
{
|
||||||
|
|
||||||
|
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING:'');
|
||||||
|
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
|
||||||
|
// SuperAdministrator access only
|
||||||
|
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
|
||||||
|
{
|
||||||
|
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
|
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING,$htmltext,1,'superadmin');
|
||||||
|
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="'.$mainsmtppw.'">';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// TLS
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||||
|
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
|
||||||
|
{
|
||||||
|
if (function_exists('openssl_open'))
|
||||||
|
{
|
||||||
|
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING',(! empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING)?$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING:0),1);
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// STARTTLS
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||||
|
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
|
||||||
|
{
|
||||||
|
if (function_exists('openssl_open'))
|
||||||
|
{
|
||||||
|
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING',(! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING)?$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING:0),1);
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
print '<br><div class="center">';
|
||||||
|
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_fiche_head($head, 'common_emailing', '', -1);
|
||||||
|
|
||||||
|
print $langs->trans("EMailsDesc")."<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
// Method
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||||
|
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
|
||||||
|
if (empty($text)) $text=$langs->trans("Undefined").img_warning();
|
||||||
|
print $text;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
|
{
|
||||||
|
// Host server
|
||||||
|
|
||||||
|
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:'').'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Port
|
||||||
|
|
||||||
|
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING)?$conf->global->MAIN_MAIL_SMTP_PORT_EMAILING:'').'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// SMTPS ID
|
||||||
|
|
||||||
|
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// SMTPS PW
|
||||||
|
|
||||||
|
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING).'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// TLS
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||||
|
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
|
||||||
|
{
|
||||||
|
if (function_exists('openssl_open'))
|
||||||
|
{
|
||||||
|
print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING);
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// STARTTLS
|
||||||
|
|
||||||
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||||
|
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
|
||||||
|
{
|
||||||
|
if (function_exists('openssl_open'))
|
||||||
|
{
|
||||||
|
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING);
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
|
}
|
||||||
|
else print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
/*
|
||||||
|
// Warning 1
|
||||||
|
if ($linuxlike)
|
||||||
|
{
|
||||||
|
$sendmailoption=ini_get('mail.force_extra_parameters');
|
||||||
|
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
|
||||||
|
{
|
||||||
|
print info_admin($langs->trans("SendmailOptionNotComplete"));
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
// Warning 2
|
||||||
|
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Boutons actions
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
|
{
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || ! $linuxlike)
|
||||||
|
{
|
||||||
|
if (function_exists('fsockopen') && $port && $server)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||||
|
|
||||||
|
if (! empty($conf->fckeditor->enabled))
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
|
||||||
|
{
|
||||||
|
$text = $langs->trans("WarningPHPMail");
|
||||||
|
print info_admin($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the test to connect
|
||||||
|
if ($action == 'testconnect')
|
||||||
|
{
|
||||||
|
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
|
$mail = new CMailFile('','','','');
|
||||||
|
$result=$mail->check_server_port($server,$port);
|
||||||
|
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errormsg = $langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
|
||||||
|
|
||||||
|
if ($mail->error) {
|
||||||
|
$errormsg .= ' - '.$mail->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
setEventMessages($errormsg, null, 'errors');
|
||||||
|
}
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show email send test form
|
||||||
|
if ($action == 'test' || $action == 'testhtml')
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
|
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
|
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||||
|
$formmail->withfromreadonly=0;
|
||||||
|
$formmail->withsubstit=0;
|
||||||
|
$formmail->withfrom=1;
|
||||||
|
$formmail->witherrorsto=1;
|
||||||
|
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
|
||||||
|
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
|
||||||
|
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
|
||||||
|
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
|
||||||
|
$formmail->withtopicreadonly=0;
|
||||||
|
$formmail->withfile=2;
|
||||||
|
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->transnoentities("PredefinedMailTestHtml"):$langs->transnoentities("PredefinedMailTest")));
|
||||||
|
$formmail->withbodyreadonly=0;
|
||||||
|
$formmail->withcancel=1;
|
||||||
|
$formmail->withdeliveryreceipt=1;
|
||||||
|
$formmail->withfckeditor=($action == 'testhtml'?1:0);
|
||||||
|
$formmail->ckeditortoolbar='dolibarr_mailings';
|
||||||
|
// Tableau des substitutions
|
||||||
|
$formmail->substit=$substitutionarrayfortest;
|
||||||
|
// Tableau des parametres complementaires du post
|
||||||
|
$formmail->param["action"]="send";
|
||||||
|
$formmail->param["models"]="body";
|
||||||
|
$formmail->param["mailid"]=0;
|
||||||
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
|
// Init list of files
|
||||||
|
if (GETPOST("mode")=='init')
|
||||||
|
{
|
||||||
|
$formmail->clear_attached_files();
|
||||||
|
}
|
||||||
|
|
||||||
|
print $formmail->get_form('addfile','removefile');
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -45,6 +45,7 @@ $langs->load("errors");
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
$langs->load("languages");
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
@ -85,17 +86,17 @@ $tabsqlsort[25]="label ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
$tabfield[25]= "label,type_template,lang,private,position,topic,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
$tabfieldvalue[25]= "label,type_template,lang,private,position,topic,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
|
$tabfieldinsert[25]= "label,type_template,lang,private,position,topic,content";
|
||||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
|
||||||
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
|
||||||
|
|
||||||
@ -144,16 +145,16 @@ $sourceList=array();
|
|||||||
|
|
||||||
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
||||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
||||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
||||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
||||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
||||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
|
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
|
||||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
||||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
||||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||||
|
|
||||||
$parameters=array('elementList'=>$elementList);
|
$parameters=array('elementList'=>$elementList);
|
||||||
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -204,7 +205,7 @@ if (empty($reshook))
|
|||||||
if ($value == 'content') $value='content-'.$rowid;
|
if ($value == 'content') $value='content-'.$rowid;
|
||||||
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
||||||
|
|
||||||
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
if ((! isset($_POST[$value]) || $_POST[$value]=='') && $value != 'lang')
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
@ -253,15 +254,16 @@ if (empty($reshook))
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
$keycode=$listfieldvalue[$i];
|
||||||
if ($value == 'entity') {
|
if ($value == 'lang') $keycode='langcode';
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
|
||||||
}
|
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||||
|
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
|
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
||||||
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
|
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
||||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.=",1)";
|
$sql.=",1)";
|
||||||
@ -301,15 +303,16 @@ if (empty($reshook))
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
|
$keycode=$listfieldvalue[$i];
|
||||||
|
if ($field == 'lang') $keycode='langcode';
|
||||||
|
|
||||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||||
if ($field == 'entity') {
|
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
|
||||||
}
|
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
@ -410,6 +413,14 @@ $head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
|||||||
$head[$h][2] = 'common';
|
$head[$h][2] = 'common';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
if ($conf->mailing->enabled)
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
|
||||||
|
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
|
||||||
|
$head[$h][2] = 'common_emailing';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
|
||||||
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
|
||||||
$head[$h][2] = 'templates';
|
$head[$h][2] = 'templates';
|
||||||
@ -426,16 +437,13 @@ if ($action == 'delete')
|
|||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
|
|
||||||
$sql="SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active";
|
$sql="SELECT rowid as rowid, label, type_template, lang, private, position, topic, content_lines, content, active";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||||
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
||||||
if ($search_label) $sql.=natural_search('label', $search_label);
|
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||||
|
if (empty($conf->global->MAIN_MULTILANGS))
|
||||||
if ($search_country_id > 0)
|
|
||||||
{
|
{
|
||||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
|
||||||
else $sql.=" WHERE ";
|
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sortfield)
|
if ($sortfield)
|
||||||
@ -461,21 +469,21 @@ $sql.=$db->plimit($listlimit+1,$offset);
|
|||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
$var=false;
|
$var=false;
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
if ($action != 'edit')
|
//if ($action != 'edit')
|
||||||
{
|
//{
|
||||||
// Line for title
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
// Line for title
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
@ -585,12 +593,13 @@ if ($action != 'edit')
|
|||||||
|
|
||||||
$colspan=count($fieldlist)+1;
|
$colspan=count($fieldlist)+1;
|
||||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
print '<br>';
|
print '</form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
//}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -691,6 +700,7 @@ if ($resql)
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
//print_r($obj);
|
//print_r($obj);
|
||||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||||
|
|
||||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||||
{
|
{
|
||||||
$tmpaction='edit';
|
$tmpaction='edit';
|
||||||
@ -724,15 +734,15 @@ if ($resql)
|
|||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) {
|
if ($showfield) {
|
||||||
|
|
||||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
||||||
|
print '<td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||||
$okforextended = true;
|
$okforextended = true;
|
||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||||
$okforextended = false;
|
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
print $doleditor->Create(1);
|
||||||
print $doleditor->Create(1);
|
print '</td>';
|
||||||
print '</td>';
|
print '<td></td><td></td><td></td>';
|
||||||
print '<td></td><td></td><td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,12 +766,16 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||||
}
|
}
|
||||||
|
if ($value == 'lang' && $valuetoshow)
|
||||||
|
{
|
||||||
|
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
||||||
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -876,14 +890,29 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
if ($fieldlist[$field] == 'lang')
|
if ($fieldlist[$field] == 'lang')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
|
{
|
||||||
|
$selectedlang = $langs->defaultlang;
|
||||||
|
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
|
||||||
|
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($obj->{$fieldlist[$field]}))
|
||||||
|
{
|
||||||
|
print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]});
|
||||||
|
}
|
||||||
|
$keyname=$fieldlist[$field];
|
||||||
|
if ($keyname == 'lang') $keyname='langcode'; // Avoid conflict with lang param
|
||||||
|
print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Le type de template
|
// Le type de template
|
||||||
elseif ($fieldlist[$field] == 'type_template')
|
elseif ($fieldlist[$field] == 'type_template')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
||||||
|
|||||||
@ -35,7 +35,8 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is n
|
|||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -371,18 +372,20 @@ if ($mode == 'feature')
|
|||||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
||||||
else $text.=$langs->trans("None");
|
else $text.=$langs->trans("None");
|
||||||
|
|
||||||
$text.='<br><br><br>';
|
$text.='<br><br>';
|
||||||
|
|
||||||
$text.='<strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
|
||||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql'));
|
||||||
|
if (count($sqlfiles) > 0)
|
||||||
{
|
{
|
||||||
$i=0;
|
$text.=$langs->trans("Yes").' (';
|
||||||
foreach($objMod->tabs as $val)
|
$i=0;
|
||||||
{
|
foreach($sqlfiles as $val)
|
||||||
$tmp=explode(':',$val,3);
|
{
|
||||||
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
|
$text.=($i?', ':'').preg_replace('/\.sql$/','',preg_replace('/llx_/','',$val['name']));
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
$text.=')';
|
||||||
}
|
}
|
||||||
else $text.=$langs->trans("No");
|
else $text.=$langs->trans("No");
|
||||||
|
|
||||||
@ -402,13 +405,24 @@ if ($mode == 'feature')
|
|||||||
|
|
||||||
$text.='<br>';
|
$text.='<br>';
|
||||||
|
|
||||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("AddData").':</strong> ';
|
||||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
|
||||||
|
if (dol_is_file($filedata))
|
||||||
|
{
|
||||||
|
$text.=$langs->trans("Yes").' ('.$moduledir.'/sql/data.sql'.')';
|
||||||
|
}
|
||||||
|
else $text.=$langs->trans("No");
|
||||||
|
|
||||||
|
$text.='<br>';
|
||||||
|
|
||||||
|
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||||
|
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($objMod->boxes as $val)
|
foreach($objMod->tabs as $val)
|
||||||
{
|
{
|
||||||
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
|
$tmp=explode(':',$val,3);
|
||||||
|
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,6 +488,20 @@ if ($mode == 'feature')
|
|||||||
|
|
||||||
$text.='<br>';
|
$text.='<br>';
|
||||||
|
|
||||||
|
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||||
|
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
foreach($objMod->boxes as $val)
|
||||||
|
{
|
||||||
|
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else $text.=$langs->trans("No");
|
||||||
|
|
||||||
|
$text.='<br>';
|
||||||
|
|
||||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -105,7 +105,7 @@ print '<td>';
|
|||||||
$disabled=0;
|
$disabled=0;
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
|
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
|
||||||
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
|
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3)', !$disabled, 0, 0);
|
||||||
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
|
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -62,14 +62,15 @@ class Categorie extends CommonObject
|
|||||||
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
|
||||||
*/
|
*/
|
||||||
private $MAP_ID = array(
|
private $MAP_ID = array(
|
||||||
'product' => 0,
|
'product' => 0,
|
||||||
'supplier' => 1,
|
'supplier' => 1,
|
||||||
'customer' => 2,
|
'customer' => 2,
|
||||||
'member' => 3,
|
'member' => 3,
|
||||||
'contact' => 4,
|
'contact' => 4,
|
||||||
'account' => 5,
|
'bank_account' => 5,
|
||||||
'project' => 6,
|
'project' => 6,
|
||||||
'user' => 7,
|
'user' => 7,
|
||||||
|
'bank_line' => 8,
|
||||||
);
|
);
|
||||||
public static $MAP_ID_TO_CODE = array(
|
public static $MAP_ID_TO_CODE = array(
|
||||||
0 => 'product',
|
0 => 'product',
|
||||||
@ -77,9 +78,10 @@ class Categorie extends CommonObject
|
|||||||
2 => 'customer',
|
2 => 'customer',
|
||||||
3 => 'member',
|
3 => 'member',
|
||||||
4 => 'contact',
|
4 => 'contact',
|
||||||
5 => 'account',
|
5 => 'bank_account',
|
||||||
6 => 'project',
|
6 => 'project',
|
||||||
7 => 'user',
|
7 => 'user',
|
||||||
|
8 => 'bank_line',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,7 +96,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'socpeople',
|
'contact' => 'socpeople',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account', // old for bank_account
|
||||||
|
'bank_account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -109,7 +112,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'member',
|
'member' => 'member',
|
||||||
'contact' => 'contact',
|
'contact' => 'contact',
|
||||||
'user' => 'user',
|
'user' => 'user',
|
||||||
'account' => 'account',
|
'account' => 'account', // old for bank_account
|
||||||
|
'bank_account'=> 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -124,7 +128,8 @@ class Categorie extends CommonObject
|
|||||||
'member' => 'Adherent',
|
'member' => 'Adherent',
|
||||||
'contact' => 'Contact',
|
'contact' => 'Contact',
|
||||||
'user' => 'User',
|
'user' => 'User',
|
||||||
'account' => 'Account',
|
'account' => 'Account', // old for bank account
|
||||||
|
'bank_account' => 'Account',
|
||||||
'project' => 'Project',
|
'project' => 'Project',
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
@ -947,8 +952,8 @@ class Categorie extends CommonObject
|
|||||||
* fulllabel = nom avec chemin complet de la categorie
|
* fulllabel = nom avec chemin complet de la categorie
|
||||||
* fullpath = chemin complet compose des id
|
* fullpath = chemin complet compose des id
|
||||||
*
|
*
|
||||||
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
|
||||||
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
|
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
|
||||||
*
|
*
|
||||||
* @return array Array of categories. this->cats and this->motherof are set.
|
* @return array Array of categories. this->cats and this->motherof are set.
|
||||||
*/
|
*/
|
||||||
@ -1340,11 +1345,11 @@ class Categorie extends CommonObject
|
|||||||
* Return list of categories (object instances or labels) linked to element of id $id and type $type
|
* Return list of categories (object instances or labels) linked to element of id $id and type $type
|
||||||
* Should be named getListOfCategForObject
|
* Should be named getListOfCategForObject
|
||||||
*
|
*
|
||||||
* @param int $id Id of element
|
* @param int $id Id of element
|
||||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
|
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
|
||||||
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
|
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
|
||||||
* labels, 'id'= Get array of category IDs
|
* labels, 'id'= Get array of category IDs
|
||||||
* @return mixed Array of category objects or < 0 if KO
|
* @return mixed Array of category objects or < 0 if KO
|
||||||
*/
|
*/
|
||||||
function containing($id, $type, $mode='object')
|
function containing($id, $type, $mode='object')
|
||||||
{
|
{
|
||||||
@ -1352,7 +1357,7 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
|
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
|
||||||
|
|
||||||
if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
|
if ($type === Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
|
||||||
{
|
{
|
||||||
// Load bank groups
|
// Load bank groups
|
||||||
$sql = "SELECT c.label, c.rowid";
|
$sql = "SELECT c.label, c.rowid";
|
||||||
|
|||||||
@ -54,7 +54,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCat
|
|||||||
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
|
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
|
||||||
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; }
|
||||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||||
|
|||||||
@ -577,6 +577,11 @@ if ($action == 'mupdate')
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions to delete doc
|
||||||
|
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
$permissioncreate = ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete));
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -1212,7 +1217,6 @@ if ($id > 0)
|
|||||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||||
$linkback.=$out;
|
$linkback.=$out;
|
||||||
|
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
@ -1477,7 +1481,7 @@ if ($id > 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
|
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
|
|
||||||
$genallowed=$user->rights->agenda->myactions->create;
|
$genallowed=$user->rights->agenda->myactions->create;
|
||||||
$delallowed=$user->rights->agenda->myactions->delete;
|
$delallowed=$user->rights->agenda->myactions->delete;
|
||||||
|
|||||||
@ -61,7 +61,7 @@ $object->substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation
|
|||||||
|
|
||||||
$object->substitutionarrayfortest=array(
|
$object->substitutionarrayfortest=array(
|
||||||
'__ID__' => 'TESTIdRecord',
|
'__ID__' => 'TESTIdRecord',
|
||||||
'__EMAIL__' => 'TESTEMail',
|
//'__EMAIL__' => 'TESTEMail', // Done into "send" action
|
||||||
'__LASTNAME__' => 'TESTLastname',
|
'__LASTNAME__' => 'TESTLastname',
|
||||||
'__FIRSTNAME__' => 'TESTFirstname',
|
'__FIRSTNAME__' => 'TESTFirstname',
|
||||||
'__MAILTOEMAIL__' => 'TESTMailtoEmail',
|
'__MAILTOEMAIL__' => 'TESTMailtoEmail',
|
||||||
@ -409,6 +409,8 @@ if (empty($reshook))
|
|||||||
$msgishtml=-1; // Inconnu par defaut
|
$msgishtml=-1; // Inconnu par defaut
|
||||||
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
|
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
|
||||||
|
|
||||||
|
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; // other are set at begin of page
|
||||||
|
|
||||||
// Pratique les substitutions sur le sujet et message
|
// Pratique les substitutions sur le sujet et message
|
||||||
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
|
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
|
||||||
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
|
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
|
||||||
|
|||||||
@ -56,6 +56,7 @@ $action=GETPOST('action','aZ09');
|
|||||||
$search_lastname=GETPOST("search_lastname");
|
$search_lastname=GETPOST("search_lastname");
|
||||||
$search_firstname=GETPOST("search_firstname");
|
$search_firstname=GETPOST("search_firstname");
|
||||||
$search_email=GETPOST("search_email");
|
$search_email=GETPOST("search_email");
|
||||||
|
$search_other=GETPOST("search_other");
|
||||||
$search_dest_status=GETPOST('search_dest_status');
|
$search_dest_status=GETPOST('search_dest_status');
|
||||||
|
|
||||||
// Search modules dirs
|
// Search modules dirs
|
||||||
@ -90,8 +91,7 @@ if ($action == 'add')
|
|||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
||||||
// We fill $filtersarray. Using this variable is now deprecated.
|
// We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
|
||||||
// Kept for backward compatibility.
|
|
||||||
$filtersarray=array();
|
$filtersarray=array();
|
||||||
if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
|
if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
|
||||||
|
|
||||||
@ -156,11 +156,13 @@ if ($action == 'delete')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["button_removefilter"])
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lastname='';
|
$search_lastname='';
|
||||||
$search_firstname='';
|
$search_firstname='';
|
||||||
$search_email='';
|
$search_email='';
|
||||||
|
$search_other='';
|
||||||
$search_dest_status='';
|
$search_dest_status='';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,12 +305,10 @@ if ($object->fetch($id) >= 0)
|
|||||||
if ($qualified)
|
if ($qualified)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
//print '<tr class="oddeven">';
|
|
||||||
// print '<div '.$bctag[$var].'>';
|
|
||||||
|
|
||||||
if ($allowaddtarget)
|
if ($allowaddtarget)
|
||||||
{
|
{
|
||||||
print '<form aa '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -316,13 +316,11 @@ if ($object->fetch($id) >= 0)
|
|||||||
print '<div '.$bctag[$var].'>';
|
print '<div '.$bctag[$var].'>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<td>';
|
|
||||||
print '<div class="tagtd">';
|
print '<div class="tagtd">';
|
||||||
if (empty($obj->picto)) $obj->picto='generic';
|
if (empty($obj->picto)) $obj->picto='generic';
|
||||||
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto);
|
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj),$obj->picto);
|
||||||
print ' ';
|
print ' ';
|
||||||
print $obj->getDesc();
|
print $obj->getDesc();
|
||||||
//print '</td>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -333,7 +331,6 @@ if ($object->fetch($id) >= 0)
|
|||||||
dol_syslog($e->getMessage(), LOG_ERR);
|
dol_syslog($e->getMessage(), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<td align="center">';
|
|
||||||
print '<div class="tagtd center">';
|
print '<div class="tagtd center">';
|
||||||
if ($nbofrecipient >= 0)
|
if ($nbofrecipient >= 0)
|
||||||
{
|
{
|
||||||
@ -343,10 +340,8 @@ if ($object->fetch($id) >= 0)
|
|||||||
{
|
{
|
||||||
print $langs->trans("Error").' '.img_error($obj->error);
|
print $langs->trans("Error").' '.img_error($obj->error);
|
||||||
}
|
}
|
||||||
//print '</td>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
//print '<td align="left">';
|
|
||||||
print '<div class="tagtd" align="left">';
|
print '<div class="tagtd" align="left">';
|
||||||
if ($allowaddtarget)
|
if ($allowaddtarget)
|
||||||
{
|
{
|
||||||
@ -360,10 +355,8 @@ if ($object->fetch($id) >= 0)
|
|||||||
if ($filter) print $filter;
|
if ($filter) print $filter;
|
||||||
else print $langs->trans("None");
|
else print $langs->trans("None");
|
||||||
}
|
}
|
||||||
//print '</td>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
//print '<td align="right">';
|
|
||||||
print '<div class="tagtd" align="right">';
|
print '<div class="tagtd" align="right">';
|
||||||
if ($allowaddtarget)
|
if ($allowaddtarget)
|
||||||
{
|
{
|
||||||
@ -375,19 +368,14 @@ if ($object->fetch($id) >= 0)
|
|||||||
//print $langs->trans("MailNoChangePossible");
|
//print $langs->trans("MailNoChangePossible");
|
||||||
print " ";
|
print " ";
|
||||||
}
|
}
|
||||||
//print '</td>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($allowaddtarget) print '</form>';
|
if ($allowaddtarget) print '</form>';
|
||||||
else print '</div>';
|
else print '</div>';
|
||||||
|
|
||||||
//print "</tr>\n";
|
|
||||||
// print '</div>'."\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End foreach dir
|
} // End foreach dir
|
||||||
|
|
||||||
//print '</table>';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
@ -397,9 +385,10 @@ if ($object->fetch($id) >= 0)
|
|||||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||||
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
||||||
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
|
||||||
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
if ($search_firstname) $sql.= natural_search("mc.firstname", $search_firstname);
|
||||||
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
|
if ($search_email) $sql.= natural_search("mc.email", $search_email);
|
||||||
|
if ($search_other) $sql.= natural_search("mc.other", $search_other);
|
||||||
if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
|
if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
|
||||||
$sql .= $db->order($sortfield,$sortorder);
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
@ -423,6 +412,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
|
if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname);
|
||||||
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
||||||
if ($search_email) $param.= "&search_email=".urlencode($search_email);
|
if ($search_email) $param.= "&search_email=".urlencode($search_email);
|
||||||
|
if ($search_other) $param.= "&search_other=".urlencode($search_other);
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -469,7 +459,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
// Other
|
// Other
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print '<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Source
|
// Source
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
|
|||||||
@ -1376,6 +1376,7 @@ if ($action == 'create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
|
|||||||
@ -1467,7 +1467,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Client
|
// Thirdparty
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
@ -1491,6 +1491,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
|
|||||||
@ -560,11 +560,7 @@ else
|
|||||||
$_GET["id"]=$object->id;
|
$_GET["id"]=$object->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Show tabs
|
||||||
* Affichage onglets
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Onglets
|
|
||||||
$head=bank_prepare_head($object);
|
$head=bank_prepare_head($object);
|
||||||
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
|
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
|
||||||
|
|
||||||
@ -592,18 +588,6 @@ else
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
/*
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
|
|
||||||
print '</td></tr>';*/
|
|
||||||
|
|
||||||
// Label
|
|
||||||
/*print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
|
|
||||||
print '<td>'.$object->label.'</td></tr>';*/
|
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
|
||||||
print '<td>'.$object->type_lib[$object->type].'</td></tr>';
|
print '<td>'.$object->type_lib[$object->type].'</td></tr>';
|
||||||
@ -616,26 +600,6 @@ else
|
|||||||
print $langs->trans("Currency".$selectedcode);
|
print $langs->trans("Currency".$selectedcode);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status
|
|
||||||
/*print '<tr><td>'.$langs->trans("Status").'</td>';
|
|
||||||
print '<td>'.$object->getLibStatut(4).'</td></tr>';*/
|
|
||||||
|
|
||||||
// Country
|
|
||||||
/*
|
|
||||||
print '<tr><td>'.$langs->trans("BankAccountCountry").'</td><td>';
|
|
||||||
if ($object->country_id > 0)
|
|
||||||
{
|
|
||||||
$img=picto_from_langcode($object->country_code);
|
|
||||||
print $img?$img.' ':'';
|
|
||||||
print getCountry($object->getCountryCode(),0,$db);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// State
|
|
||||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
|
||||||
if ($object->state_id > 0) print getState($object->state_id);
|
|
||||||
print '</td></tr>';*/
|
|
||||||
|
|
||||||
// Conciliate
|
// Conciliate
|
||||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -694,7 +658,7 @@ else
|
|||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id,'account',1);
|
print $form->showCategories($object->id,'bank_account',1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -62,9 +62,7 @@ $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '',
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
if ($page == -1) {
|
if (empty($page) || $page == -1) { $page = 0; }
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -122,21 +120,21 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
|
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
|
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
$modulepart = 'bank';
|
$modulepart = 'bank';
|
||||||
$permission = $user->rights->banque->modifier;
|
$permission = $user->rights->banque->modifier;
|
||||||
$permtoedit = $user->rights->banque->modifier;
|
$permtoedit = $user->rights->banque->modifier;
|
||||||
|
|||||||
121
htdocs/compta/facture/admin/facture_rec_cust_extrafields.php
Normal file
121
htdocs/compta/facture/admin/facture_rec_cust_extrafields.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 John BOTELLA <contact@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/compta/facture/admin/facture_cust_extrafields.php
|
||||||
|
* \ingroup invoice
|
||||||
|
* \brief Page to setup extra fields of customer invoice
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
// List of supported format
|
||||||
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
|
$type2label=array('');
|
||||||
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
$elementtype='facture_rec'; //Must be the $table_element of the class that manage extrafield
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("BillsSetup"));
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
$head = invoice_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'attributesrec', $langs->trans("Invoices"), -1, 'invoice');
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ($action != 'create' && $action != 'edit')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Creation of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Edition of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
if ($action == 'edit' && ! empty($attrname))
|
||||||
|
{
|
||||||
|
$langs->load("members");
|
||||||
|
|
||||||
|
print "<br>";
|
||||||
|
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
119
htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php
Normal file
119
htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/compta/facture/admin/facture_cust_extrafields.php
|
||||||
|
* \ingroup invoice
|
||||||
|
* \brief Page to setup extra fields of customer invoice
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
// List of supported format
|
||||||
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
|
$type2label=array('');
|
||||||
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
$elementtype='facturedet_rec'; //Must be the $table_element of the class that manage extrafield
|
||||||
|
|
||||||
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("BillsSetup"));
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
$head = invoice_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'attributeslinesrec', $langs->trans("Invoices"), -1, 'invoice');
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ($action != 'create' && $action != 'edit')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Creation d'un champ optionnel
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Edition d'un champ optionnel */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
if ($action == 'edit' && ! empty($attrname))
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -673,6 +673,8 @@ if (empty($reshook))
|
|||||||
$sql.= ' ORDER BY p.datep, p.tms';
|
$sql.= ' ORDER BY p.datep, p.tms';
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) dol_print_error($db);
|
||||||
|
|
||||||
$res = $db->fetch_object($resql);
|
$res = $db->fetch_object($resql);
|
||||||
$total_paiements = $res->total_paiements;
|
$total_paiements = $res->total_paiements;
|
||||||
|
|
||||||
@ -2197,7 +2199,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
|
||||||
if ($soc->id > 0 && ! GETPOST('fac_rec'))
|
if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
|
||||||
{
|
{
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $soc->getNomUrl(1);
|
print $soc->getNomUrl(1);
|
||||||
@ -2212,6 +2214,7 @@ if ($action == 'create')
|
|||||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
print ')';
|
print ')';
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&fac_rec='.GETPOST('fac_rec','alpha')).'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2232,6 +2235,7 @@ if ($action == 'create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
@ -4132,11 +4136,11 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($objectidnext) {
|
if ($objectidnext) {
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||||
} else {
|
} else {
|
||||||
if ($resteapayer == 0) {
|
//if ($resteapayer == 0) {
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||||
} else {
|
//} else {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -326,6 +326,14 @@ class FactureRec extends CommonInvoice
|
|||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||||
|
|
||||||
|
|
||||||
|
// Retreive all extrafield for thirdparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||||
|
$extrafields=new ExtraFields($this->db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||||
|
$this->fetch_optionals($this->id,$extralabels);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lines
|
* Lines
|
||||||
*/
|
*/
|
||||||
@ -396,7 +404,7 @@ class FactureRec extends CommonInvoice
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$line = new FactureLigne($this->db);
|
$line = new FactureLigneRec($this->db);
|
||||||
|
|
||||||
$line->id = $objp->rowid;
|
$line->id = $objp->rowid;
|
||||||
$line->rowid = $objp->rowid;
|
$line->rowid = $objp->rowid;
|
||||||
@ -436,6 +444,15 @@ class FactureRec extends CommonInvoice
|
|||||||
$line->price = $objp->price;
|
$line->price = $objp->price;
|
||||||
$line->remise = $objp->remise;
|
$line->remise = $objp->remise;
|
||||||
|
|
||||||
|
|
||||||
|
// Retreive all extrafield for thirdparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||||
|
$extrafieldsline=new ExtraFields($line->db);
|
||||||
|
$extrafieldsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
|
||||||
|
$extralabelsline = $line->fetch_optionals($line->id,$extrafieldsline);
|
||||||
|
|
||||||
|
|
||||||
$this->lines[$i] = $line;
|
$this->lines[$i] = $line;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -481,7 +498,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$res = $this->deleteObjectLinked();
|
$res = $this->deleteObjectLinked();
|
||||||
if ($res < 0) $error=-3;
|
if ($res < 0) $error=-3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
$error=-1;
|
$error=-1;
|
||||||
@ -647,9 +664,10 @@ class FactureRec extends CommonInvoice
|
|||||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX."facturedet_rec");
|
||||||
$this->id=$facid;
|
$this->id=$facid;
|
||||||
$this->update_price();
|
$this->update_price();
|
||||||
return 1;
|
return $lineId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1242,6 +1260,9 @@ class FactureRec extends CommonInvoice
|
|||||||
class FactureLigneRec extends CommonInvoiceLine
|
class FactureLigneRec extends CommonInvoiceLine
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $element='facturedetrec';
|
||||||
|
public $table_element='facturedet_rec';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete line in database
|
* Delete line in database
|
||||||
*
|
*
|
||||||
@ -1255,20 +1276,19 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Call trigger
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
|
||||||
/*$result=$this->call_trigger('LINEBILLREC_DELETE',$user);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}*/
|
|
||||||
// End call triggers
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINEBILLREC_DELETE',$user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1280,4 +1300,159 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recupere les lignes de factures predefinies dans this->lines
|
||||||
|
*
|
||||||
|
* @param int $rowid Id of invoice
|
||||||
|
* @return int 1 if OK, < 0 if KO
|
||||||
|
*/
|
||||||
|
function fetch($rowid)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
|
||||||
|
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||||
|
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
|
||||||
|
$sql.= ' l.rang, l.special_code,';
|
||||||
|
$sql.= ' l.fk_unit, l.fk_contract_line,';
|
||||||
|
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
|
||||||
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||||
|
$sql.= ' WHERE l.rowid = '.$rowid;
|
||||||
|
$sql.= ' ORDER BY l.rang';
|
||||||
|
|
||||||
|
dol_syslog('FactureRec::fetch', LOG_DEBUG);
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
|
||||||
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->id = $objp->rowid;
|
||||||
|
$this->label = $objp->custom_label; // Label line
|
||||||
|
$this->desc = $objp->description; // Description line
|
||||||
|
$this->description = $objp->description; // Description line
|
||||||
|
$this->product_type = $objp->product_type; // Type of line
|
||||||
|
$this->ref = $objp->product_ref; // Ref product
|
||||||
|
$this->product_ref = $objp->product_ref; // Ref product
|
||||||
|
$this->libelle = $objp->product_label; // deprecated
|
||||||
|
$this->product_label = $objp->product_label; // Label product
|
||||||
|
$this->product_desc = $objp->product_desc; // Description product
|
||||||
|
$this->fk_product_type = $objp->fk_product_type; // Type of product
|
||||||
|
$this->qty = $objp->qty;
|
||||||
|
$this->price = $objp->price;
|
||||||
|
$this->subprice = $objp->subprice;
|
||||||
|
$this->fk_facture = $objp->fk_facture;
|
||||||
|
$this->vat_src_code = $objp->vat_src_code;
|
||||||
|
$this->tva_tx = $objp->tva_tx;
|
||||||
|
$this->localtax1_tx = $objp->localtax1_tx;
|
||||||
|
$this->localtax2_tx = $objp->localtax2_tx;
|
||||||
|
$this->localtax1_type = $objp->localtax1_type;
|
||||||
|
$this->localtax2_type = $objp->localtax2_type;
|
||||||
|
$this->remise_percent = $objp->remise_percent;
|
||||||
|
$this->fk_remise_except = $objp->fk_remise_except;
|
||||||
|
$this->fk_product = $objp->fk_product;
|
||||||
|
$this->info_bits = $objp->info_bits;
|
||||||
|
$this->total_ht = $objp->total_ht;
|
||||||
|
$this->total_tva = $objp->total_tva;
|
||||||
|
$this->total_ttc = $objp->total_ttc;
|
||||||
|
$this->code_ventilation = $objp->fk_code_ventilation;
|
||||||
|
$this->rang = $objp->rang;
|
||||||
|
$this->special_code = $objp->special_code;
|
||||||
|
$this->fk_unit = $objp->fk_unit;
|
||||||
|
$this->fk_contract_line = $objp->fk_contract_line;
|
||||||
|
|
||||||
|
|
||||||
|
$this->db->free($result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a line to invoice_rec.
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, Id of line if OK
|
||||||
|
*/
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
|
if ($fk_product)
|
||||||
|
{
|
||||||
|
$product=new Product($this->db);
|
||||||
|
$result=$product->fetch($fk_product);
|
||||||
|
$product_type=$product->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET ";
|
||||||
|
$sql.= " fk_facture = ".$this->fk_facture;
|
||||||
|
$sql.= ", label=".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null");
|
||||||
|
$sql.= ", description='".$this->db->escape($this->desc)."'";
|
||||||
|
$sql.= ", price=".price2num($this->price);
|
||||||
|
$sql.= ", qty=".price2num($this->qty);
|
||||||
|
$sql.= ", tva_tx=".price2num($this->tva_tx);
|
||||||
|
$sql.= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
|
||||||
|
$sql.= ", localtax1_tx=".price2num($this->localtax1_tx);
|
||||||
|
$sql.= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||||
|
$sql.= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||||
|
$sql.= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||||
|
$sql.= ", fk_product=".(! empty($this->fk_product)?"'".$this->fk_product."'":"null");
|
||||||
|
$sql.= ", product_type=".$this->product_type;
|
||||||
|
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||||
|
$sql.= ", subprice='".price2num($this->subprice)."'";
|
||||||
|
$sql.= ", total_ht='".price2num($this->total_ht)."'";
|
||||||
|
$sql.= ", total_tva='".price2num($this->total_tva)."'";
|
||||||
|
$sql.= ", total_localtax1='".price2num($this->total_localtax1)."'";
|
||||||
|
$sql.= ", total_localtax2='".price2num($this->total_localtax2)."'";
|
||||||
|
$sql.= ", total_ttc='".price2num($this->total_ttc)."'";
|
||||||
|
$sql.= ", rang=".$this->rang;
|
||||||
|
$sql.= ", special_code=".$this->special_code;
|
||||||
|
$sql.= ", fk_unit=".($this->fk_unit ?"'".$this->db->escape($this->fk_unit )."'":"null");
|
||||||
|
$sql.= ", fk_contract_line=".($this->fk_contract_line?$this->fk_contract_line:"null");
|
||||||
|
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
|
{
|
||||||
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINEBILL_REC_UPDATE',$user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -315,6 +315,8 @@ class Facture extends CommonInvoice
|
|||||||
$this->note_private=trim($this->note_private);
|
$this->note_private=trim($this->note_private);
|
||||||
$this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
|
$this->note_private=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
|
||||||
|
|
||||||
|
$this->array_options=$_facrec->array_options;
|
||||||
|
|
||||||
//if (! $this->remise) $this->remise = 0;
|
//if (! $this->remise) $this->remise = 0;
|
||||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
@ -634,7 +636,7 @@ class Facture extends CommonInvoice
|
|||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
$localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr);
|
$localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr);
|
||||||
$localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr);
|
$localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr);
|
||||||
|
|
||||||
$result_insert = $this->addline(
|
$result_insert = $this->addline(
|
||||||
$_facrec->lines[$i]->desc,
|
$_facrec->lines[$i]->desc,
|
||||||
$_facrec->lines[$i]->subprice,
|
$_facrec->lines[$i]->subprice,
|
||||||
@ -654,7 +656,7 @@ class Facture extends CommonInvoice
|
|||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
$_facrec->lines[$i]->label,
|
$_facrec->lines[$i]->label,
|
||||||
null,
|
empty($_facrec->lines[$i]->array_options)?null:$_facrec->lines[$i]->array_options,
|
||||||
$_facrec->lines[$i]->situation_percent,
|
$_facrec->lines[$i]->situation_percent,
|
||||||
'',
|
'',
|
||||||
$_facrec->lines[$i]->fk_unit
|
$_facrec->lines[$i]->fk_unit
|
||||||
|
|||||||
@ -40,6 +40,7 @@ if (! empty($conf->projet->enabled)) {
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
|
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
@ -103,7 +104,7 @@ $hookmanager->initHooks(array('invoicereccard','globalcard'));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('facture');
|
$extralabels = $extrafields->fetch_name_optionals_label('facture_rec');
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
@ -394,6 +395,28 @@ if (empty($reshook))
|
|||||||
setEventMessages($line->error, $line->errors, 'errors');
|
setEventMessages($line->error, $line->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($action == 'update_extras')
|
||||||
|
{
|
||||||
|
// Fill array 'array_options' with data from update form
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
|
if ($ret < 0)
|
||||||
|
$error ++;
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
|
||||||
|
$result = $object->insertExtraFields();
|
||||||
|
if ($result < 0) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
} else if ($reshook < 0)
|
||||||
|
$error ++;
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$action = 'edit_extras';
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add a new line
|
// Add a new line
|
||||||
if ($action == 'addline' && $user->rights->facture->creer)
|
if ($action == 'addline' && $user->rights->facture->creer)
|
||||||
@ -737,6 +760,18 @@ if (empty($reshook))
|
|||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
|
|
||||||
|
$objectline = new FactureLigneRec($db);
|
||||||
|
if ($objectline->fetch(GETPOST('lineid')))
|
||||||
|
{
|
||||||
|
$objectline->array_options=$array_options;
|
||||||
|
$result=$objectline->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('Error').$result, null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Unset extrafield
|
// Unset extrafield
|
||||||
if (is_array($extralabelsline))
|
if (is_array($extralabelsline))
|
||||||
{
|
{
|
||||||
@ -1326,6 +1361,11 @@ else
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$cols = 2;
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -62,6 +63,7 @@ if ($modecompta=="CREANCES-DETTES")
|
|||||||
$nom=$langs->trans("SalesTurnover");
|
$nom=$langs->trans("SalesTurnover");
|
||||||
$calcmode=$langs->trans("CalcModeDebt");
|
$calcmode=$langs->trans("CalcModeDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$period="$year_start - $year_end";
|
||||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||||
$description=$langs->trans("RulesCADue");
|
$description=$langs->trans("RulesCADue");
|
||||||
@ -70,10 +72,12 @@ if ($modecompta=="CREANCES-DETTES")
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
else {
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
|
{
|
||||||
$nom=$langs->trans("SalesTurnover");
|
$nom=$langs->trans("SalesTurnover");
|
||||||
$calcmode=$langs->trans("CalcModeEngagement");
|
$calcmode=$langs->trans("CalcModeEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
|
||||||
$period="$year_start - $year_end";
|
$period="$year_start - $year_end";
|
||||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||||
$description=$langs->trans("RulesCAIn");
|
$description=$langs->trans("RulesCAIn");
|
||||||
@ -81,6 +85,20 @@ else {
|
|||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
}
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
$nom=$langs->trans("BookkeepingTurnover");
|
||||||
|
$calcmode=$langs->trans("CalcModeBookkeeping");
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||||
|
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||||
|
$period="$year_start - $year_end";
|
||||||
|
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||||
|
$description=$langs->trans("RulesCABookkeeping");
|
||||||
|
$description.= $langs->trans("DepositsAreIncluded");
|
||||||
|
$builddate=time();
|
||||||
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
$moreparam=array();
|
$moreparam=array();
|
||||||
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
|
||||||
@ -98,8 +116,10 @@ if ($modecompta == 'CREANCES-DETTES')
|
|||||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||||
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
}
|
}
|
||||||
else
|
else if ($modecompta=="RECETTES-DEPENSES")
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||||
@ -111,9 +131,19 @@ else
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||||
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
||||||
$sql.= " AND pf.fk_facture = f.rowid";
|
$sql.= " AND pf.fk_facture = f.rowid";
|
||||||
}
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
|
||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
|
}
|
||||||
|
else if ($modecompta=="BOOKKEEPING")
|
||||||
|
{
|
||||||
|
$sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
|
||||||
|
$sql.= " WHERE b.numero_compte IN (SELECT a.account_number" ;
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_account as a";
|
||||||
|
$sql.= " WHERE a.fk_accounting_category = 1 ) " ; // todo sql with accounting category, but we need to define category in turnover
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= " ORDER BY dm";
|
$sql.= " ORDER BY dm";
|
||||||
|
|
||||||
@ -481,7 +511,7 @@ print '</div>';
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r<EFBFBD>gl<EFBFBD> des factures partiellement r<>gl<67>es</td></tr>";
|
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,7 +211,7 @@ else
|
|||||||
dol_fiche_head($head, 'agenda', $title, -1, 'contact');
|
dol_fiche_head($head, 'agenda', $title, -1, 'contact');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref='<div class="refidno">';
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||||
{
|
{
|
||||||
@ -223,42 +223,42 @@ else
|
|||||||
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
$object->info($id);
|
$object->info($id);
|
||||||
print dol_print_object_info($object, 1);
|
print dol_print_object_info($object, 1);
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print dol_fiche_end();
|
print dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
// Actions buttons
|
// Actions buttons
|
||||||
|
|
||||||
$objcon=$object;
|
$objcon=$object;
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$objthirdparty=$object->thirdparty;
|
$objthirdparty=$object->thirdparty;
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
$permok=$user->rights->agenda->myactions->create;
|
$permok=$user->rights->agenda->myactions->create;
|
||||||
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
||||||
{
|
{
|
||||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||||
if (get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id;
|
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id;
|
||||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1';
|
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1';
|
||||||
//$out.=$langs->trans("AddAnAction").' ';
|
//$out.=$langs->trans("AddAnAction").' ';
|
||||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||||
//$out.="</a>";
|
//$out.="</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if (! empty($conf->agenda->enabled))
|
if (! empty($conf->agenda->enabled))
|
||||||
{
|
{
|
||||||
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
||||||
@ -270,22 +270,22 @@ else
|
|||||||
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
|
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||||
{
|
{
|
||||||
$param='&id='.$id;
|
$param='&id='.$id;
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||||
|
|
||||||
// List of all actions
|
// List of all actions
|
||||||
$filters=array();
|
$filters=array();
|
||||||
$filters['search_agenda_label']=$search_agenda_label;
|
$filters['search_agenda_label']=$search_agenda_label;
|
||||||
|
|
||||||
show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1153,6 +1153,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
|
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300');
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|||||||
@ -1278,6 +1278,15 @@ class Contrat extends CommonObject
|
|||||||
//// End call triggers
|
//// 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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
@ -1831,13 +1840,13 @@ class Contrat extends CommonObject
|
|||||||
$text.=': ';
|
$text.=': ';
|
||||||
}
|
}
|
||||||
$text.=($mode == 7?'<div class="inline-block">':'');
|
$text.=($mode == 7?'<div class="inline-block">':'');
|
||||||
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3)).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3,-1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||||
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0)).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' ':'') : '';
|
||||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||||
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1)).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesclosed)?' ':'') : '';
|
||||||
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
$text.=($mode == 7?'</div><div class="inline-block">':'');
|
||||||
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3)) : '';
|
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3,-1,'class="paddingleft2 inline-block valigntextbottom"')) : '';
|
||||||
$text.=($mode == 7?'</div>':'');
|
$text.=($mode == 7?'</div>':'');
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
@ -2509,9 +2518,10 @@ class ContratLigne extends CommonObjectLine
|
|||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @param int $expired 0=Not expired, 1=Expired, -1=Both or unknown
|
* @param int $expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||||
|
* @param string $moreatt More attribute
|
||||||
* @return string Libelle
|
* @return string Libelle
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode,$expired=-1)
|
function LibStatut($statut,$mode,$expired=-1,$moreatt='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
@ -2541,11 +2551,11 @@ class ContratLigne extends CommonObjectLine
|
|||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
|
||||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); }
|
||||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4'); }
|
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); }
|
||||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
|
||||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -154,6 +154,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
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
|
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_product_category=0;
|
||||||
$search_name="";
|
$search_name="";
|
||||||
$search_contract="";
|
$search_contract="";
|
||||||
$search_service="";
|
$search_service="";
|
||||||
@ -176,6 +177,8 @@ if (empty($reshook))
|
|||||||
$filter_opcloture="";
|
$filter_opcloture="";
|
||||||
$mode='';
|
$mode='';
|
||||||
$filter='';
|
$filter='';
|
||||||
|
$toselect='';
|
||||||
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
*
|
||||||
* $elementype must be defined.
|
* $elementype must be defined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -158,12 +158,11 @@ if ($action == 'add')
|
|||||||
$params['options'][$key] = $value;
|
$params['options'][$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=$extrafields->addExtraField(
|
$result=$extrafields->addExtraField(
|
||||||
GETPOST('attrname', 'alpha'),
|
GETPOST('attrname', 'alpha'),
|
||||||
GETPOST('label', 'alpha'),
|
GETPOST('label', 'alpha'),
|
||||||
$type,
|
$type,
|
||||||
GETPOST('pos', 'alpha'),
|
GETPOST('pos', 'int'),
|
||||||
$extrasize,
|
$extrasize,
|
||||||
$elementtype,
|
$elementtype,
|
||||||
(GETPOST('unique', 'alpha')?1:0),
|
(GETPOST('unique', 'alpha')?1:0),
|
||||||
@ -175,8 +174,8 @@ if ($action == 'add')
|
|||||||
(GETPOST('list', 'alpha')?1:0),
|
(GETPOST('list', 'alpha')?1:0),
|
||||||
(GETPOST('ishidden', 'alpha')?1:0),
|
(GETPOST('ishidden', 'alpha')?1:0),
|
||||||
GETPOST('computed_value','alpha'),
|
GETPOST('computed_value','alpha'),
|
||||||
(GETPOST('entitycurrentorall', 'alpha')?0:'')
|
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||||
|
GETPOST('langfile', 'alpha')
|
||||||
);
|
);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -338,7 +337,8 @@ if ($action == 'update')
|
|||||||
(GETPOST('ishidden', 'alpha')?1:0),
|
(GETPOST('ishidden', 'alpha')?1:0),
|
||||||
GETPOST('default_value','alpha'),
|
GETPOST('default_value','alpha'),
|
||||||
GETPOST('computed_value','alpha'),
|
GETPOST('computed_value','alpha'),
|
||||||
(GETPOST('entitycurrentorall', 'alpha')?0:'')
|
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||||
|
GETPOST('langfile')
|
||||||
);
|
);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$result=$objecttmp->fetch($toselectid);
|
$result=$objecttmp->fetch($toselectid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$listoinvoicesid[$toselectid]=$toselectid;
|
$listofobjectid[$toselectid]=$toselectid;
|
||||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||||
@ -170,7 +170,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
|
|
||||||
//var_dump($listofobjectref);exit;
|
//var_dump($listofobjectref);exit;
|
||||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||||
$listofqualifiedinvoice=array();
|
$listofqualifiedid=array();
|
||||||
$listofqualifiedref=array();
|
$listofqualifiedref=array();
|
||||||
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
|
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
|
||||||
{
|
{
|
||||||
@ -224,7 +224,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$listofqualifiedinvoice[$objectid]=$object;
|
$listofqualifiedid[$objectid]=$object;
|
||||||
$listofqualifiedref[$objectid]=$object->ref;
|
$listofqualifiedref[$objectid]=$object->ref;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -239,8 +239,8 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
//var_dump($listofqualifiedref);
|
//var_dump($listofqualifiedref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop on each qualified invoice of the thirdparty
|
// Loop on each qualified objects of the thirdparty
|
||||||
if (count($listofqualifiedinvoice) > 0)
|
if (count($listofqualifiedid) > 0)
|
||||||
{
|
{
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
|
|
||||||
@ -267,17 +267,35 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$subject = GETPOST('subject');
|
$subject = GETPOST('subject');
|
||||||
$message = GETPOST('message');
|
$message = GETPOST('message');
|
||||||
$sendtocc = GETPOST('sentocc');
|
$sendtocc = GETPOST('sentocc');
|
||||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
$sendtobcc = '';
|
||||||
|
if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
|
||||||
|
if ($objectclass == 'Commande') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
|
||||||
|
if ($objectclass == 'Facture') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||||
|
if ($objectclass == 'Supplier_Proposal') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO);
|
||||||
|
if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO);
|
||||||
|
if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO);
|
||||||
|
|
||||||
|
|
||||||
$substitutionarray=array(
|
$substitutionarray=array(
|
||||||
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
|
'__ID__' => join(', ',array_keys($listofqualifiedid)),
|
||||||
'__EMAIL__' => $thirdparty->email,
|
'__EMAIL__' => $thirdparty->email,
|
||||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||||
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||||
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||||
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||||
'__REF__' => join(', ',$listofqualifiedref),
|
'__REF__' => join(', ',$listofqualifiedref),
|
||||||
'__REFCLIENT__' => $thirdparty->name
|
'__REFCLIENT__' => $thirdparty->name,
|
||||||
|
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
|
||||||
|
/* not available on all object
|
||||||
|
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
|
||||||
|
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
|
||||||
|
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
|
||||||
|
'__ADDRESS__'=>(is_object($object)?$object->address:''),
|
||||||
|
'__ZIP__'=>(is_object($object)?$object->zip:''),
|
||||||
|
'__TOWN_'=>(is_object($object)?$object->town:''),
|
||||||
|
'__COUNTRY__'=>(is_object($object)?$object->country:''),
|
||||||
|
*/
|
||||||
);
|
);
|
||||||
|
|
||||||
$subject=make_substitutions($subject, $substitutionarray);
|
$subject=make_substitutions($subject, $substitutionarray);
|
||||||
@ -289,7 +307,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
|
|
||||||
//var_dump($filepath);
|
//var_dump($filepath);
|
||||||
|
|
||||||
// Send mail
|
// Send mail (substitutionarray must be done just before this)
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||||
if ($mailfile->error)
|
if ($mailfile->error)
|
||||||
@ -306,7 +324,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Insert logs into agenda
|
// Insert logs into agenda
|
||||||
foreach($listofqualifiedinvoice as $invid => $object)
|
foreach($listofqualifiedid as $objid => $object)
|
||||||
{
|
{
|
||||||
/*if ($objectclass == 'Propale') $actiontypecode='AC_PROP';
|
/*if ($objectclass == 'Propale') $actiontypecode='AC_PROP';
|
||||||
if ($objectclass == 'Commande') $actiontypecode='AC_COM';
|
if ($objectclass == 'Commande') $actiontypecode='AC_COM';
|
||||||
@ -329,7 +347,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$object->sendtoid = 0;
|
$object->sendtoid = 0;
|
||||||
$object->actionmsg = $actionmsg; // Long text
|
$object->actionmsg = $actionmsg; // Long text
|
||||||
$object->actionmsg2 = $actionmsg2; // Short text
|
$object->actionmsg2 = $actionmsg2; // Short text
|
||||||
$object->fk_element = $invid;
|
$object->fk_element = $objid;
|
||||||
$object->elementtype = $object->element;
|
$object->elementtype = $object->element;
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
@ -404,7 +422,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
|||||||
$result=$objecttmp->fetch($toselectid);
|
$result=$objecttmp->fetch($toselectid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$listoinvoicesid[$toselectid]=$toselectid;
|
$listofobjectid[$toselectid]=$toselectid;
|
||||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||||
$listofobjectref[$toselectid]=$objecttmp->ref;
|
$listofobjectref[$toselectid]=$objecttmp->ref;
|
||||||
|
|||||||
@ -344,8 +344,31 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send mail
|
$substitutionarray=array(
|
||||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
|
'__ID__' => (is_object($object)?$object->id:''),
|
||||||
|
'__EMAIL__' => $sendto,
|
||||||
|
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
|
||||||
|
'__REF__' => (is_object($object)?$object->ref:''),
|
||||||
|
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
|
||||||
|
/* not available on all object
|
||||||
|
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
|
||||||
|
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
|
||||||
|
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
|
||||||
|
'__ADDRESS__'=>(is_object($object)?$object->address:''),
|
||||||
|
'__ZIP__'=>(is_object($object)?$object->zip:''),
|
||||||
|
'__TOWN_'=>(is_object($object)?$object->town:''),
|
||||||
|
'__COUNTRY__'=>(is_object($object)?$object->country:''),
|
||||||
|
*/
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject=make_substitutions($subject, $substitutionarray);
|
||||||
|
$message=make_substitutions($message, $substitutionarray);
|
||||||
|
|
||||||
|
// Send mail (substitutionarray must be done just before this)
|
||||||
|
if (empty($sendcontext)) $sendcontext = 'standard';
|
||||||
|
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid,'', $sendcontext);
|
||||||
|
|
||||||
if ($mailfile->error)
|
if ($mailfile->error)
|
||||||
{
|
{
|
||||||
setEventMessage($mailfile->error, 'errors');
|
setEventMessage($mailfile->error, 'errors');
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,15 +17,43 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/actions_setnotes.inc.php
|
* \file htdocs/core/actions_setmoduleoptions.inc.php
|
||||||
* \brief Code for actions on setting notes of object page
|
* \brief Code for actions on setting notes of object page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// $action must be defined
|
// $action must be defined
|
||||||
// $_FILES may be defined
|
// $arrayofparameters must be set for action 'update'
|
||||||
|
// $nomessageinupdate can be set to 1
|
||||||
// $nomessageinsetmoduleoptions can be set to 1
|
// $nomessageinsetmoduleoptions can be set to 1
|
||||||
|
|
||||||
|
if ($action == 'update' && is_array($arrayofparameters))
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$ok=True;
|
||||||
|
foreach($arrayofparameters as $key => $val)
|
||||||
|
{
|
||||||
|
$result=dolibarr_set_const($db,$key,GETPOST($key, 'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$ok=False;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||||
if ($action == 'setModuleOptions')
|
if ($action == 'setModuleOptions')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -97,181 +97,95 @@ class box_activity extends ModeleBoxes
|
|||||||
|
|
||||||
$cumuldata = array();
|
$cumuldata = array();
|
||||||
|
|
||||||
// list the summary of the bills
|
|
||||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
// list the summary of the propals
|
||||||
|
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
$facturestatic=new Facture($db);
|
$propalstatic=new Propal($db);
|
||||||
|
|
||||||
// part 1
|
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
$filename = '/boxactivity-propal'.$fileid;
|
||||||
$filename = '/boxactivity-invoice'.$fileid;
|
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||||
|
$data = array();
|
||||||
|
if ($refresh)
|
||||||
|
{
|
||||||
|
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||||
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= ")";
|
||||||
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND p.fk_soc = s.rowid";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
|
$sql.= " AND p.datep >= '".$db->idate($tmpdate)."'";
|
||||||
|
$sql.= " AND p.date_cloture IS NULL"; // just unclosed
|
||||||
|
$sql.= " GROUP BY p.fk_statut";
|
||||||
|
$sql.= " ORDER BY p.fk_statut DESC";
|
||||||
|
|
||||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
$result = $db->query($sql);
|
||||||
$data = array();
|
if ($result)
|
||||||
if ($refresh)
|
{
|
||||||
{
|
$num = $db->num_rows($result);
|
||||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
||||||
$sql.= ")";
|
|
||||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
|
||||||
$sql.= " AND f.fk_soc = s.rowid";
|
|
||||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
|
|
||||||
$sql.= " GROUP BY f.fk_statut";
|
|
||||||
$sql.= " ORDER BY f.fk_statut DESC";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$j=0;
|
||||||
if ($result) {
|
while ($j < $num) {
|
||||||
$num = $db->num_rows($result);
|
$data[$j]=$db->fetch_object($result);
|
||||||
$j=0;
|
$j++;
|
||||||
while ($j < $num) {
|
}
|
||||||
$data[$j]=$db->fetch_object($result);
|
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||||
$j++;
|
dol_filecache($cachedir, $filename, $data);
|
||||||
}
|
}
|
||||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
$db->free($result);
|
||||||
dol_filecache($cachedir, $filename, $data);
|
} else {
|
||||||
}
|
dol_print_error($db);
|
||||||
$db->free($result);
|
}
|
||||||
} else {
|
}
|
||||||
dol_print_error($db);
|
else
|
||||||
}
|
{
|
||||||
} else {
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$cumuldata=array_merge($cumuldata, $data);
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
if (! empty($data)) {
|
if (! empty($data))
|
||||||
$j=0;
|
{
|
||||||
while ($line < count($cumuldata)) {
|
$j=0;
|
||||||
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
|
while ($line < count($cumuldata))
|
||||||
$this->info_box_contents[$line][0] = array(
|
{
|
||||||
'td' => 'align="left" width="16"',
|
$this->info_box_contents[$line][0] = array(
|
||||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
'td' => 'align="left" width="16"',
|
||||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||||
'logo' => 'bill',
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
);
|
'logo' => 'object_propal'
|
||||||
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][1] = array(
|
$this->info_box_contents[$line][1] = array(
|
||||||
'td' => '',
|
'td' => '',
|
||||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][2] = array(
|
$this->info_box_contents[$line][2] = array(
|
||||||
'td' => 'class="right"',
|
'td' => 'class="right"',
|
||||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
'text' => $data[$j]->nb,
|
||||||
'text' => $data[$j]->nb,
|
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||||
);
|
);
|
||||||
|
$totalnb += $data[$j]->nb;
|
||||||
|
|
||||||
$this->info_box_contents[$line][3] = array(
|
$this->info_box_contents[$line][3] = array(
|
||||||
'td' => 'class="right"',
|
'td' => 'class="right"',
|
||||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
);
|
);
|
||||||
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
|
$this->info_box_contents[$line][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||||
|
);
|
||||||
|
|
||||||
// We add only for the current year
|
$line++;
|
||||||
if ($data[$j]->annee == date("Y")) {
|
$j++;
|
||||||
$totalnb += $data[$j]->nb;
|
}
|
||||||
$totalMnt += $data[$j]->Mnttot;
|
}
|
||||||
}
|
|
||||||
$this->info_box_contents[$line][4] = array(
|
|
||||||
'td' => 'align="right" width="18"',
|
|
||||||
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
|
||||||
);
|
|
||||||
$line++;
|
|
||||||
$j++;
|
|
||||||
}
|
|
||||||
if (count($data)==0)
|
|
||||||
$this->info_box_contents[$line][0] = array(
|
|
||||||
'td' => 'align="center"',
|
|
||||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// part 2
|
|
||||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
|
||||||
$filename = '/boxactivity-invoice2'.$fileid;
|
|
||||||
|
|
||||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
|
||||||
|
|
||||||
if ($refresh) {
|
|
||||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
|
||||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
|
||||||
$sql.= " AND f.fk_soc = s.rowid";
|
|
||||||
$sql.= " AND paye=0";
|
|
||||||
$sql.= " GROUP BY f.fk_statut";
|
|
||||||
$sql.= " ORDER BY f.fk_statut DESC";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result) {
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$j=0;
|
|
||||||
while ($j < $num) {
|
|
||||||
$data[$j]=$db->fetch_object($result);
|
|
||||||
$j++;
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
|
||||||
dol_filecache($cachedir, $filename, $data);
|
|
||||||
}
|
|
||||||
$db->free($result);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cumuldata=array_merge($cumuldata, $data);
|
|
||||||
if (! empty($data)) {
|
|
||||||
$j=0;
|
|
||||||
|
|
||||||
while ($line < count($cumuldata)) {
|
|
||||||
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
|
|
||||||
$this->info_box_contents[$line][0] = array(
|
|
||||||
'td' => 'align="left" width="16"',
|
|
||||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
|
||||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
|
||||||
'logo' => 'bill',
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->info_box_contents[$line][1] = array(
|
|
||||||
'td' => '',
|
|
||||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->info_box_contents[$line][2] = array(
|
|
||||||
'td' => 'class="right"',
|
|
||||||
'text' => $data[$j]->nb,
|
|
||||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
|
||||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
|
||||||
);
|
|
||||||
$totalnb += $data[$j]->nb;
|
|
||||||
$this->info_box_contents[$line][3] = array(
|
|
||||||
'td' => 'class="right"',
|
|
||||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
|
||||||
);
|
|
||||||
$totalMnt += $objp->Mnttot;
|
|
||||||
$this->info_box_contents[$line][4] = array(
|
|
||||||
'td' => 'align="right" width="18"',
|
|
||||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
|
||||||
);
|
|
||||||
$line++;
|
|
||||||
$j++;
|
|
||||||
}
|
|
||||||
if ($num==0)
|
|
||||||
$this->info_box_contents[$line][0] = array(
|
|
||||||
'td' => 'align="center"',
|
|
||||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$this->info_box_contents[0][0] = array(
|
|
||||||
'td' => '',
|
|
||||||
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the summary of the orders
|
// list the summary of the orders
|
||||||
@ -295,12 +209,10 @@ class box_activity extends ModeleBoxes
|
|||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
$sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'";
|
$sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'";
|
||||||
$sql.= " AND c.facture=0";
|
|
||||||
$sql.= " GROUP BY c.fk_statut";
|
$sql.= " GROUP BY c.fk_statut";
|
||||||
$sql.= " ORDER BY c.fk_statut DESC";
|
$sql.= " ORDER BY c.fk_statut DESC";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$j=0;
|
$j=0;
|
||||||
@ -359,94 +271,182 @@ class box_activity extends ModeleBoxes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// list the summary of the propals
|
|
||||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
// list the summary of the bills
|
||||||
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
$propalstatic=new Propal($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
// part 1
|
||||||
$filename = '/boxactivity-propal'.$fileid;
|
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
$filename = '/boxactivity-invoice'.$fileid;
|
||||||
$data = array();
|
|
||||||
if ($refresh)
|
|
||||||
{
|
|
||||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
|
||||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
||||||
$sql.= ")";
|
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
|
||||||
$sql.= " AND p.fk_soc = s.rowid";
|
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
|
||||||
$sql.= " AND p.datep >= '".$db->idate($tmpdate)."'";
|
|
||||||
$sql.= " AND p.date_cloture IS NULL"; // just unclosed
|
|
||||||
$sql.= " GROUP BY p.fk_statut";
|
|
||||||
$sql.= " ORDER BY p.fk_statut DESC";
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||||
if ($result)
|
$data = array();
|
||||||
{
|
if ($refresh)
|
||||||
$num = $db->num_rows($result);
|
{
|
||||||
|
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||||
|
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= ")";
|
||||||
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
|
||||||
|
$sql.= " GROUP BY f.fk_statut";
|
||||||
|
$sql.= " ORDER BY f.fk_statut DESC";
|
||||||
|
|
||||||
$j=0;
|
$result = $db->query($sql);
|
||||||
while ($j < $num) {
|
if ($result) {
|
||||||
$data[$j]=$db->fetch_object($result);
|
$num = $db->num_rows($result);
|
||||||
$j++;
|
$j=0;
|
||||||
}
|
while ($j < $num) {
|
||||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
$data[$j]=$db->fetch_object($result);
|
||||||
dol_filecache($cachedir, $filename, $data);
|
$j++;
|
||||||
}
|
}
|
||||||
$db->free($result);
|
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||||
} else {
|
dol_filecache($cachedir, $filename, $data);
|
||||||
dol_print_error($db);
|
}
|
||||||
}
|
$db->free($result);
|
||||||
}
|
} else {
|
||||||
else
|
dol_print_error($db);
|
||||||
{
|
}
|
||||||
$data = dol_readcachefile($cachedir, $filename);
|
} else {
|
||||||
}
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
|
}
|
||||||
|
|
||||||
$cumuldata=array_merge($cumuldata, $data);
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
if (! empty($data))
|
if (! empty($data)) {
|
||||||
{
|
$j=0;
|
||||||
$j=0;
|
while ($line < count($cumuldata)) {
|
||||||
while ($line < count($cumuldata))
|
$billurl="search_status=2&paye=1&year=".$data[$j]->annee;
|
||||||
{
|
$this->info_box_contents[$line][0] = array(
|
||||||
$this->info_box_contents[$line][0] = array(
|
'td' => 'align="left" width="16"',
|
||||||
'td' => 'align="left" width="16"',
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'logo' => 'bill',
|
||||||
'logo' => 'object_propal'
|
);
|
||||||
);
|
|
||||||
|
|
||||||
$this->info_box_contents[$line][1] = array(
|
$this->info_box_contents[$line][1] = array(
|
||||||
'td' => '',
|
'td' => '',
|
||||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][2] = array(
|
$this->info_box_contents[$line][2] = array(
|
||||||
'td' => 'class="right"',
|
'td' => 'class="right"',
|
||||||
'text' => $data[$j]->nb,
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
'text' => $data[$j]->nb,
|
||||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
);
|
);
|
||||||
$totalnb += $data[$j]->nb;
|
|
||||||
|
|
||||||
$this->info_box_contents[$line][3] = array(
|
$this->info_box_contents[$line][3] = array(
|
||||||
'td' => 'class="right"',
|
'td' => 'class="right"',
|
||||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
||||||
);
|
);
|
||||||
$totalMnt += $data[$j]->Mnttot;
|
|
||||||
$this->info_box_contents[$line][4] = array(
|
|
||||||
'td' => 'align="right" width="18"',
|
|
||||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
|
||||||
);
|
|
||||||
|
|
||||||
$line++;
|
// We add only for the current year
|
||||||
$j++;
|
if ($data[$j]->annee == date("Y")) {
|
||||||
}
|
$totalnb += $data[$j]->nb;
|
||||||
}
|
$totalMnt += $data[$j]->Mnttot;
|
||||||
|
}
|
||||||
|
$this->info_box_contents[$line][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
||||||
|
);
|
||||||
|
$line++;
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
if (count($data)==0)
|
||||||
|
$this->info_box_contents[$line][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// part 2
|
||||||
|
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||||
|
$filename = '/boxactivity-invoice2'.$fileid;
|
||||||
|
|
||||||
|
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||||
|
|
||||||
|
if ($refresh) {
|
||||||
|
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND paye=0";
|
||||||
|
$sql.= " GROUP BY f.fk_statut";
|
||||||
|
$sql.= " ORDER BY f.fk_statut DESC";
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$j=0;
|
||||||
|
while ($j < $num) {
|
||||||
|
$data[$j]=$db->fetch_object($result);
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||||
|
dol_filecache($cachedir, $filename, $data);
|
||||||
|
}
|
||||||
|
$db->free($result);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data = dol_readcachefile($cachedir, $filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cumuldata=array_merge($cumuldata, $data);
|
||||||
|
if (! empty($data)) {
|
||||||
|
$j=0;
|
||||||
|
|
||||||
|
while ($line < count($cumuldata)) {
|
||||||
|
$billurl="search_status=".$data[$j]->fk_statut."&paye=0";
|
||||||
|
$this->info_box_contents[$line][0] = array(
|
||||||
|
'td' => 'align="left" width="16"',
|
||||||
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
|
'logo' => 'bill',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][1] = array(
|
||||||
|
'td' => '',
|
||||||
|
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->info_box_contents[$line][2] = array(
|
||||||
|
'td' => 'class="right"',
|
||||||
|
'text' => $data[$j]->nb,
|
||||||
|
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||||
|
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||||
|
);
|
||||||
|
$totalnb += $data[$j]->nb;
|
||||||
|
$this->info_box_contents[$line][3] = array(
|
||||||
|
'td' => 'class="right"',
|
||||||
|
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||||
|
);
|
||||||
|
$totalMnt += $objp->Mnttot;
|
||||||
|
$this->info_box_contents[$line][4] = array(
|
||||||
|
'td' => 'align="right" width="18"',
|
||||||
|
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
||||||
|
);
|
||||||
|
$line++;
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
if ($num==0)
|
||||||
|
$this->info_box_contents[$line][0] = array(
|
||||||
|
'td' => 'align="center"',
|
||||||
|
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->info_box_contents[0][0] = array(
|
||||||
|
'td' => '',
|
||||||
|
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the sum in the bottom of the boxes
|
// Add the sum in the bottom of the boxes
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class CMailFile
|
|||||||
public $sendcontext;
|
public $sendcontext;
|
||||||
public $sendmode;
|
public $sendmode;
|
||||||
public $sendsetup;
|
public $sendsetup;
|
||||||
|
|
||||||
var $subject; // Topic: Subject of email
|
var $subject; // Topic: Subject of email
|
||||||
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
|
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
|
||||||
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
||||||
@ -115,14 +115,15 @@ class CMailFile
|
|||||||
global $conf, $dolibarr_main_data_root;
|
global $conf, $dolibarr_main_data_root;
|
||||||
|
|
||||||
$this->sendcontext = $sendcontext;
|
$this->sendcontext = $sendcontext;
|
||||||
|
|
||||||
|
// Define this->sendmode
|
||||||
$this->sendmode = '';
|
$this->sendmode = '';
|
||||||
if ($this->sendcontext == 'emailing') $this->sendmode = $conf->global->EMAILING_MAIL_SENDMODE;
|
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
|
{
|
||||||
|
$this->sendmode = $conf->global->MAIN_MAIL_SENDMODE_EMAILING;
|
||||||
|
}
|
||||||
if (empty($this->sendmode)) $this->sendmode=$conf->global->MAIN_MAIL_SENDMODE;
|
if (empty($this->sendmode)) $this->sendmode=$conf->global->MAIN_MAIL_SENDMODE;
|
||||||
if (empty($this->sendmode)) $this->sendmode='mail';
|
if (empty($this->sendmode)) $this->sendmode='mail';
|
||||||
|
|
||||||
$this->sendsetup = array();
|
|
||||||
|
|
||||||
|
|
||||||
// We define end of line (RFC 821).
|
// We define end of line (RFC 821).
|
||||||
$this->eol="\r\n";
|
$this->eol="\r\n";
|
||||||
@ -145,7 +146,7 @@ class CMailFile
|
|||||||
$this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars)
|
$this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars)
|
||||||
|
|
||||||
dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG);
|
dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG);
|
||||||
dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG);
|
dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG);
|
||||||
|
|
||||||
if (empty($subject))
|
if (empty($subject))
|
||||||
{
|
{
|
||||||
@ -157,7 +158,7 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
|
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
|
||||||
$msg='.'; // Avoid empty message (with empty message conten show a multipart structure)
|
$msg='.'; // Avoid empty message (with empty message conten show a multipart structure)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect if message is HTML (use fast method)
|
// Detect if message is HTML (use fast method)
|
||||||
if ($msgishtml == -1)
|
if ($msgishtml == -1)
|
||||||
@ -170,6 +171,16 @@ class CMailFile
|
|||||||
$this->msgishtml = $msgishtml;
|
$this->msgishtml = $msgishtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global $dolibarr_main_url_root;
|
||||||
|
|
||||||
|
// Define $urlwithroot
|
||||||
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
// Replace relative /viewimage to absolute path
|
||||||
|
$msg = preg_replace('/src="'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage\.php/ims', 'src="'.$urlwithroot.'/viewimage.php', $msg, -1, $nbrep);
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html.
|
if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html.
|
||||||
|
|
||||||
// Detect images
|
// Detect images
|
||||||
@ -230,7 +241,7 @@ class CMailFile
|
|||||||
$this->addr_bcc = $addr_bcc;
|
$this->addr_bcc = $addr_bcc;
|
||||||
$this->deliveryreceipt = $deliveryreceipt;
|
$this->deliveryreceipt = $deliveryreceipt;
|
||||||
$this->trackid = $trackid;
|
$this->trackid = $trackid;
|
||||||
|
|
||||||
$smtp_headers = $this->write_smtpheaders();
|
$smtp_headers = $this->write_smtpheaders();
|
||||||
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
|
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
|
||||||
|
|
||||||
@ -339,7 +350,7 @@ class CMailFile
|
|||||||
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
|
$this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From
|
||||||
// TODO Add trackid into smtp header
|
// TODO Add trackid into smtp header
|
||||||
// TODO if (! empty($moreinheader)) ...
|
// TODO if (! empty($moreinheader)) ...
|
||||||
|
|
||||||
if (! empty($this->html))
|
if (! empty($this->html))
|
||||||
{
|
{
|
||||||
if (!empty($css))
|
if (!empty($css))
|
||||||
@ -487,9 +498,7 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||||
$hookmanager = new HookManager($db);
|
$hookmanager = new HookManager($db);
|
||||||
$hookmanager->initHooks(array(
|
$hookmanager->initHooks(array('maildao'));
|
||||||
'maildao'
|
|
||||||
));
|
|
||||||
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (! empty($reshook))
|
if (! empty($reshook))
|
||||||
{
|
{
|
||||||
@ -532,6 +541,22 @@ class CMailFile
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$keyforsmtpserver='MAIN_MAIL_SMTP_SERVER';
|
||||||
|
$keyforsmtpport ='MAIN_MAIL_SMTP_PORT';
|
||||||
|
$keyforsmtpid ='MAIN_MAIL_SMTPS_ID';
|
||||||
|
$keyforsmtppw ='MAIN_MAIL_SMTPS_PW';
|
||||||
|
$keyfortls ='MAIN_MAIL_EMAIL_TLS';
|
||||||
|
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS';
|
||||||
|
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
|
{
|
||||||
|
$keyforsmtpserver='MAIN_MAIL_SMTP_SERVER_EMAILING';
|
||||||
|
$keyforsmtpport ='MAIN_MAIL_SMTP_PORT_EMAILING';
|
||||||
|
$keyforsmtpid ='MAIN_MAIL_SMTPS_ID_EMAILING';
|
||||||
|
$keyforsmtppw ='MAIN_MAIL_SMTPS_PW_EMAILING';
|
||||||
|
$keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING';
|
||||||
|
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
|
||||||
|
}
|
||||||
|
|
||||||
// Action according to choosed sending method
|
// Action according to choosed sending method
|
||||||
if ($this->sendmode == 'mail')
|
if ($this->sendmode == 'mail')
|
||||||
{
|
{
|
||||||
@ -548,9 +573,9 @@ class CMailFile
|
|||||||
@ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2));
|
@ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forcage parametres
|
// Force parameters
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_set('SMTP',$conf->global->MAIN_MAIL_SMTP_SERVER);
|
if (! empty($conf->global->$keyforsmtpserver)) ini_set('SMTP',$conf->global->$keyforsmtpserver);
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_set('smtp_port',$conf->global->MAIN_MAIL_SMTP_PORT);
|
if (! empty($conf->global->$keyforsmtpport)) ini_set('smtp_port',$conf->global->$keyforsmtpport);
|
||||||
|
|
||||||
$dest=$this->getValidAddress($this->addr_to,2);
|
$dest=$this->getValidAddress($this->addr_to,2);
|
||||||
if (! $dest)
|
if (! $dest)
|
||||||
@ -610,9 +635,9 @@ class CMailFile
|
|||||||
@ini_restore('sendmail_from');
|
@ini_restore('sendmail_from');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forcage parametres
|
// Restore parameters
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP');
|
if (! empty($conf->global->$keyforsmtpserver)) ini_restore('SMTP');
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port');
|
if (! empty($conf->global->$keyforsmtpport)) ini_restore('smtp_port');
|
||||||
}
|
}
|
||||||
else if ($this->sendmode == 'smtps')
|
else if ($this->sendmode == 'smtps')
|
||||||
{
|
{
|
||||||
@ -622,28 +647,30 @@ class CMailFile
|
|||||||
$this->smtps->setTransportType(0); // Only this method is coded in SMTPs library
|
$this->smtps->setTransportType(0); // Only this method is coded in SMTPs library
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP');
|
||||||
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port');
|
||||||
|
|
||||||
// TODO Manage alternative parameters
|
|
||||||
|
|
||||||
// If we use SSL/TLS
|
// If we use SSL/TLS
|
||||||
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
|
$server=$conf->global->$keyforsmtpserver;
|
||||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
|
$secure='';
|
||||||
$port=$conf->global->MAIN_MAIL_SMTP_PORT;
|
if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure='ssl';
|
||||||
|
if (! empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure='tls';
|
||||||
|
$server=($secure?$secure.'://':'').$server;
|
||||||
|
|
||||||
|
$port=$conf->global->$keyforsmtpport;
|
||||||
|
|
||||||
$this->smtps->setHost($server);
|
$this->smtps->setHost($server);
|
||||||
$this->smtps->setPort($port); // 25, 465...;
|
$this->smtps->setPort($port); // 25, 465...;
|
||||||
|
|
||||||
$loginid=''; $loginpass='';
|
$loginid=''; $loginpass='';
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID))
|
if (! empty($conf->global->$keyforsmtpid))
|
||||||
{
|
{
|
||||||
$loginid = $conf->global->MAIN_MAIL_SMTPS_ID;
|
$loginid = $conf->global->$keyforsmtpid;
|
||||||
$this->smtps->setID($loginid);
|
$this->smtps->setID($loginid);
|
||||||
}
|
}
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW))
|
if (! empty($conf->global->$keyforsmtppw))
|
||||||
{
|
{
|
||||||
$loginpass = $conf->global->MAIN_MAIL_SMTPS_PW;
|
$loginpass = $conf->global->$keyforsmtppw;
|
||||||
$this->smtps->setPW($loginpass);
|
$this->smtps->setPW($loginpass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,14 +678,14 @@ class CMailFile
|
|||||||
$from=$this->smtps->getFrom('org');
|
$from=$this->smtps->getFrom('org');
|
||||||
if (! $from)
|
if (! $from)
|
||||||
{
|
{
|
||||||
$this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->MAIN_MAIL_SMTP_PORT."<br>Sender address '$from' invalid";
|
$this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Sender address '$from' invalid";
|
||||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||||
$res=false;
|
$res=false;
|
||||||
}
|
}
|
||||||
$dest=$this->smtps->getTo();
|
$dest=$this->smtps->getTo();
|
||||||
if (! $dest)
|
if (! $dest)
|
||||||
{
|
{
|
||||||
$this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->MAIN_MAIL_SMTP_PORT."<br>Recipient address '$dest' invalid";
|
$this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Recipient address '$dest' invalid";
|
||||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||||
$res=false;
|
$res=false;
|
||||||
}
|
}
|
||||||
@ -666,7 +693,7 @@ class CMailFile
|
|||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
||||||
|
|
||||||
$result=$this->smtps->sendMsg();
|
$result=$this->smtps->sendMsg();
|
||||||
//print $result;
|
//print $result;
|
||||||
|
|
||||||
@ -684,26 +711,24 @@ class CMailFile
|
|||||||
}
|
}
|
||||||
else if ($this->sendmode == 'swiftmailer')
|
else if ($this->sendmode == 'swiftmailer')
|
||||||
{
|
{
|
||||||
|
|
||||||
// Use Swift Mailer library
|
// Use Swift Mailer library
|
||||||
// ------------------------------------------
|
// ------------------------------------------
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||||
|
|
||||||
// Forcage parametres
|
// Clean parameters
|
||||||
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP');
|
||||||
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port');
|
||||||
|
|
||||||
// If we use SSL/TLS
|
// If we use SSL/TLS
|
||||||
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
|
$server=$conf->global->$keyforsmtpserver;
|
||||||
$secure='';
|
$secure='';
|
||||||
//var_dump(stream_get_transports());
|
if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure='ssl';
|
||||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl';
|
if (! empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure='tls';
|
||||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls';
|
|
||||||
|
|
||||||
$this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure);
|
$this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->$keyforsmtpport, $secure);
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID);
|
if (! empty($conf->global->$keyforsmtpid)) $this->transport->setUsername($conf->global->$keyforsmtpid);
|
||||||
if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW);
|
if (! empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw);
|
||||||
//$smtps->_msgReplyTo = 'reply@web.com';
|
//$smtps->_msgReplyTo = 'reply@web.com';
|
||||||
|
|
||||||
// Create the Mailer using your created Transport
|
// Create the Mailer using your created Transport
|
||||||
@ -1026,7 +1051,7 @@ class CMailFile
|
|||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->related_boundary . $this->eol;
|
$out.= "--" . $this->related_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
@ -1036,7 +1061,7 @@ class CMailFile
|
|||||||
$out.= $this->eol.$strContentAltText.$this->eol;
|
$out.= $this->eol.$strContentAltText.$this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
$out.= $this->eol.$strContent.$this->eol;
|
$out.= $this->eol.$strContent.$this->eol;
|
||||||
|
|
||||||
@ -1154,13 +1179,30 @@ class CMailFile
|
|||||||
function check_server_port($host,$port)
|
function check_server_port($host,$port)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$_retVal=0;
|
$_retVal=0;
|
||||||
$timeout=5; // Timeout in seconds
|
$timeout=5; // Timeout in seconds
|
||||||
|
|
||||||
if (function_exists('fsockopen'))
|
if (function_exists('fsockopen'))
|
||||||
{
|
{
|
||||||
|
$keyforsmtpserver='MAIN_MAIL_SMTP_SERVER';
|
||||||
|
$keyforsmtpport ='MAIN_MAIL_SMTP_PORT';
|
||||||
|
$keyforsmtpid ='MAIN_MAIL_SMTPS_ID';
|
||||||
|
$keyforsmtppw ='MAIN_MAIL_SMTPS_PW';
|
||||||
|
$keyfortls ='MAIN_MAIL_EMAIL_TLS';
|
||||||
|
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS';
|
||||||
|
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
|
{
|
||||||
|
$keyforsmtpserver='MAIN_MAIL_SMTP_SERVER_EMAILING';
|
||||||
|
$keyforsmtpport ='MAIN_MAIL_SMTP_PORT_EMAILING';
|
||||||
|
$keyforsmtpid ='MAIN_MAIL_SMTPS_ID_EMAILING';
|
||||||
|
$keyforsmtppw ='MAIN_MAIL_SMTPS_PW_EMAILING';
|
||||||
|
$keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING';
|
||||||
|
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
|
||||||
|
}
|
||||||
|
|
||||||
// If we use SSL/TLS
|
// If we use SSL/TLS
|
||||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host;
|
if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $host='ssl://'.$host;
|
||||||
// tls smtp start with no encryption
|
// tls smtp start with no encryption
|
||||||
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
|
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
|
||||||
|
|
||||||
@ -1355,7 +1397,7 @@ class CMailFile
|
|||||||
if ($email)
|
if ($email)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$newemail='';
|
$newemail='';
|
||||||
if ($format == 4)
|
if ($format == 4)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4352,6 +4352,12 @@ abstract class CommonObject
|
|||||||
$this->array_options[$key] = null;
|
$this->array_options[$key] = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/*case 'select': // Not required, we chosed value='0' for undefined values
|
||||||
|
if ($value=='-1')
|
||||||
|
{
|
||||||
|
$this->array_options[$key] = null;
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
case 'price':
|
case 'price':
|
||||||
$this->array_options[$key] = price2num($this->array_options[$key]);
|
$this->array_options[$key] = price2num($this->array_options[$key]);
|
||||||
break;
|
break;
|
||||||
@ -4485,6 +4491,12 @@ abstract class CommonObject
|
|||||||
$this->array_options["options_".$key] = null;
|
$this->array_options["options_".$key] = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/*case 'select': // Not required, we chosed value='0' for undefined values
|
||||||
|
if ($value=='-1')
|
||||||
|
{
|
||||||
|
$this->array_options[$key] = null;
|
||||||
|
}
|
||||||
|
break;*/
|
||||||
case 'price':
|
case 'price':
|
||||||
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
|
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
|
||||||
break;
|
break;
|
||||||
@ -4553,6 +4565,9 @@ abstract class CommonObject
|
|||||||
$e = 0;
|
$e = 0;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
|
// Load language if required
|
||||||
|
if (! empty($extrafields->attributes[$this->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
|
||||||
|
|
||||||
if (is_array($params) && count($params)>0) {
|
if (is_array($params) && count($params)>0) {
|
||||||
if (array_key_exists('colspan',$params)) {
|
if (array_key_exists('colspan',$params)) {
|
||||||
$colspan=$params['colspan'];
|
$colspan=$params['colspan'];
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to build graphs.
|
* Class to build graphs.
|
||||||
* Usage is:
|
* Usage is:
|
||||||
* $dolgraph=new DolGraph();
|
* $dolgraph=new DolGraph();
|
||||||
* $dolgraph->SetTitle($langs->transnoentities('Tracking_Projects_Pourcent').'<br>'.$langs->transnoentities('Tracking_IndicatorDefGraph').'%');
|
* $dolgraph->SetTitle($langs->transnoentities('Tracking_Projects_Pourcent').'<br>'.$langs->transnoentities('Tracking_IndicatorDefGraph').'%');
|
||||||
* $dolgraph->SetMaxValue(50);
|
* $dolgraph->SetMaxValue(50);
|
||||||
@ -570,6 +570,7 @@ class DolGraph
|
|||||||
function GetFloorMinValue()
|
function GetFloorMinValue()
|
||||||
{
|
{
|
||||||
$min = $this->GetMinValueInData();
|
$min = $this->GetMinValueInData();
|
||||||
|
if ($min == '') $min=0;
|
||||||
if ($min != 0) $min--;
|
if ($min != 0) $min--;
|
||||||
$size=dol_strlen(abs(floor($min)));
|
$size=dol_strlen(abs(floor($min)));
|
||||||
$factor=1;
|
$factor=1;
|
||||||
@ -868,7 +869,7 @@ class DolGraph
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($this->cssprefix)?'':' dolgraph'.$this->cssprefix).'"></div>'."\n";
|
$this->stringtoshow.='<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($this->cssprefix)?'':' dolgraph'.$this->cssprefix).'"></div>'."\n";
|
||||||
|
|
||||||
$this->stringtoshow.='<script id="'.$tag.'">'."\n";
|
$this->stringtoshow.='<script id="'.$tag.'">'."\n";
|
||||||
$this->stringtoshow.='$(function () {'."\n";
|
$this->stringtoshow.='$(function () {'."\n";
|
||||||
$i=$firstlot;
|
$i=$firstlot;
|
||||||
|
|||||||
@ -64,7 +64,9 @@ class ExtraFields
|
|||||||
var $attribute_alwayseditable;
|
var $attribute_alwayseditable;
|
||||||
// Array to store permission to check
|
// Array to store permission to check
|
||||||
var $attribute_perms;
|
var $attribute_perms;
|
||||||
// Array to store permission to check
|
// Array to store language file to translate label of values
|
||||||
|
var $attribute_langfile;
|
||||||
|
// Array to store if field is visible by default on list
|
||||||
var $attribute_list;
|
var $attribute_list;
|
||||||
// Array to store if extra field is hidden
|
// Array to store if extra field is hidden
|
||||||
var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
|
var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
|
||||||
@ -117,6 +119,7 @@ class ExtraFields
|
|||||||
$this->attribute_unique = array();
|
$this->attribute_unique = array();
|
||||||
$this->attribute_required = array();
|
$this->attribute_required = array();
|
||||||
$this->attribute_perms = array();
|
$this->attribute_perms = array();
|
||||||
|
$this->attribute_langfile = array();
|
||||||
$this->attribute_list = array();
|
$this->attribute_list = array();
|
||||||
$this->attribute_hidden = array();
|
$this->attribute_hidden = array();
|
||||||
}
|
}
|
||||||
@ -124,25 +127,26 @@ class ExtraFields
|
|||||||
/**
|
/**
|
||||||
* Add a new extra field parameter
|
* Add a new extra field parameter
|
||||||
*
|
*
|
||||||
* @param string $attrname Code of attribute
|
* @param string $attrname Code of attribute
|
||||||
* @param string $label label of attribute
|
* @param string $label label of attribute
|
||||||
* @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
|
* @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
|
||||||
* @param int $pos Position of attribute
|
* @param int $pos Position of attribute
|
||||||
* @param string $size Size/length of attribute
|
* @param string $size Size/length of attribute
|
||||||
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
||||||
* @param int $unique Is field unique or not
|
* @param int $unique Is field unique or not
|
||||||
* @param int $required Is field required or not
|
* @param int $required Is field required or not
|
||||||
* @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue')
|
* @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue')
|
||||||
* @param array $param Params for field
|
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||||
* @param string $perms Permission to check
|
* @param string $perms Permission to check
|
||||||
* @param int $list Into list view by default
|
* @param int $list Into list view by default
|
||||||
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
* @param string $entity Entity of extrafields
|
* @param string $entity Entity of extrafields
|
||||||
|
* @param string $langfile Language file
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='', $entity='')
|
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='', $entity='', $langfile='')
|
||||||
{
|
{
|
||||||
if (empty($attrname)) return -1;
|
if (empty($attrname)) return -1;
|
||||||
if (empty($label)) return -1;
|
if (empty($label)) return -1;
|
||||||
@ -159,7 +163,7 @@ class ExtraFields
|
|||||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||||
{
|
{
|
||||||
// Add declaration of field into table
|
// Add declaration of field into table
|
||||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden, $default, $computed, $entity);
|
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden, $default, $computed, $entity, $langfile);
|
||||||
$err2=$this->errno;
|
$err2=$this->errno;
|
||||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
||||||
{
|
{
|
||||||
@ -271,7 +275,7 @@ class ExtraFields
|
|||||||
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
||||||
* @param int $unique Is field unique or not
|
* @param int $unique Is field unique or not
|
||||||
* @param int $required Is field required or not
|
* @param int $required Is field required or not
|
||||||
* @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||||
* @param string $perms Permission to check
|
* @param string $perms Permission to check
|
||||||
* @param int $list Into list view by default
|
* @param int $list Into list view by default
|
||||||
@ -279,9 +283,10 @@ class ExtraFields
|
|||||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
* @param string $entity Entity of extrafields
|
* @param string $entity Entity of extrafields
|
||||||
|
* @param string $langfile Language file
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='',$entity='')
|
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='',$entity='', $langfile='')
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
@ -320,6 +325,7 @@ class ExtraFields
|
|||||||
$sql.= " param,";
|
$sql.= " param,";
|
||||||
$sql.= " alwayseditable,";
|
$sql.= " alwayseditable,";
|
||||||
$sql.= " perms,";
|
$sql.= " perms,";
|
||||||
|
$sql.= " langs,";
|
||||||
$sql.= " list,";
|
$sql.= " list,";
|
||||||
$sql.= " ishidden,";
|
$sql.= " ishidden,";
|
||||||
$sql.= " fielddefault,";
|
$sql.= " fielddefault,";
|
||||||
@ -340,6 +346,7 @@ class ExtraFields
|
|||||||
$sql.= " '".$params."',";
|
$sql.= " '".$params."',";
|
||||||
$sql.= " '".$alwayseditable."',";
|
$sql.= " '".$alwayseditable."',";
|
||||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||||
|
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
|
||||||
$sql.= " ".$list.",";
|
$sql.= " ".$list.",";
|
||||||
$sql.= " ".$ishidden.",";
|
$sql.= " ".$ishidden.",";
|
||||||
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
|
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
|
||||||
@ -348,7 +355,7 @@ class ExtraFields
|
|||||||
$sql .= " " . $user->id . ",";
|
$sql .= " " . $user->id . ",";
|
||||||
$sql .= "'" . $this->db->idate(dol_now()) . "'";
|
$sql .= "'" . $this->db->idate(dol_now()) . "'";
|
||||||
$sql.=')';
|
$sql.=')';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
@ -466,13 +473,13 @@ class ExtraFields
|
|||||||
*
|
*
|
||||||
* @param string $attrname Name of attribute
|
* @param string $attrname Name of attribute
|
||||||
* @param string $label Label of attribute
|
* @param string $label Label of attribute
|
||||||
* @param string $type Type of attribute
|
* @param string $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
|
||||||
* @param int $length Length of attribute
|
* @param int $length Length of attribute
|
||||||
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
|
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
|
||||||
* @param int $unique Is field unique or not
|
* @param int $unique Is field unique or not
|
||||||
* @param int $required Is field required or not
|
* @param int $required Is field required or not
|
||||||
* @param int $pos Position of attribute
|
* @param int $pos Position of attribute
|
||||||
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||||
* @param string $perms Permission to check
|
* @param string $perms Permission to check
|
||||||
* @param int $list Into list view by default
|
* @param int $list Into list view by default
|
||||||
@ -480,9 +487,10 @@ class ExtraFields
|
|||||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
* @param string $entity Entity of extrafields
|
* @param string $entity Entity of extrafields
|
||||||
|
* @param string $langfile Language file
|
||||||
* @return int >0 if OK, <=0 if KO
|
* @return int >0 if OK, <=0 if KO
|
||||||
*/
|
*/
|
||||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0,$default='',$computed='',$entity='')
|
function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $ishidden=0, $default='', $computed='', $entity='', $langfile='')
|
||||||
{
|
{
|
||||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
@ -530,7 +538,7 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
if ($label)
|
if ($label)
|
||||||
{
|
{
|
||||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden,$default,$computed,$entity);
|
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden,$default,$computed,$entity,$langfile);
|
||||||
}
|
}
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -585,12 +593,13 @@ class ExtraFields
|
|||||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||||
* @param string $computed Computed value
|
* @param string $computed Computed value
|
||||||
* @param string $entity Entity of extrafields
|
* @param string $entity Entity of extrafields
|
||||||
|
* @param string $langfile Language file
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='',$entity='')
|
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0,$default='',$computed='',$entity='',$langfile='')
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed.", ".$entity);
|
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden.", ".$default.", ".$computed.", ".$entity.", ".$langfile);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||||
@ -624,6 +633,7 @@ class ExtraFields
|
|||||||
$sql.= " fieldunique,";
|
$sql.= " fieldunique,";
|
||||||
$sql.= " fieldrequired,";
|
$sql.= " fieldrequired,";
|
||||||
$sql.= " perms,";
|
$sql.= " perms,";
|
||||||
|
$sql.= " langs,";
|
||||||
$sql.= " pos,";
|
$sql.= " pos,";
|
||||||
$sql.= " alwayseditable,";
|
$sql.= " alwayseditable,";
|
||||||
$sql.= " param,";
|
$sql.= " param,";
|
||||||
@ -644,6 +654,7 @@ class ExtraFields
|
|||||||
$sql.= " '".$unique."',";
|
$sql.= " '".$unique."',";
|
||||||
$sql.= " '".$required."',";
|
$sql.= " '".$required."',";
|
||||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||||
|
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
|
||||||
$sql.= " '".$pos."',";
|
$sql.= " '".$pos."',";
|
||||||
$sql.= " '".$alwayseditable."',";
|
$sql.= " '".$alwayseditable."',";
|
||||||
$sql.= " '".$param."',";
|
$sql.= " '".$param."',";
|
||||||
@ -702,7 +713,7 @@ class ExtraFields
|
|||||||
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
|
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
|
||||||
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
|
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
|
||||||
|
|
||||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden,fielddefault,fieldcomputed";
|
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,ishidden,fielddefault,fieldcomputed";
|
||||||
$sql .= ",entity";
|
$sql .= ",entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||||
@ -721,8 +732,6 @@ class ExtraFields
|
|||||||
{
|
{
|
||||||
$array_name_label[$tab->name]=$tab->label;
|
$array_name_label[$tab->name]=$tab->label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Old usage
|
// Old usage
|
||||||
$this->attribute_type[$tab->name]=$tab->type;
|
$this->attribute_type[$tab->name]=$tab->type;
|
||||||
@ -737,11 +746,10 @@ class ExtraFields
|
|||||||
$this->attribute_pos[$tab->name]=$tab->pos;
|
$this->attribute_pos[$tab->name]=$tab->pos;
|
||||||
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
||||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||||
|
$this->attribute_langfile[$tab->langs]=$tab->langs;
|
||||||
$this->attribute_list[$tab->name]=$tab->list;
|
$this->attribute_list[$tab->name]=$tab->list;
|
||||||
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
||||||
$this->attribute_entityid[$tab->name]=$tab->entity;
|
$this->attribute_entityid[$tab->name]=$tab->entity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// New usage
|
// New usage
|
||||||
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
|
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
|
||||||
@ -756,11 +764,12 @@ class ExtraFields
|
|||||||
$this->attributes[$tab->elementtype]['pos'][$tab->name]=$tab->pos;
|
$this->attributes[$tab->elementtype]['pos'][$tab->name]=$tab->pos;
|
||||||
$this->attributes[$tab->elementtype]['alwayseditable'][$tab->name]=$tab->alwayseditable;
|
$this->attributes[$tab->elementtype]['alwayseditable'][$tab->name]=$tab->alwayseditable;
|
||||||
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
|
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
|
||||||
|
$this->attributes[$tab->elementtype]['langfile'][$tab->name]=$tab->langs;
|
||||||
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
|
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
|
||||||
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
|
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
|
||||||
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
||||||
|
|
||||||
|
|
||||||
if (!empty($conf->multicompany->enabled)) {
|
if (!empty($conf->multicompany->enabled)) {
|
||||||
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
|
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
|
||||||
$resql_entity_name=$this->db->query($sql_entity_name);
|
$resql_entity_name=$this->db->query($sql_entity_name);
|
||||||
@ -820,7 +829,7 @@ class ExtraFields
|
|||||||
$unique=$this->attribute_unique[$key];
|
$unique=$this->attribute_unique[$key];
|
||||||
$required=$this->attribute_required[$key];
|
$required=$this->attribute_required[$key];
|
||||||
$param=$this->attribute_param[$key];
|
$param=$this->attribute_param[$key];
|
||||||
$perms=$this->attribute_perms[$key];
|
$langfile=$this->attribute_langfile[$key];
|
||||||
$list=$this->attribute_list[$key];
|
$list=$this->attribute_list[$key];
|
||||||
$hidden=$this->attribute_hidden[$key];
|
$hidden=$this->attribute_hidden[$key];
|
||||||
|
|
||||||
@ -944,10 +953,10 @@ class ExtraFields
|
|||||||
$out.='<option value="0"> </option>';
|
$out.='<option value="0"> </option>';
|
||||||
foreach ($param['options'] as $key => $val)
|
foreach ($param['options'] as $key => $val)
|
||||||
{
|
{
|
||||||
if ($key == '') continue;
|
if ((string) $key == '') continue;
|
||||||
list($val, $parent) = explode('|', $val);
|
list($val, $parent) = explode('|', $val);
|
||||||
$out.='<option value="'.$key.'"';
|
$out.='<option value="'.$key.'"';
|
||||||
$out.= ($value==$key?' selected':'');
|
$out.= (((string) $value == (string) $key)?' selected':'');
|
||||||
$out.= (!empty($parent)?' parent="'.$parent.'"':'');
|
$out.= (!empty($parent)?' parent="'.$parent.'"':'');
|
||||||
$out.='>'.$val.'</option>';
|
$out.='>'.$val.'</option>';
|
||||||
}
|
}
|
||||||
@ -1352,6 +1361,7 @@ class ExtraFields
|
|||||||
$required=$this->attribute_required[$key];
|
$required=$this->attribute_required[$key];
|
||||||
$params=$this->attribute_param[$key];
|
$params=$this->attribute_param[$key];
|
||||||
$perms=$this->attribute_perms[$key];
|
$perms=$this->attribute_perms[$key];
|
||||||
|
$langfile=$this->attribute_langfile[$key];
|
||||||
$list=$this->attribute_list[$key];
|
$list=$this->attribute_list[$key];
|
||||||
$hidden=$this->attribute_hidden[$key]; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
|
$hidden=$this->attribute_hidden[$key]; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
|
||||||
|
|
||||||
|
|||||||
@ -3403,12 +3403,12 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* Return list of categories having choosed type
|
* Return list of categories having choosed type
|
||||||
*
|
*
|
||||||
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
|
||||||
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||||
* @param string $htmlname HTML field name
|
* @param string $htmlname HTML field name
|
||||||
* @param int $maxlength Maximum length for labels
|
* @param int $maxlength Maximum length for labels
|
||||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||||
* @param int $outputmode 0=HTML select string, 1=Array
|
* @param int $outputmode 0=HTML select string, 1=Array
|
||||||
* @return string
|
* @return string
|
||||||
* @see select_categories
|
* @see select_categories
|
||||||
*/
|
*/
|
||||||
@ -3451,7 +3451,7 @@ class Form
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cat = new Categorie($this->db);
|
$cat = new Categorie($this->db);
|
||||||
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
|
$cate_arbo = $cat->get_full_arbo($type, $excludeafterid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||||
@ -5082,7 +5082,7 @@ class Form
|
|||||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||||
* @param array $array Array (key => value)
|
* @param array $array Array (key => value)
|
||||||
* @param string|string[] $id Preselected key or preselected keys for multiselect
|
* @param string|string[] $id Preselected key or preselected keys for multiselect
|
||||||
* @param int $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (value is '' or ' ' if 1), <0 to add an empty value with key that is this value.
|
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or ' ' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value.
|
||||||
* @param int $key_in_label 1 to show key into label with format "[key] value"
|
* @param int $key_in_label 1 to show key into label with format "[key] value"
|
||||||
* @param int $value_as_key 1 to use value as key
|
* @param int $value_as_key 1 to use value as key
|
||||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class FormAdmin
|
|||||||
$out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
$out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||||
if ($showempty)
|
if ($showempty)
|
||||||
{
|
{
|
||||||
$out.= '<option value=""';
|
$out.= '<option value="0"';
|
||||||
if ($selected == '') $out.= ' selected';
|
if ($selected == '') $out.= ' selected';
|
||||||
$out.= '>';
|
$out.= '>';
|
||||||
if ($showempty != '1') $out.=$showempty;
|
if ($showempty != '1') $out.=$showempty;
|
||||||
@ -85,16 +85,11 @@ class FormAdmin
|
|||||||
|
|
||||||
asort($langs_available);
|
asort($langs_available);
|
||||||
|
|
||||||
$uncompletelanguages=array('da_DA','fi_FI','hu_HU','is_IS','pl_PL','ro_RO','ru_RU','sv_SV','tr_TR','zh_CN');
|
|
||||||
foreach ($langs_available as $key => $value)
|
foreach ($langs_available as $key => $value)
|
||||||
{
|
{
|
||||||
$valuetoshow=$value;
|
$valuetoshow=$value;
|
||||||
if ($showcode) $valuetoshow=$key.' - '.$value;
|
if ($showcode) $valuetoshow=$key.' - '.$value;
|
||||||
|
|
||||||
if ($showwarning && in_array($key,$uncompletelanguages))
|
|
||||||
{
|
|
||||||
//$value.=' - '.$langs->trans("TranslationUncomplete",$key);
|
|
||||||
}
|
|
||||||
if ($filter && is_array($filter))
|
if ($filter && is_array($filter))
|
||||||
{
|
{
|
||||||
if ( ! array_key_exists($key, $filter))
|
if ( ! array_key_exists($key, $filter))
|
||||||
|
|||||||
@ -473,7 +473,7 @@ class FormMail extends Form
|
|||||||
$out.= ' <'.$this->tomail.'>';
|
$out.= ' <'.$this->tomail.'>';
|
||||||
if ($this->withtofree)
|
if ($this->withtofree)
|
||||||
{
|
{
|
||||||
$out.= '<br>'.$langs->trans("or").' <input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"").'" />';
|
$out.= '<br>'.$langs->trans("and").' <input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"").'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -489,7 +489,7 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
if (! empty($this->withto) && is_array($this->withto))
|
if (! empty($this->withto) && is_array($this->withto))
|
||||||
{
|
{
|
||||||
if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." ";
|
if (! empty($this->withtofree)) $out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||||
$tmparray = $this->withto;
|
$tmparray = $this->withto;
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
@ -522,7 +522,7 @@ class FormMail extends Form
|
|||||||
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||||
{
|
{
|
||||||
$out.= " ".$langs->trans("or")." ";
|
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||||
$tmparray = $this->withtocc;
|
$tmparray = $this->withtocc;
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
@ -551,7 +551,7 @@ class FormMail extends Form
|
|||||||
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||||
{
|
{
|
||||||
$out.= " ".$langs->trans("or")." ";
|
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||||
$tmparray = $this->withtoccc;
|
$tmparray = $this->withtoccc;
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
|
|||||||
@ -358,8 +358,11 @@ class SMTPs
|
|||||||
// This is done here because '@fsockopen' will not give me this
|
// This is done here because '@fsockopen' will not give me this
|
||||||
// information if it failes to connect because it can't find the HOST
|
// information if it failes to connect because it can't find the HOST
|
||||||
$host=$this->getHost();
|
$host=$this->getHost();
|
||||||
|
$usetls = preg_match('@tls://@i',$host);
|
||||||
|
|
||||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||||
|
$host=preg_replace('@tls://@i','',$host); // Remove prefix
|
||||||
|
|
||||||
// @CHANGE LDR
|
// @CHANGE LDR
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
@ -373,7 +376,7 @@ class SMTPs
|
|||||||
{
|
{
|
||||||
//See if we can connect to the SMTP server
|
//See if we can connect to the SMTP server
|
||||||
if ($this->socket = @fsockopen(
|
if ($this->socket = @fsockopen(
|
||||||
$this->getHost(), // Host to 'hit', IP or domain
|
preg_replace('@tls://@i','',$this->getHost()), // Host to 'hit', IP or domain
|
||||||
$this->getPort(), // which Port number to use
|
$this->getPort(), // which Port number to use
|
||||||
$this->errno, // actual system level error
|
$this->errno, // actual system level error
|
||||||
$this->errstr, // and any text that goes with the error
|
$this->errstr, // and any text that goes with the error
|
||||||
@ -416,16 +419,17 @@ class SMTPs
|
|||||||
// This improvment as provided by 'SirSir' to
|
// This improvment as provided by 'SirSir' to
|
||||||
// accomodate both SMTP AND ESMTP capable servers
|
// accomodate both SMTP AND ESMTP capable servers
|
||||||
$host=$this->getHost();
|
$host=$this->getHost();
|
||||||
|
$usetls = preg_match('@tls://@i',$host);
|
||||||
|
|
||||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||||
if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS))
|
$host=preg_replace('@tls://@i','',$host); // Remove prefix
|
||||||
{
|
|
||||||
$host=preg_replace('@tls://@i','',$host); // Remove prefix
|
if ($usetls) $host='tls://'.$host;
|
||||||
$host='tls://'.$host;
|
|
||||||
}
|
|
||||||
if ( $_retVal = $this->socket_send_str('EHLO ' . $host, '250') )
|
if ( $_retVal = $this->socket_send_str('EHLO ' . $host, '250') )
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS))
|
if ($usetls)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The following dialog illustrates how a client and server can start a TLS STARTTLS session
|
The following dialog illustrates how a client and server can start a TLS STARTTLS session
|
||||||
@ -443,7 +447,7 @@ class SMTPs
|
|||||||
// Second pass EHLO
|
// Second pass EHLO
|
||||||
C: EHLO client-domain.com
|
C: EHLO client-domain.com
|
||||||
S: 250-server-domain.com
|
S: 250-server-domain.com
|
||||||
S: 250 AUTH LOGIN
|
S: 250 AUTH LOGIN
|
||||||
C: <continues by sending an SMTP command
|
C: <continues by sending an SMTP command
|
||||||
*/
|
*/
|
||||||
if (!$_retVal = $this->socket_send_str('STARTTLS', 220))
|
if (!$_retVal = $this->socket_send_str('STARTTLS', 220))
|
||||||
@ -451,12 +455,26 @@ class SMTPs
|
|||||||
$this->_setErr(131, 'STARTTLS connection is not supported.');
|
$this->_setErr(131, 'STARTTLS connection is not supported.');
|
||||||
return $_retVal;
|
return $_retVal;
|
||||||
}
|
}
|
||||||
if (!stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))
|
|
||||||
|
// Before 5.6.7:
|
||||||
|
// STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_SSLv2_CLIENT|STREAM_CRYPTO_METHOD_SSLv3_CLIENT
|
||||||
|
// STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
|
||||||
|
// PHP >= 5.6.7:
|
||||||
|
// STREAM_CRYPTO_METHOD_SSLv23_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT|STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
|
||||||
|
// STREAM_CRYPTO_METHOD_TLS_CLIENT = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT
|
||||||
|
|
||||||
|
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
|
||||||
|
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
|
||||||
|
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||||
|
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream_socket_enable_crypto($this->socket, true, $crypto_method))
|
||||||
{
|
{
|
||||||
$this->_setErr(132, 'STARTTLS connection failed.');
|
$this->_setErr(132, 'STARTTLS connection failed.');
|
||||||
return $_retVal;
|
return $_retVal;
|
||||||
}
|
}
|
||||||
// Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
|
// Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
|
||||||
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
|
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
|
||||||
if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250'))
|
if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250'))
|
||||||
{
|
{
|
||||||
@ -514,8 +532,12 @@ class SMTPs
|
|||||||
{
|
{
|
||||||
// Send the RFC821 specified HELO.
|
// Send the RFC821 specified HELO.
|
||||||
$host=$this->getHost();
|
$host=$this->getHost();
|
||||||
|
$usetls = preg_match('@tls://@i',$host);
|
||||||
|
|
||||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||||
|
$host=preg_replace('@tls://@i','',$host); // Remove prefix
|
||||||
|
|
||||||
$_retVal = $this->socket_send_str('HELO ' . $host, '250');
|
$_retVal = $this->socket_send_str('HELO ' . $host, '250');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1237,8 +1259,11 @@ class SMTPs
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$host=$this->getHost();
|
$host=$this->getHost();
|
||||||
|
$usetls = preg_match('@tls://@i',$host);
|
||||||
|
|
||||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||||
|
$host=preg_replace('@tls://@i','',$host); // Remove prefix
|
||||||
|
|
||||||
$host=dol_getprefix('email');
|
$host=dol_getprefix('email');
|
||||||
|
|
||||||
|
|||||||
@ -143,7 +143,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
|||||||
{
|
{
|
||||||
while (! feof($fp))
|
while (! feof($fp))
|
||||||
{
|
{
|
||||||
$buf = fgets($fp, 4096);
|
$buf = fgets($fp, 32768);
|
||||||
|
|
||||||
// Test if request must be ran only for particular database or version (if yes, we must remove the -- comment)
|
// Test if request must be ran only for particular database or version (if yes, we must remove the -- comment)
|
||||||
if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg))
|
if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg))
|
||||||
@ -173,7 +173,11 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
|||||||
}
|
}
|
||||||
else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE
|
else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE
|
||||||
{
|
{
|
||||||
if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)))) $qualified=0;
|
$dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation));
|
||||||
|
//var_dump($reg[2]);
|
||||||
|
//var_dump($dbcollation);
|
||||||
|
if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) $qualified=0;
|
||||||
|
//var_dump($qualified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,9 +191,9 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add line buf to buffer if not a comment
|
// Add line buf to buffer if not a comment
|
||||||
if (! preg_match('/^--/',$buf))
|
if (! preg_match('/^\s*--/',$buf))
|
||||||
{
|
{
|
||||||
$buf=preg_replace('/--.*$/','',$buf); //remove comment from a line that not start with -- before add it to the buffer
|
$buf=preg_replace('/([,;ERLT\)])\s*--.*$/i','\1',$buf); //remove comment from a line that not start with -- before add it to the buffer
|
||||||
$buffer .= trim($buf);
|
$buffer .= trim($buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1043,7 +1043,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
|||||||
global $param;
|
global $param;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_object($filterobj)) dol_print_error('','BadParameter');
|
if (! is_object($filterobj) && ! is_object($objcon)) dol_print_error('','BadParameter');
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
$histo=array();
|
$histo=array();
|
||||||
@ -1061,24 +1061,24 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
|||||||
$sql.= " a.fk_user_author, a.fk_contact,";
|
$sql.= " a.fk_user_author, a.fk_contact,";
|
||||||
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
|
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
|
||||||
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
||||||
if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
|
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
|
||||||
if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
||||||
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
|
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||||
if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||||
if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||||
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
||||||
$sql.= " WHERE u.rowid = a.fk_user_action";
|
$sql.= " WHERE u.rowid = a.fk_user_action";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
||||||
if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
|
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
|
||||||
if (get_class($filterobj) == 'Adherent')
|
if (is_object($filterobj) && get_class($filterobj) == 'Adherent')
|
||||||
{
|
{
|
||||||
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||||
}
|
}
|
||||||
if (get_class($filterobj) == 'CommandeFournisseur')
|
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
|
||||||
{
|
{
|
||||||
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
|
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
|
||||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||||
@ -1239,7 +1239,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
|||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
|
|
||||||
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
if ($objcon && get_class($objcon) == 'Contact' && get_class($filterobj) == 'Societe')
|
if ($objcon && get_class($objcon) == 'Contact' && $filterobj && get_class($filterobj) == 'Societe')
|
||||||
{
|
{
|
||||||
$out.='<input type="hidden" name="id" value="'.$objcon->id.'" />';
|
$out.='<input type="hidden" name="id" value="'.$objcon->id.'" />';
|
||||||
}
|
}
|
||||||
@ -1247,7 +1247,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
|||||||
{
|
{
|
||||||
$out.='<input type="hidden" name="id" value="'.$filterobj->id.'" />';
|
$out.='<input type="hidden" name="id" value="'.$filterobj->id.'" />';
|
||||||
}
|
}
|
||||||
if (get_class($filterobj) == 'Societe') $out.='<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
|
if ($filterobj && get_class($filterobj) == 'Societe') $out.='<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
|
||||||
|
|
||||||
$out.="\n";
|
$out.="\n";
|
||||||
|
|
||||||
|
|||||||
@ -1929,7 +1929,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
|
|||||||
function dol_check_secure_access_document($modulepart, $original_file, $entity, $fuser='', $refname='', $mode='read')
|
function dol_check_secure_access_document($modulepart, $original_file, $entity, $fuser='', $refname='', $mode='read')
|
||||||
{
|
{
|
||||||
global $user, $conf, $db;
|
global $user, $conf, $db;
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root, $dolibarr_main_document_root_alt;
|
||||||
|
|
||||||
if (! is_object($fuser)) $fuser=$user;
|
if (! is_object($fuser)) $fuser=$user;
|
||||||
|
|
||||||
@ -1965,6 +1965,16 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||||||
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
|
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
|
||||||
$original_file=$dolibarr_main_data_root.'/'.$original_file;
|
$original_file=$dolibarr_main_data_root.'/'.$original_file;
|
||||||
}
|
}
|
||||||
|
// Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip
|
||||||
|
elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root))
|
||||||
|
{
|
||||||
|
// Dir for custom dirs
|
||||||
|
$tmp=explode(',', $dolibarr_main_document_root_alt);
|
||||||
|
$dirins = $tmp[0];
|
||||||
|
|
||||||
|
$accessallowed=($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file)));
|
||||||
|
$original_file=$dirins.'/'.$original_file;
|
||||||
|
}
|
||||||
// Wrapping for some images
|
// Wrapping for some images
|
||||||
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
|
elseif (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5895,6 +5895,7 @@ function picto_from_langcode($codelang)
|
|||||||
* 'supplier_invoice' to add a tab in supplier invoice view
|
* 'supplier_invoice' to add a tab in supplier invoice view
|
||||||
* 'invoice' to add a tab in customer invoice view
|
* 'invoice' to add a tab in customer invoice view
|
||||||
* 'order' to add a tab in customer order view
|
* 'order' to add a tab in customer order view
|
||||||
|
* 'contract' to add a tabl in contract view
|
||||||
* 'product' to add a tab in product view
|
* 'product' to add a tab in product view
|
||||||
* 'propal' to add a tab in propal view
|
* 'propal' to add a tab in propal view
|
||||||
* 'user' to add a tab in user view
|
* 'user' to add a tab in user view
|
||||||
@ -6270,7 +6271,7 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
|||||||
$newres .= $db->escape($tmpcrit2);
|
$newres .= $db->escape($tmpcrit2);
|
||||||
$newres .= $tmpafter;
|
$newres .= $tmpafter;
|
||||||
$newres .= "'";
|
$newres .= "'";
|
||||||
if (empty($tmpcrit2))
|
if ($tmpcrit2 == '')
|
||||||
{
|
{
|
||||||
$newres .= ' OR ' . $field . " IS NULL";
|
$newres .= ' OR ' . $field . " IS NULL";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -707,9 +707,10 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
|||||||
* @param string $date Date to use for the {y},{m},{d} tags.
|
* @param string $date Date to use for the {y},{m},{d} tags.
|
||||||
* @param string $mode 'next' for next value or 'last' for last value
|
* @param string $mode 'next' for next value or 'last' for last value
|
||||||
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
|
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
|
||||||
|
* @param User $objuser Object user we need data from.
|
||||||
* @return string New value (numeric) or error message
|
* @return string New value (numeric) or error message
|
||||||
*/
|
*/
|
||||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true)
|
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true, $objuser=null)
|
||||||
{
|
{
|
||||||
global $conf,$user;
|
global $conf,$user;
|
||||||
|
|
||||||
@ -780,6 +781,22 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$masktype_value='';
|
$masktype_value='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract value for user
|
||||||
|
if (preg_match('/\{(u+)\}/i',$mask,$regType))
|
||||||
|
{
|
||||||
|
$lastname = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
|
||||||
|
if (is_object($objuser)) $lastname = $objuser->lastname;
|
||||||
|
|
||||||
|
$maskuser=$regType[1];
|
||||||
|
$maskuser_value=substr($lastname,0,dol_strlen($regType[1]));// get n first characters of user firstname (where n is length in mask)
|
||||||
|
$maskuser_value=str_pad($maskuser_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$maskuser='';
|
||||||
|
$maskuser_value='';
|
||||||
|
}
|
||||||
|
|
||||||
// Personalized field {XXX-1} à {XXX-9}
|
// Personalized field {XXX-1} à {XXX-9}
|
||||||
/*$maskperso=array();
|
/*$maskperso=array();
|
||||||
$maskpersonew=array();
|
$maskpersonew=array();
|
||||||
@ -805,6 +822,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);
|
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);
|
||||||
$maskwithonlyymcode=preg_replace('/\{(c+)(0*)\}/i',$maskrefclient,$maskwithonlyymcode);
|
$maskwithonlyymcode=preg_replace('/\{(c+)(0*)\}/i',$maskrefclient,$maskwithonlyymcode);
|
||||||
$maskwithonlyymcode=preg_replace('/\{(t+)\}/i',$masktype_value,$maskwithonlyymcode);
|
$maskwithonlyymcode=preg_replace('/\{(t+)\}/i',$masktype_value,$maskwithonlyymcode);
|
||||||
|
$maskwithonlyymcode=preg_replace('/\{(u+)\}/i',$maskuser_value,$maskwithonlyymcode);
|
||||||
/*foreach($maskperso as $key => $val)
|
/*foreach($maskperso as $key => $val)
|
||||||
{
|
{
|
||||||
$maskwithonlyymcode=preg_replace('/'.$val.'/i', $maskpersonew[$key], $maskwithonlyymcode);
|
$maskwithonlyymcode=preg_replace('/'.$val.'/i', $maskpersonew[$key], $maskwithonlyymcode);
|
||||||
@ -951,6 +969,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
|
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
|
||||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||||
|
if ($maskuser) $maskLike = str_replace(dol_string_nospecial('{'.$maskuser.'}'),$maskuser_value,$maskLike);
|
||||||
|
|
||||||
// Get counter in database
|
// Get counter in database
|
||||||
$counter=0;
|
$counter=0;
|
||||||
@ -994,6 +1013,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
||||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||||
|
if ($maskuser) $maskLike = str_replace(dol_string_nospecial('{'.$maskuser.'}'),$maskuser_value,$maskLike);
|
||||||
|
|
||||||
$ref='';
|
$ref='';
|
||||||
$sql = "SELECT ".$field." as ref";
|
$sql = "SELECT ".$field." as ref";
|
||||||
@ -1114,6 +1134,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
$masktype_maskafter=$masktype_value;
|
$masktype_maskafter=$masktype_value;
|
||||||
$numFinal = str_replace($masktype_maskbefore,$masktype_maskafter,$numFinal);
|
$numFinal = str_replace($masktype_maskbefore,$masktype_maskafter,$numFinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now we replace the user
|
||||||
|
if ($maskuser)
|
||||||
|
{
|
||||||
|
$maskuser_maskbefore='{'.$maskuser.'}';
|
||||||
|
$maskuser_maskafter=$maskuser_value;
|
||||||
|
$numFinal = str_replace($maskuser_maskbefore,$maskuser_maskafter,$numFinal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
|
||||||
|
* Copyright (C) 2017 ATM-CONSULTING <contact@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -151,6 +152,16 @@ function invoice_admin_prepare_head()
|
|||||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
$head[$h][2] = 'attributeslines';
|
$head[$h][2] = 'attributeslines';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec");
|
||||||
|
$head[$h][2] = 'attributesrec';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFieldsLinesRec");
|
||||||
|
$head[$h][2] = 'attributeslinesrec';
|
||||||
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
|
complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove');
|
||||||
|
|
||||||
|
|||||||
@ -635,12 +635,27 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Project
|
||||||
|
print "<td>";
|
||||||
|
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||||
|
print "</td>";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||||
print $taskstatic->getNomUrl(1,'withproject');
|
print $taskstatic->getNomUrl(1,'withproject');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
||||||
|
{
|
||||||
|
// Thirdparty
|
||||||
|
print '<td class="tdoverflowmax100">';
|
||||||
|
$thirdpartystatic->id=$lines[$i]->socid;
|
||||||
|
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||||
|
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Label task
|
// Label task
|
||||||
print "<td>";
|
print "<td>";
|
||||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||||
@ -654,21 +669,6 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Project
|
|
||||||
print "<td>";
|
|
||||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
|
|
||||||
{
|
|
||||||
// Thirdparty
|
|
||||||
print '<td class="tdoverflowmax100">';
|
|
||||||
$thirdpartystatic->id=$lines[$i]->socid;
|
|
||||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
|
||||||
print $thirdpartystatic->getNomUrl(1, 'project', 10);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Planned Workload
|
// Planned Workload
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||||
@ -745,7 +745,13 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
|||||||
// Warning
|
// Warning
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
|
else if ($disabledtask)
|
||||||
|
{
|
||||||
|
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||||
|
if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...');
|
||||||
|
|
||||||
|
print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask));
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -834,6 +840,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
$workloadforid[$projectstatic->id]=1;
|
$workloadforid[$projectstatic->id]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$projectstatic->id=$lines[$i]->fk_project;
|
||||||
|
$projectstatic->ref=$lines[$i]->projectref;
|
||||||
|
$projectstatic->title=$lines[$i]->projectlabel;
|
||||||
|
$projectstatic->public=$lines[$i]->public;
|
||||||
|
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
|
||||||
|
|
||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
|
|
||||||
// User
|
// User
|
||||||
@ -843,6 +855,21 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Project
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
||||||
|
print "</td>";
|
||||||
|
|
||||||
|
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
||||||
|
{
|
||||||
|
// Thirdparty
|
||||||
|
print '<td class="tdoverflowmax100">';
|
||||||
|
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
||||||
|
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
||||||
|
print $thirdpartystatic->getNomUrl(1, 'project');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$taskstatic->id=$lines[$i]->id;
|
$taskstatic->id=$lines[$i]->id;
|
||||||
@ -864,26 +891,6 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Project
|
|
||||||
print '<td class="nowrap">';
|
|
||||||
$projectstatic->id=$lines[$i]->fk_project;
|
|
||||||
$projectstatic->ref=$lines[$i]->projectref;
|
|
||||||
$projectstatic->title=$lines[$i]->projectlabel;
|
|
||||||
$projectstatic->public=$lines[$i]->public;
|
|
||||||
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
|
|
||||||
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
|
|
||||||
{
|
|
||||||
// Thirdparty
|
|
||||||
print '<td class="tdoverflowmax100">';
|
|
||||||
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
|
|
||||||
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
|
|
||||||
print $thirdpartystatic->getNomUrl(1, 'project');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Planned Workload
|
// Planned Workload
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||||
@ -961,7 +968,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
|||||||
// Warning
|
// Warning
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject"));
|
||||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $langs->transnoentitiesnoconv("AssignTaskToUser", '...')));
|
else if ($disabledtask)
|
||||||
|
{
|
||||||
|
$titleassigntask = $langs->trans("AssignTaskToMe");
|
||||||
|
if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...');
|
||||||
|
|
||||||
|
print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask));
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -376,7 +376,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
|||||||
|
|
||||||
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
|
||||||
$checksoc = array('societe'); // Test for societe object
|
$checksoc = array('societe'); // Test for societe object
|
||||||
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
|
||||||
$checkproject = array('projet','project'); // Test for project object
|
$checkproject = array('projet','project'); // Test for project object
|
||||||
$checktask = array('projet_task');
|
$checktask = array('projet_task');
|
||||||
$nocheck = array('barcode','stock','fournisseur'); // No test
|
$nocheck = array('barcode','stock','fournisseur'); // No test
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -201,11 +201,19 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||||||
$demopassword=$tab[1];
|
$demopassword=$tab[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute hook getLoginPageOptions
|
// Execute hook getLoginPageOptions (for table)
|
||||||
// Should be an array with differents options in $hookmanager->resArray
|
|
||||||
$parameters=array('entity' => GETPOST('entity','int'));
|
$parameters=array('entity' => GETPOST('entity','int'));
|
||||||
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. resArray is filled by hook.
|
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks.
|
||||||
$morelogincontent = $hookmanager->resArray['options']; // TODO Use here a resprints
|
if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
|
||||||
|
$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
|
||||||
|
} else {
|
||||||
|
$morelogincontent = $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute hook getLoginPageExtraOptions (eg for js)
|
||||||
|
$parameters=array('entity' => GETPOST('entity','int'));
|
||||||
|
$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters); // Note that $action and $object may have been modified by some hooks.
|
||||||
|
$moreloginextracontent = $hookmanager->resPrint;
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
|
$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
|
||||||
|
|||||||
@ -12,7 +12,8 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
|
||||||
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey|resource', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read', '', 2, 90, __ENTITY__);
|
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey|resource', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read', '', 2, 90, __ENTITY__);
|
||||||
@ -163,56 +164,56 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Accountancy - Supplier invoice
|
-- Billing - Supplier invoice
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'accountancy', '', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', '', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
||||||
-- Accountancy - Customer invoice
|
-- Billing - Customer invoice
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__);
|
||||||
|
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__);
|
||||||
|
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
|
||||||
-- Accountancy - Orders to bill
|
-- Billing - Orders to bill
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
|
||||||
-- Donations
|
-- Donations
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', 'donations', 6__+MAX_llx_menu__, '/don/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?leftmenu=donations&mainmenu=billing', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/card.php?leftmenu=donations&mainmenu=billing&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&mainmenu=billing', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
|
||||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=billing', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Special expenses
|
-- Special expenses
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=billing', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'accountancy', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&mainmenu=billing', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
||||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/calc.php?leftmenu=tax_loan', 'Calculator', 2, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)', __HANDLER__, 'left', 2223__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/calc.php?leftmenu=tax_loan', 'Calculator', 2, 'companies', '$user->rights->loan->calc', '', 0, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'accountancy', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled', __HANDLER__, 'left', 2250__+MAX_llx_menu__, 'billing', 'tax_social', 2200__+MAX_llx_menu__, '/compta/sociales/index.php?leftmenu=tax_social', 'SocialContributions', 1, '', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2251__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/card.php?leftmenu=tax_social&action=create', 'MenuNewSocialContribution', 2, '', '$user->rights->tax->charges->creer', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'accountancy', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && $leftmenu=="tax_social"', __HANDLER__, 'left', 2252__+MAX_llx_menu__, 'billing', '', 2250__+MAX_llx_menu__, '/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing&mode=sconly', 'Payments', 2, '', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'accountancy', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)', __HANDLER__, 'left', 2300__+MAX_llx_menu__, 'billing', 'tax_vat', 2200__+MAX_llx_menu__, '/compta/tva/index.php?leftmenu=tax_vat&mainmenu=billing', 'VAT', 1, 'companies', '$user->rights->tax->charges->lire', '', 0, 7, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2301__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/card.php?leftmenu=tax_vat&action=create', 'New', 2, 'companies', '$user->rights->tax->charges->creer', '', 0, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'billing', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'accountancy', 'tax_various', 2200__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=accountancy', 'MenuVariousPayment', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2350__+MAX_llx_menu__, 'billing', 'tax_various', 2200__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=billing', 'MenuVariousPayment', 1, 'various_payment', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'accountancy', '', 2350__+MAX_llx_menu__, '/bank/various_payment/card.php?leftmenu=tax_various&action=create', 'MenuNewVariousPayment', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2351__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/card.php?leftmenu=tax_various&action=create', 'MenuNewVariousPayment', 2, 'various_payment', '$user->rights->banque->modifier', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'accountancy', '', 2350__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && $leftmenu=="tax_various"', __HANDLER__, 'left', 2352__+MAX_llx_menu__, 'billing', '', 2350__+MAX_llx_menu__, '/bank/various_payment/index.php?leftmenu=tax_various', 'List', 2, 'various_payment', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
|
||||||
-- Accounting Expert
|
-- Accounting Expert
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accountancy', 9__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
|
||||||
-- Setup
|
-- Setup
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
|
||||||
|
|
||||||
@ -228,36 +229,36 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
-- Accounting period
|
-- Accounting period
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
|
||||||
-- Binding
|
-- Binding
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 4, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 4, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'ventil_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?leftmenu=dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
|
||||||
-- Journals
|
-- Journals
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__);
|
||||||
-- General Ledger
|
-- General Ledger
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
|
||||||
-- Balance
|
-- Balance
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
||||||
-- Reports
|
-- Reports
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', '', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', '', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2444__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__);
|
||||||
-- Rapports compta simple
|
-- Accounting simple
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 9__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2711__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2711__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2712__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2712__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2713__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2713__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||||
|
|||||||
@ -351,14 +351,14 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
|||||||
|
|
||||||
if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account
|
if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('',$langs->trans("Journalization"),0,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy');
|
$newmenu->add('',$langs->trans("Journalization"),0,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy');
|
||||||
|
|
||||||
// Multi journal
|
// Multi journal
|
||||||
$sql = "SELECT rowid, code, label, nature";
|
$sql = "SELECT rowid, code, label, nature";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " active = 1";
|
$sql.= " AND active = 1";
|
||||||
$sql.= " ORDER BY label";
|
$sql.= " ORDER BY label DESC";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -373,6 +373,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
|||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
$nature='';
|
$nature='';
|
||||||
|
|
||||||
// Must match array $sourceList defined into journals_list.php
|
// Must match array $sourceList defined into journals_list.php
|
||||||
if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells";
|
if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells";
|
||||||
if ($objp->nature == 3 && ! empty($conf->fournisseur->enabled)) $nature="purchases";
|
if ($objp->nature == 3 && ! empty($conf->fournisseur->enabled)) $nature="purchases";
|
||||||
@ -382,7 +383,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
|||||||
if ($objp->nature == 9) $nature="hasnew";
|
if ($objp->nature == 9) $nature="hasnew";
|
||||||
|
|
||||||
// To enable when page exists
|
// To enable when page exists
|
||||||
if (empty($conf->global->MAIN_FEATURES_LEVEL))
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
if ($nature == 'various' || $nature == 'hasnew') $nature='';
|
if ($nature == 'various' || $nature == 'hasnew') $nature='';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,10 +138,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
$menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
|
$menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Financial
|
// Billing - Financial
|
||||||
$menuqualified=0;
|
$menuqualified=0;
|
||||||
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
|
||||||
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
|
||||||
if (! empty($conf->facture->enabled)) $menuqualified++;
|
if (! empty($conf->facture->enabled)) $menuqualified++;
|
||||||
if (! empty($conf->don->enabled)) $menuqualified++;
|
if (! empty($conf->don->enabled)) $menuqualified++;
|
||||||
if (! empty($conf->tax->enabled)) $menuqualified++;
|
if (! empty($conf->tax->enabled)) $menuqualified++;
|
||||||
@ -151,8 +149,29 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
if (! empty($conf->banque->enabled)) $menuqualified++;
|
if (! empty($conf->banque->enabled)) $menuqualified++;
|
||||||
$tmpentry=array(
|
$tmpentry=array(
|
||||||
'enabled'=>$menuqualified,
|
'enabled'=>$menuqualified,
|
||||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->banque->lire)),
|
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->banque->lire)),
|
||||||
'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan|banque');
|
'module'=>'facture|supplier_invoice|don|tax|salaries|loan|banque');
|
||||||
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||||
|
if ($showmode)
|
||||||
|
{
|
||||||
|
$langs->load("compta");
|
||||||
|
|
||||||
|
$classname="";
|
||||||
|
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
|
||||||
|
else $classname = 'class="tmenu"';
|
||||||
|
$idsel='billing';
|
||||||
|
|
||||||
|
$menu->add('/compta/index.php?mainmenu=billing&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "billing", '', 50, $id, $idsel, $classname);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accounting
|
||||||
|
$menuqualified=0;
|
||||||
|
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
||||||
|
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
||||||
|
$tmpentry=array(
|
||||||
|
'enabled'=>$menuqualified,
|
||||||
|
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire)),
|
||||||
|
'module'=>'comptabilite|accounting');
|
||||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||||
if ($showmode)
|
if ($showmode)
|
||||||
{
|
{
|
||||||
@ -163,9 +182,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
else $classname = 'class="tmenu"';
|
else $classname = 'class="tmenu"';
|
||||||
$idsel='accountancy';
|
$idsel='accountancy';
|
||||||
|
|
||||||
$menu->add('/compta/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '', 50, $id, $idsel, $classname);
|
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("Accountancy"), 0, $showmode, $atarget, "accountancy", '', 50, $id, $idsel, $classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
$tmpentry=array('enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
|
$tmpentry=array('enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
|
||||||
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
|
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
|
||||||
@ -771,7 +791,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
/*
|
/*
|
||||||
* Menu COMPTA-FINANCIAL
|
* Menu COMPTA-FINANCIAL
|
||||||
*/
|
*/
|
||||||
if ($mainmenu == 'accountancy')
|
if ($mainmenu == 'billing')
|
||||||
{
|
{
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
@ -848,7 +868,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->don->enabled))
|
if (! empty($conf->don->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("donations");
|
$langs->load("donations");
|
||||||
$newmenu->add("/don/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations');
|
$newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations');
|
||||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?leftmenu=donations&action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer);
|
if ($usemenuhider || empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/card.php?leftmenu=donations&action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer);
|
||||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php?leftmenu=donations",$langs->trans("List"), 1, $user->rights->don->lire);
|
if ($usemenuhider || empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/don/list.php?leftmenu=donations",$langs->trans("List"), 1, $user->rights->don->lire);
|
||||||
// if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
|
// if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire);
|
||||||
@ -860,7 +880,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
global $mysoc;
|
global $mysoc;
|
||||||
|
|
||||||
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
|
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
|
||||||
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
$newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
|
||||||
|
|
||||||
// Social contributions
|
// Social contributions
|
||||||
if (! empty($conf->tax->enabled))
|
if (! empty($conf->tax->enabled))
|
||||||
@ -868,11 +888,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
|
$newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("MenuSocialContributions"),1,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create",$langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"),2,$user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/index.php?leftmenu=tax_social",$langs->trans("List"),2,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i',$leftmenu)) $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing&mode=sconly",$langs->trans("Payments"), 2, $user->rights->tax->charges->lire);
|
||||||
// VAT
|
// VAT
|
||||||
if (empty($conf->global->TAX_DISABLE_VAT_MENUS))
|
if (empty($conf->global->TAX_DISABLE_VAT_MENUS))
|
||||||
{
|
{
|
||||||
$newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy",$langs->transcountry("VAT", $mysoc->country_code),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
|
$newmenu->add("/compta/tva/index.php?leftmenu=tax_vat&mainmenu=billing",$langs->transcountry("VAT", $mysoc->country_code),1,$user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create",$langs->trans("New"),2,$user->rights->tax->charges->creer);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create",$langs->trans("New"),2,$user->rights->tax->charges->creer);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/reglement.php?leftmenu=tax_vat",$langs->trans("List"),2,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i',$leftmenu)) $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||||
@ -883,7 +903,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
//Local Taxes 1
|
//Local Taxes 1
|
||||||
if($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj=="1"))
|
if($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj=="1"))
|
||||||
{
|
{
|
||||||
$newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&mainmenu=accountancy&localTaxType=1",$langs->transcountry("LT1",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
$newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1",$langs->transcountry("LT1",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_1_vat&localTaxType=1",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_1_vat&localTaxType=1",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||||
@ -892,7 +912,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
//Local Taxes 2
|
//Local Taxes 2
|
||||||
if($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1"))
|
if($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj=="1"))
|
||||||
{
|
{
|
||||||
$newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&mainmenu=accountancy&localTaxType=2",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
$newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2",$langs->transcountry("LT2",$mysoc->country_code),1,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2",$langs->trans("NewPayment"),2,$user->rights->tax->charges->creer);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_2_vat&localTaxType=2",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/reglement.php?leftmenu=tax_2_vat&localTaxType=2",$langs->trans("Payments"),2,$user->rights->tax->charges->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i',$leftmenu)) $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByCustomers"), 2, $user->rights->tax->charges->lire);
|
||||||
@ -905,7 +925,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->salaries->enabled))
|
if (! empty($conf->salaries->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->payment->read, '', $mainmenu, 'tax_salary');
|
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=billing",$langs->trans("Salaries"),1,$user->rights->salaries->payment->read, '', $mainmenu, 'tax_salary');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->payment->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->payment->write);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->payment->read);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->payment->read);
|
||||||
}
|
}
|
||||||
@ -914,20 +934,28 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->loan->enabled))
|
if (! empty($conf->loan->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("loan");
|
$langs->load("loan");
|
||||||
$newmenu->add("/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy",$langs->trans("Loans"),1,$user->rights->loan->read, '', $mainmenu, 'tax_loan');
|
$newmenu->add("/loan/index.php?leftmenu=tax_loan&mainmenu=billing",$langs->trans("Loans"),1,$user->rights->loan->read, '', $mainmenu, 'tax_loan');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create",$langs->trans("NewLoan"),2,$user->rights->loan->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create",$langs->trans("NewLoan"),2,$user->rights->loan->write);
|
||||||
//if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
|
//if (empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) $newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read);
|
||||||
if (($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) && ! empty($conf->global->LOAN_SHOW_CALCULATOR)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
|
if (($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i',$leftmenu)) && ! empty($conf->global->LOAN_SHOW_CALCULATOR)) $newmenu->add("/loan/calc.php?leftmenu=tax_loan",$langs->trans("Calculator"),2,$user->rights->loan->calc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Various payment
|
// Various payment
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
$newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=accountancy",$langs->trans("MenuVariousPayment"),1,$user->rights->banque->lire, '', $mainmenu, 'tax_various');
|
$newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various&mainmenu=billing",$langs->trans("MenuVariousPayment"),1,$user->rights->banque->lire, '', $mainmenu, 'tax_various');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create",$langs->trans("MenuNewVariousPayment"), 2, $user->rights->banque->modifier);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create",$langs->trans("MenuNewVariousPayment"), 2, $user->rights->banque->modifier);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various",$langs->trans("List"),2,$user->rights->banque->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i',$leftmenu)) $newmenu->add("/compta/bank/various_payment/index.php?leftmenu=tax_various",$langs->trans("List"),2,$user->rights->banque->lire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu COMPTA-FINANCIAL
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'accountancy')
|
||||||
|
{
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
// Accounting Expert
|
// Accounting Expert
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
@ -938,7 +966,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/accountancy/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
|
$newmenu->add("/accountancy/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
|
||||||
|
|
||||||
// Chart of account
|
// Chart of account
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
|
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 10);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 10);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 20);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 20);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 30);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 30);
|
||||||
@ -974,20 +1002,22 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Binding
|
// Binding
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
|
if (! empty($conf->facture->enabled))
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
$newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
|
||||||
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||||
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
||||||
|
}
|
||||||
if (! empty($conf->supplier_invoice->enabled))
|
if (! empty($conf->supplier_invoice->enabled))
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier');
|
$newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->expensereport->enabled))
|
if (! empty($conf->expensereport->enabled))
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy",$langs->trans("ExpenseReportsVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport');
|
$newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy",$langs->trans("ExpenseReportsVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/',$leftmenu)) $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/',$leftmenu)) $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport",$langs->trans("ToBind"),2,$user->rights->accounting->bind->write);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/',$leftmenu)) $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/',$leftmenu)) $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport",$langs->trans("Binded"),2,$user->rights->accounting->bind->write);
|
||||||
}
|
}
|
||||||
@ -995,7 +1025,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
// Journals
|
// Journals
|
||||||
if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy')
|
if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy')
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('',$langs->trans("Journalization"),1,$user->rights->accounting->comptarapport->lire);
|
$newmenu->add('',$langs->trans("Journalization"),1,$user->rights->accounting->comptarapport->lire);
|
||||||
|
|
||||||
// Multi journal
|
// Multi journal
|
||||||
$sql = "SELECT rowid, code, label, nature";
|
$sql = "SELECT rowid, code, label, nature";
|
||||||
@ -1027,14 +1057,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if ($objp->nature == 9) $nature="hasnew";
|
if ($objp->nature == 9) $nature="hasnew";
|
||||||
|
|
||||||
// To enable when page exists
|
// To enable when page exists
|
||||||
if (empty($conf->global->MAIN_FEATURES_LEVEL))
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
if ($nature == 'various' || $nature == 'hasnew') $nature='';
|
if ($nature == 'various' || $nature == 'hasnew') $nature='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nature)
|
if ($nature)
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, dol_trunc($objp->label,25), 2, $user->rights->accounting->comptarapport->lire);
|
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, dol_trunc($objp->label,25), 2, $user->rights->accounting->comptarapport->lire);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1080,15 +1110,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// General Ledger
|
// General Ledger
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_generalledger",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
|
$newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_generalledger",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
|
||||||
|
|
||||||
// Balance
|
// Balance
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
|
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
|
||||||
|
|
||||||
// Reports
|
// Reports
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
|
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
|
$newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
|
||||||
|
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire);
|
||||||
|
|||||||
@ -1486,7 +1486,18 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
|||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
||||||
$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_syslog($this->db->lasterror(), LOG_ERR);
|
||||||
|
if ($this->db->lasterrno() != 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
$err++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
|
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -562,15 +562,10 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
|
|
||||||
// Show square
|
// Show square
|
||||||
if ($pagenb == 1)
|
if ($pagenb == 1)
|
||||||
{
|
|
||||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
|
||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
|
||||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||||
}
|
|
||||||
|
|
||||||
// Affiche zone infos
|
// Affiche zone infos
|
||||||
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
||||||
@ -587,18 +582,18 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Pied de page
|
// Pied de page
|
||||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||||
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
|
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||||
|
|
||||||
$pdf->Close();
|
$pdf->Close();
|
||||||
|
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file, 'F');
|
||||||
|
|
||||||
// Add pdfgeneration hook
|
// Add pdfgeneration hook
|
||||||
$hookmanager->initHooks(array('pdfgeneration'));
|
$hookmanager->initHooks(array('pdfgeneration'));
|
||||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||||
global $action;
|
global $action;
|
||||||
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|||||||
0
htdocs/core/modules/expensereport/index.html
Normal file
0
htdocs/core/modules/expensereport/index.html
Normal file
139
htdocs/core/modules/expensereport/mod_expensereport_jade.php
Normal file
139
htdocs/core/modules/expensereport/mod_expensereport_jade.php
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Maxime Kohlhaas <support@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/expensereport/mod_expensereport_jade.php
|
||||||
|
* \ingroup expensereport
|
||||||
|
* \brief File of class to manage customer order numbering rules Jade
|
||||||
|
*/
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/expensereport/modules_expensereport.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage customer order numbering rules Jade
|
||||||
|
*/
|
||||||
|
class mod_expensereport_jade extends ModeleNumRefExpenseReport
|
||||||
|
{
|
||||||
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
var $prefix='ER';
|
||||||
|
var $error='';
|
||||||
|
var $nom='Jade';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return description of numbering module
|
||||||
|
*
|
||||||
|
* @return string Text with description
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi un exemple de numerotation
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
return $this->prefix."0501-0001";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test si les numeros deje en vigueur dans la base ne provoquent pas de
|
||||||
|
* de conflits qui empechera cette numerotation de fonctionner.
|
||||||
|
*
|
||||||
|
* @return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
|
$coyymm=''; $max='';
|
||||||
|
|
||||||
|
$posindice=8;
|
||||||
|
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
|
||||||
|
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; }
|
||||||
|
}
|
||||||
|
if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorNumRefModel', $max);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next free value
|
||||||
|
*
|
||||||
|
* @param Object $object Object we need next value for
|
||||||
|
* @return string Value if KO, <0 if KO
|
||||||
|
*/
|
||||||
|
function getNextValue($object)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
// D'abord on recupere la valeur max
|
||||||
|
$posindice=8;
|
||||||
|
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport";
|
||||||
|
$sql.= " WHERE ref like '".$this->prefix."____-%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) $max = intval($obj->max);
|
||||||
|
else $max=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("mod_expensereport_jade::getNextValue", LOG_DEBUG);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$date=$object->date_valid; // $object->date does not exists
|
||||||
|
if (empty($date))
|
||||||
|
{
|
||||||
|
$this->error = 'Date valid not defined';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$yymm = strftime("%y%m",$date);
|
||||||
|
|
||||||
|
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||||
|
else $num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
|
dol_syslog("mod_expensereport_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||||
|
return $this->prefix.$yymm."-".$num;
|
||||||
|
}
|
||||||
|
}
|
||||||
140
htdocs/core/modules/expensereport/mod_expensereport_sand.php
Normal file
140
htdocs/core/modules/expensereport/mod_expensereport_sand.php
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Maxime Kohlhaas <support@atm-consulting.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/expensereport/mod_expensereport_sand.php
|
||||||
|
* \ingroup expensereport
|
||||||
|
* \brief Fichier contenant la classe du modele de numerotation de reference de note de frais Sand
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/expensereport/modules_expensereport.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage expense report numbering rules Sand
|
||||||
|
*/
|
||||||
|
class mod_expensereport_sand extends ModeleNumRefExpenseReport
|
||||||
|
{
|
||||||
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
var $error = '';
|
||||||
|
var $nom = 'Sand';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi la description du modele de numerotation
|
||||||
|
*
|
||||||
|
* @return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$form = new Form($this->db);
|
||||||
|
|
||||||
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||||
|
$texte.= '<input type="hidden" name="maskconst" value="EXPENSEREPORT_SAND_MASK">';
|
||||||
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("ExpenseReport"),$langs->transnoentities("ExpenseReport"));
|
||||||
|
//$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("ExpenseReport"),$langs->transnoentities("ExpenseReport"));
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||||
|
|
||||||
|
// Parametrage du prefix
|
||||||
|
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||||
|
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->EXPENSEREPORT_SAND_MASK.'">',$tooltip,1,1).'</td>';
|
||||||
|
|
||||||
|
$texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||||
|
|
||||||
|
$texte.= '</tr>';
|
||||||
|
|
||||||
|
$texte.= '</table>';
|
||||||
|
$texte.= '</form>';
|
||||||
|
|
||||||
|
return $texte;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi un exemple de numerotation
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
|
$exp=new ExpenseReport($this->db);
|
||||||
|
$exp->initAsSpecimen();
|
||||||
|
$exp->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$numExample = $this->getNextValue($exp);
|
||||||
|
|
||||||
|
if (! $numExample)
|
||||||
|
{
|
||||||
|
$numExample = $langs->trans('NotConfigured');
|
||||||
|
}
|
||||||
|
return $numExample;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next free value
|
||||||
|
*
|
||||||
|
* @param Object $object Object we need next value for
|
||||||
|
* @return string Value if KO, <0 if KO
|
||||||
|
*/
|
||||||
|
function getNextValue($object)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
|
// We get cursor rule
|
||||||
|
$mask=$conf->global->EXPENSEREPORT_SAND_MASK;
|
||||||
|
|
||||||
|
if (! $mask)
|
||||||
|
{
|
||||||
|
$this->error='NotConfigured';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$date=$object->date_valid; // $object->date does not exists
|
||||||
|
if (empty($date))
|
||||||
|
{
|
||||||
|
$this->error = 'Date valid not defined';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fuser = null;
|
||||||
|
if ($object->fk_user_author > 0)
|
||||||
|
{
|
||||||
|
$fuser=new User($db);
|
||||||
|
$fuser->fetch($object->fk_user_author);
|
||||||
|
}
|
||||||
|
|
||||||
|
$numFinal=get_next_value($db,$mask,'expensereport','ref','',null, $date, 'next', true, $fuser);
|
||||||
|
|
||||||
|
return $numFinal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -65,3 +65,87 @@ function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $
|
|||||||
{
|
{
|
||||||
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class ModeleNumRefExpenseReport
|
||||||
|
* \brief Parent class for numbering masks of expense reports
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class ModeleNumRefExpenseReport
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a module can be used or not
|
||||||
|
*
|
||||||
|
* @return boolean true if module can be used
|
||||||
|
*/
|
||||||
|
function isEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie la description par defaut du modele de numerotation
|
||||||
|
*
|
||||||
|
* @return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("orders");
|
||||||
|
return $langs->trans("NoDescription");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie un exemple de numerotation
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("trips");
|
||||||
|
return $langs->trans("NoExample");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner.
|
||||||
|
*
|
||||||
|
* @return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie prochaine valeur attribuee
|
||||||
|
*
|
||||||
|
* @param Societe $objsoc Object thirdparty
|
||||||
|
* @param Object $object Object we need next value for
|
||||||
|
* @return string Valeur
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc,$object)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
return $langs->trans("NotAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie version du module numerotation
|
||||||
|
*
|
||||||
|
* @return string Valeur
|
||||||
|
*/
|
||||||
|
function getVersion()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
|
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||||
|
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||||
|
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||||
|
if ($this->version) return $this->version;
|
||||||
|
return $langs->trans("NotAvailable");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class mailing_contacts1
|
* Class to offer a selector of emailing targets from contacts
|
||||||
* \brief Class to offer a selector of emailing targets with Rule 'Poire'.
|
|
||||||
*/
|
*/
|
||||||
class mailing_contacts1 extends MailingTargets
|
class mailing_contacts1 extends MailingTargets
|
||||||
{
|
{
|
||||||
@ -39,7 +38,7 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
var $require_module=array("societe"); // Module mailing actif si modules require_module actifs
|
var $require_module=array("societe"); // Module mailing actif si modules require_module actifs
|
||||||
var $require_admin=0; // Module mailing actif pour user admin ou non
|
var $require_admin=0; // Module mailing actif pour user admin ou non
|
||||||
var $picto='contact';
|
var $picto='contact';
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
|
|
||||||
@ -101,8 +100,7 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
$sql.= " AND c.no_email = 0";
|
$sql.= " AND c.no_email = 0";
|
||||||
$sql.= " AND c.statut = 1";
|
$sql.= " AND c.statut = 1";
|
||||||
|
|
||||||
// La requete doit retourner un champ "nb" pour etre comprise
|
// The request must return a field called "nb" to be understandable by parent::getNbOfRecipients
|
||||||
// par parent::getNbOfRecipients
|
|
||||||
return parent::getNbOfRecipients($sql);
|
return parent::getNbOfRecipients($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,10 +116,86 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("commercial");
|
$langs->load("commercial");
|
||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
|
$langs->load("categories");
|
||||||
|
|
||||||
$s='';
|
$s='';
|
||||||
$s.='<select name="filter" class="flat">';
|
|
||||||
|
// Add filter on job position
|
||||||
|
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||||
|
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
||||||
|
/*$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||||
|
$sql.= " AND sp.no_email = 0";
|
||||||
|
$sql.= " AND sp.statut = 1";*/
|
||||||
|
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
||||||
|
$sql.= " GROUP BY sp.poste";
|
||||||
|
$sql.= " ORDER BY sp.poste";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
$s.=$langs->trans("PostOrFunction").': ';
|
||||||
|
$s.='<select name="filter_jobposition" class="flat">';
|
||||||
|
$s.='<option value="all"> </option>';
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$s.='<option value="'.dol_escape_htmltag($obj->poste).'">'.dol_escape_htmltag($obj->poste).' ('.$obj->nb.')</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
$s.='</select>';
|
||||||
|
|
||||||
|
$s.=' ';
|
||||||
|
|
||||||
|
// Filter on contact category
|
||||||
|
$s .= $langs->trans("ContactCategoriesShort").': ';
|
||||||
|
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||||
|
$sql.= " FROM ";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||||
|
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||||
|
//$sql.= " AND sp.no_email = 0";
|
||||||
|
//$sql.= " AND sp.email != ''";
|
||||||
|
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
||||||
|
$sql.= " AND cs.fk_categorie = c.rowid";
|
||||||
|
$sql.= " AND cs.fk_socpeople = sp.rowid";
|
||||||
|
$sql.= " GROUP BY c.label";
|
||||||
|
$sql.= " ORDER BY c.label";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
$s.='<select name="filter_category" class="flat">';
|
||||||
|
$s.='<option value="all"> </option>';
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactWithCategoryFound").'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
$s.='</select>';
|
||||||
|
|
||||||
|
$s.='<br>';
|
||||||
|
|
||||||
// Add prospect of a particular level
|
// Add prospect of a particular level
|
||||||
|
$s.=$langs->trans("NatureOfThirdParty").': ';
|
||||||
|
$s.='<select name="filter" class="flat">';
|
||||||
$sql = "SELECT code, label";
|
$sql = "SELECT code, label";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||||
$sql.= " WHERE active > 0";
|
$sql.= " WHERE active > 0";
|
||||||
@ -132,7 +206,7 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
if ($num) $s.='<option value="all"> </option>';
|
if ($num) $s.='<option value="all"> </option>';
|
||||||
else $s.='<option value="all">'.$langs->trans("ContactsAllShort").'</option>';
|
else $s.='<option value="all">'.$langs->trans("ContactsAllShort").'</option>';
|
||||||
$s.='<option value="prospects">'.$langs->trans("ThirdPartyProspects").'</option>';
|
$s.='<option value="prospects">'.$langs->trans("ThirdPartyProspects").'</option>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -144,10 +218,96 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
$s.='<option value="customers">'.$langs->trans("ThirdPartyCustomers").'</option>';
|
$s.='<option value="customers">'.$langs->trans("ThirdPartyCustomers").'</option>';
|
||||||
//$s.='<option value="customersidprof">'.$langs->trans("ThirdPartyCustomersWithIdProf12",$langs->trans("ProfId1"),$langs->trans("ProfId2")).'</option>';
|
//$s.='<option value="customersidprof">'.$langs->trans("ThirdPartyCustomersWithIdProf12",$langs->trans("ProfId1"),$langs->trans("ProfId2")).'</option>';
|
||||||
$s.='<option value="suppliers">'.$langs->trans("ThirdPartySuppliers").'</option>';
|
$s.='<option value="suppliers">'.$langs->trans("ThirdPartySuppliers").'</option>';
|
||||||
$s.='</select>';
|
$s.='</select>';
|
||||||
|
|
||||||
|
$s.= ' ';
|
||||||
|
|
||||||
|
// Filter on thirdparty category
|
||||||
|
$s .= $langs->trans("CustomersProspectsCategoriesShort").': ';
|
||||||
|
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||||
|
$sql.= " FROM ";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||||
|
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||||
|
//$sql.= " AND sp.no_email = 0";
|
||||||
|
//$sql.= " AND sp.email != ''";
|
||||||
|
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
||||||
|
$sql.= " AND cs.fk_categorie = c.rowid";
|
||||||
|
$sql.= " AND cs.fk_soc = sp.fk_soc";
|
||||||
|
$sql.= " GROUP BY c.label";
|
||||||
|
$sql.= " ORDER BY c.label";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
$s.='<select name="filter_category_customer" class="flat">';
|
||||||
|
$s.='<option value="all"> </option>';
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactLinkedToThirdpartieWithCategoryFound").'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
$s.='</select>';
|
||||||
|
|
||||||
|
$s.= ' ';
|
||||||
|
|
||||||
|
// Filter on thirdparty category
|
||||||
|
$s .= $langs->trans("SuppliersCategoriesShort").': ';
|
||||||
|
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
||||||
|
$sql.= " FROM ";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
|
||||||
|
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||||
|
//$sql.= " AND sp.no_email = 0";
|
||||||
|
//$sql.= " AND sp.email != ''";
|
||||||
|
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
||||||
|
$sql.= " AND cs.fk_categorie = c.rowid";
|
||||||
|
$sql.= " AND cs.fk_soc = sp.fk_soc";
|
||||||
|
$sql.= " GROUP BY c.label";
|
||||||
|
$sql.= " ORDER BY c.label";
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
$s.='<select name="filter_category_supplier" class="flat">';
|
||||||
|
$s.='<option value="all"> </option>';
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactLinkedToThirdpartieWithCategoryFound").'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
$s.='</select>';
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,13 +328,19 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
* Ajoute destinataires dans table des cibles
|
* Ajoute destinataires dans table des cibles
|
||||||
*
|
*
|
||||||
* @param int $mailing_id Id of emailing
|
* @param int $mailing_id Id of emailing
|
||||||
* @param array $filtersarray Requete sql de selection des destinataires
|
* @param array $filtersarray Optional filter data (deprecated)
|
||||||
* @return int <0 si erreur, nb ajout si ok
|
* @return int <0 si erreur, nb ajout si ok
|
||||||
*/
|
*/
|
||||||
function add_to_target($mailing_id,$filtersarray=array())
|
function add_to_target($mailing_id,$filtersarray=array())
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$filter = GETPOST('filter','alpha');
|
||||||
|
$filter_jobposition = GETPOST('filter_jobposition','alpha');
|
||||||
|
$filter_category = GETPOST('filter_category','alpha');
|
||||||
|
$filter_category_customer = GETPOST('filter_category_customer','alpha');
|
||||||
|
$filter_category_supplier = GETPOST('filter_category_supplier','alpha');
|
||||||
|
|
||||||
$cibles = array();
|
$cibles = array();
|
||||||
|
|
||||||
// List prospects levels
|
// List prospects levels
|
||||||
@ -197,27 +363,43 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
}
|
}
|
||||||
else dol_print_error($this->db);
|
else dol_print_error($this->db);
|
||||||
|
|
||||||
// La requete doit retourner: id, email, fk_contact, name, firstname, other
|
// Request must return: id, email, fk_contact, lastname, firstname, other
|
||||||
$sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,";
|
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact, sp.lastname, sp.firstname, sp.civility as civility_id, sp.poste as jobposition,";
|
||||||
$sql.= " c.lastname, c.firstname, c.civility as civility_id,";
|
|
||||||
$sql.= " s.nom as companyname";
|
$sql.= " s.nom as companyname";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||||
$sql.= " WHERE c.entity IN (".getEntity('societe').")";
|
if ($filter_category <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
||||||
$sql.= " AND c.email <> ''";
|
if ($filter_category <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||||
$sql.= " AND c.no_email = 0";
|
if ($filter_category_customer <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c2";
|
||||||
$sql.= " AND c.statut = 1";
|
if ($filter_category_customer <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as c2s";
|
||||||
$sql.= " AND c.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
if ($filter_category_supplier <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c3";
|
||||||
foreach($filtersarray as $key)
|
if ($filter_category_supplier <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
|
||||||
|
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
||||||
|
$sql.= " AND sp.email <> ''";
|
||||||
|
$sql.= " AND sp.no_email = 0";
|
||||||
|
$sql.= " AND sp.statut = 1";
|
||||||
|
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
|
// Filter on category
|
||||||
|
if ($filter_category <> 'all') $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_socpeople = sp.rowid";
|
||||||
|
if ($filter_category <> 'all') $sql.= " AND c.label = '".$this->db->escape($filter_category)."'";
|
||||||
|
if ($filter_category_customer <> 'all') $sql.= " AND c2s.fk_categorie = c2.rowid AND c2s.fk_soc = sp.fk_soc";
|
||||||
|
if ($filter_category_customer <> 'all') $sql.= " AND c2.label = '".$this->db->escape($filter_category_customer)."'";
|
||||||
|
if ($filter_category_supplier <> 'all') $sql.= " AND c3s.fk_categorie = c3.rowid AND c3s.fk_soc = sp.fk_soc";
|
||||||
|
if ($filter_category_supplier <> 'all') $sql.= " AND c3.label = '".$this->db->escape($filter_category_supplier)."'";
|
||||||
|
// Filter on nature
|
||||||
|
$key = $filter;
|
||||||
{
|
{
|
||||||
if ($key == 'prospects') $sql.= " AND s.client=2";
|
|
||||||
//print "xx".$key;
|
//print "xx".$key;
|
||||||
|
if ($key == 'prospects') $sql.= " AND s.client=2";
|
||||||
foreach($prospectlevel as $codelevel=>$valuelevel) if ($key == 'prospectslevel'.$codelevel) $sql.= " AND s.fk_prospectlevel='".$codelevel."'";
|
foreach($prospectlevel as $codelevel=>$valuelevel) if ($key == 'prospectslevel'.$codelevel) $sql.= " AND s.fk_prospectlevel='".$codelevel."'";
|
||||||
if ($key == 'customers') $sql.= " AND s.client=1";
|
if ($key == 'customers') $sql.= " AND s.client=1";
|
||||||
if ($key == 'suppliers') $sql.= " AND s.fournisseur=1";
|
if ($key == 'suppliers') $sql.= " AND s.fournisseur=1";
|
||||||
}
|
}
|
||||||
$sql.= " ORDER BY c.email";
|
// Filter on job position
|
||||||
//print "x".$sql;
|
$key = $filter_jobposition;
|
||||||
|
if (! empty($key) && $key != 'all') $sql.= " AND sp.poste ='".$this->db->escape($key)."'";
|
||||||
|
$sql.= " ORDER BY sp.email";
|
||||||
|
//print "wwwwwwx".$sql;
|
||||||
|
|
||||||
// Stocke destinataires dans cibles
|
// Stocke destinataires dans cibles
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
@ -242,8 +424,9 @@ class mailing_contacts1 extends MailingTargets
|
|||||||
'firstname' => $obj->firstname,
|
'firstname' => $obj->firstname,
|
||||||
'other' =>
|
'other' =>
|
||||||
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
|
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
|
||||||
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')),
|
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')).';'.
|
||||||
'source_url' => $this->url($obj->id),
|
($langs->transnoentities("JobPosition").'='.$obj->jobposition),
|
||||||
|
'source_url' => $this->url($obj->id),
|
||||||
'source_id' => $obj->id,
|
'source_id' => $obj->id,
|
||||||
'source_type' => 'contact'
|
'source_type' => 'contact'
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,222 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
|
||||||
* Copyright (C) 2013 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/modules/mailings/contacts2.modules.php
|
|
||||||
* \ingroup mailing
|
|
||||||
* \brief Provides a list of recipients for mailing module
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class mailing_contacts2
|
|
||||||
* \brief Class to manage a list of personalised recipients for mailing feature
|
|
||||||
*/
|
|
||||||
class mailing_contacts2 extends MailingTargets
|
|
||||||
{
|
|
||||||
var $name='ContactsByFunction';
|
|
||||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
|
||||||
var $desc='Add contacts by function';
|
|
||||||
var $require_admin=0;
|
|
||||||
|
|
||||||
var $require_module=array();
|
|
||||||
var $picto='contact';
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renvoie url lien vers fiche de la source du destinataire du mailing
|
|
||||||
*
|
|
||||||
* @param int $id ID
|
|
||||||
* @return string Url lien
|
|
||||||
*/
|
|
||||||
function url($id)
|
|
||||||
{
|
|
||||||
return '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$id.'">'.img_object('',"contact").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the main function that returns the array of emails
|
|
||||||
*
|
|
||||||
* @param int $mailing_id Id of mailing. No need to use it.
|
|
||||||
* @param array $filtersarray Function
|
|
||||||
* @return int <0 if error, number of emails added if ok
|
|
||||||
*/
|
|
||||||
function add_to_target($mailing_id,$filtersarray=array())
|
|
||||||
{
|
|
||||||
global $conf,$langs;
|
|
||||||
|
|
||||||
$target = array();
|
|
||||||
|
|
||||||
// La requete doit retourner: id, email, fk_contact, name, firstname, other
|
|
||||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
|
||||||
$sql.= " sp.lastname, sp.firstname as firstname, sp.civility as civility_id,";
|
|
||||||
$sql.= " s.nom as companyname";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
|
||||||
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email <> ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
//$sql.= " AND sp.poste != ''";
|
|
||||||
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
|
||||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
|
|
||||||
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj= $this->db->fetch_object($resql);
|
|
||||||
$target[] = array(
|
|
||||||
'email' => $obj->email,
|
|
||||||
'fk_contact' => $obj->fk_contact,
|
|
||||||
'lastname' => $obj->lastname,
|
|
||||||
'firstname' => $obj->firstname,
|
|
||||||
'other' =>
|
|
||||||
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
|
|
||||||
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')),
|
|
||||||
'source_url' => $this->url($obj->id),
|
|
||||||
'source_id' => $obj->id,
|
|
||||||
'source_type' => 'contact'
|
|
||||||
);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::add_to_target($mailing_id, $target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the main mailing area, there is a box with statistics.
|
|
||||||
* If you want to add a line in this report you must provide an
|
|
||||||
* array of SQL request that returns two field:
|
|
||||||
* One called "label", One called "nb".
|
|
||||||
*
|
|
||||||
* @return array Array with SQL requests
|
|
||||||
*/
|
|
||||||
function getSqlArrayForStats()
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$statssql=array();
|
|
||||||
/*for ($i=0; $i<5; $i++) {
|
|
||||||
$statssql[$i] = "SELECT sp.poste as label";
|
|
||||||
$statssql[$i].= ", count(distinct(sp.email)) as nb";
|
|
||||||
$statssql[$i].= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."societe as s";
|
|
||||||
$statssql[$i].= " WHERE s.rowid = sp.fk_soc";
|
|
||||||
$statssql[$i].= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$statssql[$i].= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
|
||||||
$statssql[$i].= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$statssql[$i].= " GROUP BY label";
|
|
||||||
$statssql[$i].= " ORDER BY nb DESC";
|
|
||||||
$statssql[$i].= " LIMIT $i,1";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $statssql;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return here number of distinct emails returned by your selector.
|
|
||||||
*
|
|
||||||
* @param string $sql Requete sql de comptage
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function getNbOfRecipients($sql='')
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
// We must report here number of contacts when absolutely no filter selected (so all contacts).
|
|
||||||
// Number with a filter are show in the combo list for each filter.
|
|
||||||
// If we want a filter "a position is defined", we must add it into formFilter
|
|
||||||
$sql = "SELECT count(distinct(sp.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
|
||||||
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
//$sql.= " AND sp.poste != ''";
|
|
||||||
// La requete doit retourner un champ "nb" pour etre comprise
|
|
||||||
// par parent::getNbOfRecipients
|
|
||||||
return parent::getNbOfRecipients($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is to add a form filter to provide variant of selector
|
|
||||||
* If used, the HTML select must be called "filter"
|
|
||||||
*
|
|
||||||
* @return string A html select zone
|
|
||||||
*/
|
|
||||||
function formFilter()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
|
||||||
$sql.= " GROUP BY sp.poste";
|
|
||||||
$sql.= " ORDER BY sp.poste";
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
|
|
||||||
$s='';
|
|
||||||
$s.='<select name="filter" class="flat">';
|
|
||||||
$s.='<option value="all"></option>';
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$s.='<option value="'.$obj->poste.'">'.$obj->poste.' ('.$obj->nb.')</option>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$s.='</select>';
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,250 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
|
||||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/modules/mailings/contacts3.modules.php
|
|
||||||
* \ingroup mailing
|
|
||||||
* \brief Provides a list of recipients for mailing module
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage a list of personalised recipients for mailing feature
|
|
||||||
*/
|
|
||||||
class mailing_contacts3 extends MailingTargets
|
|
||||||
{
|
|
||||||
var $name='ContactsByCompanyCategory';
|
|
||||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
|
||||||
var $desc='Add contacts by company category';
|
|
||||||
var $require_admin=0;
|
|
||||||
|
|
||||||
var $require_module=array();
|
|
||||||
var $picto='contact';
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renvoie url lien vers fiche de la source du destinataire du mailing
|
|
||||||
*
|
|
||||||
* @param int $id ID
|
|
||||||
* @return string Url lien
|
|
||||||
*/
|
|
||||||
function url($id)
|
|
||||||
{
|
|
||||||
return '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$id.'">'.img_object('',"contact").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the main function that returns the array of emails
|
|
||||||
*
|
|
||||||
* @param int $mailing_id Id of mailing. No need to use it.
|
|
||||||
* @param array $filtersarray Category
|
|
||||||
* @return int <0 if error, number of emails added if ok
|
|
||||||
*/
|
|
||||||
function add_to_target($mailing_id,$filtersarray=array())
|
|
||||||
{
|
|
||||||
global $conf,$langs;
|
|
||||||
|
|
||||||
$target = array();
|
|
||||||
|
|
||||||
// La requete doit retourner: id, email, fk_contact, name, firstname, other
|
|
||||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
|
||||||
$sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,";
|
|
||||||
$sql.= " s.nom as companyname";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$sql.= " WHERE sp.email <> ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
|
|
||||||
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj= $this->db->fetch_object($resql);
|
|
||||||
$target[] = array(
|
|
||||||
'email' => $obj->email,
|
|
||||||
'fk_contact' => $obj->fk_contact,
|
|
||||||
'lastname' => $obj->lastname,
|
|
||||||
'firstname' => $obj->firstname,
|
|
||||||
'other' =>
|
|
||||||
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
|
|
||||||
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')),
|
|
||||||
'source_url' => $this->url($obj->id),
|
|
||||||
'source_id' => $obj->id,
|
|
||||||
'source_type' => 'contact'
|
|
||||||
);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::add_to_target($mailing_id, $target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the main mailing area, there is a box with statistics.
|
|
||||||
* If you want to add a line in this report you must provide an
|
|
||||||
* array of SQL request that returns two field:
|
|
||||||
* One called "label", One called "nb".
|
|
||||||
*
|
|
||||||
* @return array Array with SQL requests
|
|
||||||
*/
|
|
||||||
function getSqlArrayForStats()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$statssql=array();
|
|
||||||
/*for ($i=0; $i<5; $i++) {
|
|
||||||
$statssql[$i] = "SELECT c.label, count(sp.rowid) AS nb";
|
|
||||||
$statssql[$i].= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."societe as s,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."categorie as c,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$statssql[$i].= " WHERE s.rowid = sp.fk_soc";
|
|
||||||
$statssql[$i].= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$statssql[$i].= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$statssql[$i].= " AND cs.fk_categorie = c.rowid";
|
|
||||||
$statssql[$i].= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
$statssql[$i].= " GROUP BY c.label";
|
|
||||||
$statssql[$i].= " ORDER BY nb DESC";
|
|
||||||
$statssql[$i].= " LIMIT $i,1";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $statssql;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return here number of distinct emails returned by your selector.
|
|
||||||
*
|
|
||||||
* @param string $sql Requete sql de comptage
|
|
||||||
* @return int Number of recipients
|
|
||||||
*/
|
|
||||||
function getNbOfRecipients($sql='')
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
// We must report here number of contacts when absolutely no filter selected (so all contacts).
|
|
||||||
// Number with a filter are show in the combo list for each filter.
|
|
||||||
// If we want a filter "is inside at least one category", we must add it into formFilter
|
|
||||||
$sql = "SELECT count(distinct(c.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
|
||||||
$sql.= " WHERE c.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND c.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND c.no_email = 0";
|
|
||||||
$sql.= " AND c.statut = 1";
|
|
||||||
/*
|
|
||||||
$sql = "SELECT count(distinct(sp.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND cs.fk_categorie = c.rowid";
|
|
||||||
$sql.= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
*/
|
|
||||||
// La requete doit retourner un champ "nb" pour etre comprise
|
|
||||||
// par parent::getNbOfRecipients
|
|
||||||
return parent::getNbOfRecipients($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is to add a form filter to provide variant of selector
|
|
||||||
* If used, the HTML select must be called "filter".
|
|
||||||
*
|
|
||||||
* @return string A html select zone
|
|
||||||
*/
|
|
||||||
function formFilter()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND cs.fk_categorie = c.rowid";
|
|
||||||
$sql.= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
$sql.= " GROUP BY c.label";
|
|
||||||
$sql.= " ORDER BY c.label";
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
|
|
||||||
$s='';
|
|
||||||
$s.='<select name="filter" class="flat">';
|
|
||||||
$s.='<option value="all"></option>';
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactLinkedToThirdpartieWithCategoryFound").'</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($this->db);
|
|
||||||
$s.='</select>';
|
|
||||||
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,252 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
|
||||||
* Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* or see http://www.gnu.org/
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/modules/mailings/contacts4.modules.php
|
|
||||||
* \ingroup mailing
|
|
||||||
* \brief Provides a list of recipients for mailing module
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage a list of personalised recipients for mailing feature
|
|
||||||
*/
|
|
||||||
class mailing_contacts4 extends MailingTargets
|
|
||||||
{
|
|
||||||
var $name='ContactsByCategory';
|
|
||||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
|
||||||
var $desc='Add contacts by category';
|
|
||||||
var $require_admin=0;
|
|
||||||
|
|
||||||
var $require_module=array();
|
|
||||||
var $picto='contact';
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renvoie url lien vers fiche de la source du destinataire du mailing
|
|
||||||
*
|
|
||||||
* @param int $id ID
|
|
||||||
* @return string Url lien
|
|
||||||
*/
|
|
||||||
function url($id)
|
|
||||||
{
|
|
||||||
return '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$id.'">'.img_object('',"contact").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the main function that returns the array of emails
|
|
||||||
*
|
|
||||||
* @param int $mailing_id Id of mailing. No need to use it.
|
|
||||||
* @param array $filtersarray Category
|
|
||||||
* @return int <0 if error, number of emails added if ok
|
|
||||||
*/
|
|
||||||
function add_to_target($mailing_id,$filtersarray=array())
|
|
||||||
{
|
|
||||||
global $conf,$langs;
|
|
||||||
|
|
||||||
$target = array();
|
|
||||||
|
|
||||||
// La requete doit retourner: id, email, fk_contact, name, firstname, other
|
|
||||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
|
||||||
$sql.= " sp.lastname, sp.firstname, sp.civility as civility_id,";
|
|
||||||
$sql.= " s.nom as companyname";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
if ($filtersarray[0] <> 'all')$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie_contact as cs ON cs.fk_socpeople=sp.rowid";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
|
||||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
|
|
||||||
$sql.= " ORDER BY sp.lastname, sp.firstname";
|
|
||||||
|
|
||||||
dol_syslog(get_class($this).':: add_to_target',LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj= $this->db->fetch_object($resql);
|
|
||||||
$target[] = array(
|
|
||||||
'email' => $obj->email,
|
|
||||||
'fk_contact' => $obj->fk_contact,
|
|
||||||
'lastname' => $obj->lastname,
|
|
||||||
'firstname' => $obj->firstname,
|
|
||||||
'other' =>
|
|
||||||
($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'.
|
|
||||||
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')),
|
|
||||||
'source_url' => $this->url($obj->id),
|
|
||||||
'source_id' => $obj->id,
|
|
||||||
'source_type' => 'contact'
|
|
||||||
);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
$this->error=$this->db->lasterrno();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::add_to_target($mailing_id, $target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the main mailing area, there is a box with statistics.
|
|
||||||
* If you want to add a line in this report you must provide an
|
|
||||||
* array of SQL request that returns two field:
|
|
||||||
* One called "label", One called "nb".
|
|
||||||
*
|
|
||||||
* @return array Array with SQL requests
|
|
||||||
*/
|
|
||||||
function getSqlArrayForStats()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$statssql=array();
|
|
||||||
/*for ($i=0; $i<5; $i++) {
|
|
||||||
$statssql[$i] = "SELECT c.label, count(sp.rowid) AS nb";
|
|
||||||
$statssql[$i].= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."societe as s,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."categorie as c,";
|
|
||||||
$statssql[$i].= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$statssql[$i].= " WHERE s.rowid = sp.fk_soc";
|
|
||||||
$statssql[$i].= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$statssql[$i].= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$statssql[$i].= " AND cs.fk_categorie = c.rowid";
|
|
||||||
$statssql[$i].= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
$statssql[$i].= " GROUP BY c.label";
|
|
||||||
$statssql[$i].= " ORDER BY nb DESC";
|
|
||||||
$statssql[$i].= " LIMIT $i,1";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $statssql;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return here number of distinct emails returned by your selector.
|
|
||||||
*
|
|
||||||
* @param string $sql Requete sql de comptage
|
|
||||||
* @return int Number of recipients
|
|
||||||
*/
|
|
||||||
function getNbOfRecipients($sql='')
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
// We must report here number of contacts when absolutely no filter selected (so all contacts).
|
|
||||||
// Number with a filter are show in the combo list for each filter.
|
|
||||||
// If we want a filter "is inside at least one category", we must add it into formFilter
|
|
||||||
$sql = "SELECT count(distinct(c.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
|
||||||
$sql.= " WHERE c.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND c.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND c.no_email = 0";
|
|
||||||
$sql.= " AND c.statut = 1";
|
|
||||||
/*
|
|
||||||
$sql = "SELECT count(distinct(sp.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie as c,";
|
|
||||||
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
|
||||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND cs.fk_categorie = c.rowid";
|
|
||||||
$sql.= " AND cs.fk_soc = sp.fk_soc";
|
|
||||||
*/
|
|
||||||
// La requete doit retourner un champ "nb" pour etre comprise
|
|
||||||
// par parent::getNbOfRecipients
|
|
||||||
return parent::getNbOfRecipients($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is to add a form filter to provide variant of selector
|
|
||||||
* If used, the HTML select must be called "filter".
|
|
||||||
*
|
|
||||||
* @return string A html select zone
|
|
||||||
*/
|
|
||||||
function formFilter()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie_contact as cs ON cs.fk_socpeople=sp.rowid";
|
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
|
|
||||||
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
|
|
||||||
$sql.= " AND sp.no_email = 0";
|
|
||||||
$sql.= " AND sp.statut = 1";
|
|
||||||
$sql.= " AND sp.entity IN (".getEntity('societe').")";
|
|
||||||
$sql.= " GROUP BY c.label";
|
|
||||||
$sql.= " ORDER BY c.label";
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
|
|
||||||
dol_syslog(get_class($this).':: formFilter',LOG_DEBUG);
|
|
||||||
if ($resql) {
|
|
||||||
$s='';
|
|
||||||
$s.='<select name="filter" class="flat">';
|
|
||||||
$s.='<option value="all"></option>';
|
|
||||||
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$s.='<option value="'.$obj->label.'">'.$obj->label.' ('.$obj->nb.')</option>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$s.='<option value="-1" disabled="disabled">'.$langs->trans("NoContactWithCategoryFound").'</option>';
|
|
||||||
}
|
|
||||||
$s.='</select>';
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->error=$this->db->lasterrno();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ class mailing_fraise extends MailingTargets
|
|||||||
{
|
{
|
||||||
var $name='FundationMembers'; // Identifiant du module mailing
|
var $name='FundationMembers'; // Identifiant du module mailing
|
||||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
||||||
var $desc='Foundation members with emails (by status)';
|
var $desc='Foundation members with emails';
|
||||||
// Set to 1 if selector is available for admin users only
|
// Set to 1 if selector is available for admin users only
|
||||||
var $require_admin=0;
|
var $require_admin=0;
|
||||||
|
|
||||||
@ -108,10 +108,14 @@ class mailing_fraise extends MailingTargets
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
$langs->load("categories");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
$form=new Form($this->db);
|
$form=new Form($this->db);
|
||||||
|
|
||||||
$s='';
|
$s='';
|
||||||
|
|
||||||
|
// Status
|
||||||
$s.=$langs->trans("Status").': ';
|
$s.=$langs->trans("Status").': ';
|
||||||
$s.='<select name="filter" class="flat">';
|
$s.='<select name="filter" class="flat">';
|
||||||
$s.='<option value="none"> </option>';
|
$s.='<option value="none"> </option>';
|
||||||
@ -121,7 +125,7 @@ class mailing_fraise extends MailingTargets
|
|||||||
$s.='<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
$s.='<option value="0">'.$langs->trans("MemberStatusResiliatedShort").'</option>';
|
||||||
$s.='</select> ';
|
$s.='</select> ';
|
||||||
$s.=$langs->trans("Type").': ';
|
$s.=$langs->trans("Type").': ';
|
||||||
$s.='<select name="filtertype" class="flat">';
|
$s.='<select name="filter_type" class="flat">';
|
||||||
$sql = "SELECT rowid, libelle, statut";
|
$sql = "SELECT rowid, libelle, statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
@ -150,6 +154,47 @@ class mailing_fraise extends MailingTargets
|
|||||||
}
|
}
|
||||||
|
|
||||||
$s.='</select>';
|
$s.='</select>';
|
||||||
|
|
||||||
|
$s.=' ';
|
||||||
|
|
||||||
|
$s.=$langs->trans("Category").': ';
|
||||||
|
$s.='<select name="filter_category" class="flat">';
|
||||||
|
|
||||||
|
// Show categories
|
||||||
|
$sql = "SELECT rowid, label, type, visible";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
||||||
|
$sql.= " WHERE type = 3"; // We keep only categories for members
|
||||||
|
// $sql.= " AND visible > 0"; // We ignore the property visible because member's categories does not use this property (only products categories use it).
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
$sql.= " ORDER BY label";
|
||||||
|
|
||||||
|
//print $sql;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
$s.='<option value="0"> </option>';
|
||||||
|
if (! $num) $s.='<option value="0" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$s.='<option value="'.$obj->rowid.'">'.dol_trunc($obj->label,38,'middle');
|
||||||
|
$s.='</option>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
$s.='</select>';
|
||||||
|
|
||||||
|
|
||||||
$s.='<br>';
|
$s.='<br>';
|
||||||
$s.=$langs->trans("DateEndSubscription").': ';
|
$s.=$langs->trans("DateEndSubscription").': ';
|
||||||
$s.=$langs->trans("After").' > '.$form->select_date(-1,'subscriptionafter',0,0,1,'fraise',1,0,1,0);
|
$s.=$langs->trans("After").' > '.$form->select_date(-1,'subscriptionafter',0,0,1,'fraise',1,0,1,0);
|
||||||
@ -200,18 +245,29 @@ class mailing_fraise extends MailingTargets
|
|||||||
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
||||||
$sql.= " a.lastname, a.firstname,";
|
$sql.= " a.lastname, a.firstname,";
|
||||||
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||||
|
if ($_POST['filter_category'])
|
||||||
|
{
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie";
|
||||||
|
}
|
||||||
|
$sql.= " , ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||||
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false
|
||||||
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
|
||||||
|
// Filter on status
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql.= " AND a.statut=1 AND (a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."')";
|
||||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";
|
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql.= " AND a.statut=0";
|
||||||
|
// Filter on date
|
||||||
if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
if ($dateendsubscriptionafter > 0) $sql.=" AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
||||||
if ($dateendsubscriptionbefore > 0) $sql.=" AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
if ($dateendsubscriptionbefore > 0) $sql.=" AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
||||||
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
$sql.= " AND a.fk_adherent_type = ta.rowid";
|
||||||
if ($_POST['filtertype']) $sql.= " AND ta.rowid='".$_POST['filtertype']."'";
|
// Filter on type
|
||||||
$sql.= " ORDER BY a.email";
|
if ($_POST['filter_type']) $sql.= " AND ta.rowid='".$_POST['filter_type']."'";
|
||||||
|
// Filter on category
|
||||||
|
if ($_POST['filter_category']) $sql.= " AND c.rowid='".$_POST['filter_category']."'";
|
||||||
|
$sql.= " ORDER BY a.email";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
// Add targets into table
|
// Add targets into table
|
||||||
|
|||||||
@ -1,234 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
*
|
|
||||||
* This file is an example to follow to add your own email selector inside
|
|
||||||
* the Dolibarr email tool.
|
|
||||||
* Follow instructions given in README file to know what to change to build
|
|
||||||
* your own emailing list selector.
|
|
||||||
* Code that need to be changed in this file are marked by "CHANGE THIS" tag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/core/modules/mailings/framboise.modules.php
|
|
||||||
* \ingroup mailing
|
|
||||||
* \brief Example file to provide a list of recipients for mailing module
|
|
||||||
*/
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to manage a list of personalised recipients for mailing feature
|
|
||||||
*/
|
|
||||||
class mailing_framboise extends MailingTargets
|
|
||||||
{
|
|
||||||
var $name='MembersCategories';
|
|
||||||
// This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found
|
|
||||||
var $desc="Foundation members with emails (by categories)";
|
|
||||||
// Set to 1 if selector is available for admin users only
|
|
||||||
var $require_admin=0;
|
|
||||||
|
|
||||||
var $require_module=array("adherent","categorie");
|
|
||||||
var $picto='user';
|
|
||||||
var $db;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the main function that returns the array of emails.
|
|
||||||
*
|
|
||||||
* @param int $mailing_id Id of mailing. No need to use it.
|
|
||||||
* @param array $filtersarray If you used the formFilter function. Empty otherwise.
|
|
||||||
* @return int <0 if error, number of emails added if ok
|
|
||||||
*/
|
|
||||||
function add_to_target($mailing_id,$filtersarray=array())
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
$langs->load("members");
|
|
||||||
$langs->load("companies");
|
|
||||||
|
|
||||||
$cibles = array();
|
|
||||||
|
|
||||||
// Select the members from category
|
|
||||||
$sql = "SELECT a.rowid as id, a.email as email, a.lastname, null as fk_contact, a.firstname,";
|
|
||||||
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe,"; // Other fields
|
|
||||||
if ($_POST['filter']) $sql.= " c.label";
|
|
||||||
else $sql.=" null as label";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
|
||||||
if ($_POST['filter'])
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE a.email != ''";
|
|
||||||
$sql.= " AND a.entity = ".$conf->entity;
|
|
||||||
if ($_POST['filter']) $sql.= " AND c.rowid='".$_POST['filter']."'";
|
|
||||||
$sql.= " ORDER BY a.email";
|
|
||||||
|
|
||||||
// Stocke destinataires dans cibles
|
|
||||||
$result=$this->db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
$j = 0;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found");
|
|
||||||
|
|
||||||
$old = '';
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($result);
|
|
||||||
if ($old <> $obj->email)
|
|
||||||
{
|
|
||||||
$cibles[$j] = array(
|
|
||||||
'email' => $obj->email,
|
|
||||||
'fk_contact' => $obj->fk_contact,
|
|
||||||
'lastname' => $obj->lastname,
|
|
||||||
'firstname' => $obj->firstname,
|
|
||||||
'other' =>
|
|
||||||
($langs->transnoentities("Login").'='.$obj->login).';'.
|
|
||||||
($langs->transnoentities("UserTitle").'='.($obj->civility_id?$langs->transnoentities("Civility".$obj->civility_id):'')).';'.
|
|
||||||
($langs->transnoentities("DateEnd").'='.dol_print_date($this->db->jdate($obj->datefin),'day')).';'.
|
|
||||||
($langs->transnoentities("Company").'='.$obj->societe).';'.
|
|
||||||
($obj->label?$langs->transnoentities("Category").'='.$obj->label:''),
|
|
||||||
'source_url' => $this->url($obj->id),
|
|
||||||
'source_id' => $obj->id,
|
|
||||||
'source_type' => 'member'
|
|
||||||
);
|
|
||||||
$old = $obj->email;
|
|
||||||
$j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog($this->db->error());
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::add_to_target($mailing_id, $cibles);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the main mailing area, there is a box with statistics.
|
|
||||||
* If you want to add a line in this report you must provide an
|
|
||||||
* array of SQL request that returns two field:
|
|
||||||
* One called "label", One called "nb".
|
|
||||||
*
|
|
||||||
* @return array Array with SQL requests
|
|
||||||
*/
|
|
||||||
function getSqlArrayForStats()
|
|
||||||
{
|
|
||||||
// CHANGE THIS: Optionnal
|
|
||||||
|
|
||||||
//var $statssql=array();
|
|
||||||
//$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL";
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return here number of distinct emails returned by your selector.
|
|
||||||
* For example if this selector is used to extract 500 different
|
|
||||||
* emails from a text file, this function must return 500.
|
|
||||||
*
|
|
||||||
* @param string $sql Requete sql de comptage
|
|
||||||
* @return int Nb of recipients
|
|
||||||
*/
|
|
||||||
function getNbOfRecipients($sql='')
|
|
||||||
{
|
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$sql = "SELECT count(distinct(a.email)) as nb";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
|
||||||
$sql.= " WHERE a.email != ''";
|
|
||||||
$sql.= " AND a.entity = ".$conf->entity;
|
|
||||||
|
|
||||||
// La requete doit retourner un champ "nb" pour etre comprise
|
|
||||||
// par parent::getNbOfRecipients
|
|
||||||
return parent::getNbOfRecipients($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is to add a form filter to provide variant of selector
|
|
||||||
* If used, the HTML select must be called "filter"
|
|
||||||
*
|
|
||||||
* @return string A html select zone
|
|
||||||
*/
|
|
||||||
function formFilter()
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("categories");
|
|
||||||
|
|
||||||
$s='';
|
|
||||||
$s.='<select name="filter" class="flat">';
|
|
||||||
|
|
||||||
// Show categories
|
|
||||||
$sql = "SELECT rowid, label, type, visible";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
|
|
||||||
$sql.= " WHERE type = 3"; // We keep only categories for members
|
|
||||||
// $sql.= " AND visible > 0"; // We ignore the property visible because member's categories does not use this property (only products categories use it).
|
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
|
||||||
$sql.= " ORDER BY label";
|
|
||||||
|
|
||||||
//print $sql;
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
|
|
||||||
$s.='<option value="0"> </option>';
|
|
||||||
if (! $num) $s.='<option value="0" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
|
|
||||||
$s.='<option value="'.$obj->rowid.'">'.dol_trunc($obj->label,38,'middle');
|
|
||||||
$s.='</option>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
|
||||||
|
|
||||||
$s.='</select>';
|
|
||||||
return $s;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Can include an URL link on each record provided by selector shown on target page.
|
|
||||||
*
|
|
||||||
* @param int $id Id of member
|
|
||||||
* @return string Url link
|
|
||||||
*/
|
|
||||||
function url($id)
|
|
||||||
{
|
|
||||||
return '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$id.'">'.img_object('',"user").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -80,6 +80,13 @@ class modExpenseReport extends DolibarrModules
|
|||||||
$this->const[$r][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
|
$this->const[$r][0] = "EXPENSEREPORT_ADDON";
|
||||||
|
$this->const[$r][1] = "chaine";
|
||||||
|
$this->const[$r][2] = "mod_expensereport_jade";
|
||||||
|
$this->const[$r][3] = 'Name of manager to generate expense report ref number';
|
||||||
|
$this->const[$r][4] = 0;
|
||||||
|
$r++;
|
||||||
|
|
||||||
$this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS";
|
$this->const[$r][0] = "MAIN_DELAY_EXPENSEREPORTS";
|
||||||
$this->const[$r][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
$this->const[$r][2] = "15";
|
$this->const[$r][2] = "15";
|
||||||
|
|||||||
@ -104,10 +104,10 @@ class modMargin extends DolibarrModules
|
|||||||
|
|
||||||
// left menu entry
|
// left menu entry
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r]=array(
|
||||||
'fk_menu'=>'fk_mainmenu=accountancy', // Put 0 if this is a top menu
|
'fk_menu'=>'fk_mainmenu=billing', // Put 0 if this is a top menu
|
||||||
'type'=>'left', // This is a Top menu entry
|
'type'=>'left', // This is a Top menu entry
|
||||||
'titre'=>'Margins',
|
'titre'=>'Margins',
|
||||||
'mainmenu'=>'accountancy',
|
'mainmenu'=>'billing',
|
||||||
'leftmenu'=>'margins',
|
'leftmenu'=>'margins',
|
||||||
'url'=>'/margin/index.php',
|
'url'=>'/margin/index.php',
|
||||||
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'margins', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
*
|
*
|
||||||
@ -56,11 +56,11 @@
|
|||||||
|
|
||||||
// Case of computed field
|
// Case of computed field
|
||||||
console.log(type);
|
console.log(type);
|
||||||
if (type == '' || type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
if (type == '' || type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||||
jQuery("tr.extra_computed_value").show();
|
jQuery("tr.extra_computed_value").show();
|
||||||
} else {
|
} else {
|
||||||
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
||||||
}
|
}
|
||||||
if (computed_value.val())
|
if (computed_value.val())
|
||||||
{
|
{
|
||||||
console.log("We enter a computed formula");
|
console.log("We enter a computed formula");
|
||||||
@ -75,7 +75,7 @@
|
|||||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||||
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||||
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||||
@ -90,8 +90,8 @@
|
|||||||
else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||||
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
||||||
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||||
else if (type == 'separate') {
|
else if (type == 'separate') {
|
||||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||||
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
||||||
}
|
}
|
||||||
else { // type = string
|
else { // type = string
|
||||||
@ -102,12 +102,12 @@
|
|||||||
if (type == 'separate')
|
if (type == 'separate')
|
||||||
{
|
{
|
||||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
||||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
default_value.removeAttr('disabled');
|
default_value.removeAttr('disabled');
|
||||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init_typeoffields('<?php echo GETPOST('type'); ?>');
|
init_typeoffields('<?php echo GETPOST('type'); ?>');
|
||||||
@ -158,7 +158,9 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- Position -->
|
<!-- Position -->
|
||||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos'); ?>"></td></tr>
|
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos','int'); ?>"></td></tr>
|
||||||
|
<!-- Language file -->
|
||||||
|
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||||
<!-- Computed Value -->
|
<!-- Computed Value -->
|
||||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('"computed_value"')?GETPOST('"computed_value"'):''); ?>"></td></tr>
|
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('"computed_value"')?GETPOST('"computed_value"'):''); ?>"></td></tr>
|
||||||
<!-- Default Value (at sql setup level) -->
|
<!-- Default Value (at sql setup level) -->
|
||||||
|
|||||||
@ -54,11 +54,11 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
// Case of computed field
|
// Case of computed field
|
||||||
if (type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
if (type == 'varchar' || type == 'int' || type == 'double' || type == 'price') {
|
||||||
jQuery("tr.extra_computed_value").show();
|
jQuery("tr.extra_computed_value").show();
|
||||||
} else {
|
} else {
|
||||||
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
computed_value.val(''); jQuery("tr.extra_computed_value").hide();
|
||||||
}
|
}
|
||||||
if (computed_value.val())
|
if (computed_value.val())
|
||||||
{
|
{
|
||||||
console.log("We enter a computed formula");
|
console.log("We enter a computed formula");
|
||||||
@ -73,7 +73,7 @@
|
|||||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||||
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||||
else if (type == 'double') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
else if (type == 'double') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
|
||||||
@ -91,19 +91,19 @@
|
|||||||
else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
|
||||||
else { // type = string
|
else { // type = string
|
||||||
size.val('').prop('disabled', true);
|
size.val('').prop('disabled', true);
|
||||||
unique.removeAttr('disabled');
|
unique.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'separate')
|
if (type == 'separate')
|
||||||
{
|
{
|
||||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
|
||||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
default_value.removeAttr('disabled');
|
default_value.removeAttr('disabled');
|
||||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init_typeoffields(jQuery("#type").val());
|
init_typeoffields(jQuery("#type").val());
|
||||||
jQuery("#type").change(function() {
|
jQuery("#type").change(function() {
|
||||||
@ -113,7 +113,7 @@
|
|||||||
// If we enter a formula, we disable other fields
|
// If we enter a formula, we disable other fields
|
||||||
jQuery("#computed_value").keyup(function() {
|
jQuery("#computed_value").keyup(function() {
|
||||||
init_typeoffields(jQuery('#type').val());
|
init_typeoffields(jQuery('#type').val());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -129,23 +129,20 @@
|
|||||||
<table summary="listofattributes" class="border centpercent">
|
<table summary="listofattributes" class="border centpercent">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$type=$extrafields->attribute_type[$attrname];
|
$type=$extrafields->attributes[$elementtype]['type'][$attrname];
|
||||||
$size=$extrafields->attribute_size[$attrname];
|
$size=$extrafields->attributes[$elementtype]['size'][$attrname];
|
||||||
$computed=$extrafields->attribute_computed[$attrname];
|
$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
|
||||||
$default=$extrafields->attribute_default[$attrname];
|
$default=$extrafields->attributes[$elementtype]['default'][$attrname];
|
||||||
$unique=$extrafields->attribute_unique[$attrname];
|
$unique=$extrafields->attributes[$elementtype]['unique'][$attrname];
|
||||||
$required=$extrafields->attribute_required[$attrname];
|
$required=$extrafields->attributes[$elementtype]['required'][$attrname];
|
||||||
$pos=$extrafields->attribute_pos[$attrname];
|
$pos=$extrafields->attributes[$elementtype]['pos'][$attrname];
|
||||||
$alwayseditable=$extrafields->attribute_alwayseditable[$attrname];
|
$alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
|
||||||
$param=$extrafields->attribute_param[$attrname];
|
$param=$extrafields->attributes[$elementtype]['param'][$attrname];
|
||||||
$perms=$extrafields->attribute_perms[$attrname];
|
$perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
|
||||||
$list=$extrafields->attribute_list[$attrname];
|
$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
|
||||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) {
|
$list=$extrafields->attributes[$elementtype]['list'][$attrname];
|
||||||
$ishidden=$extrafields->attribute_hidden[$attrname];
|
$ishidden=$extrafields->attributes[$elementtype]['hidden'][$attrname];
|
||||||
}
|
$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
|
||||||
if ($conf->multicompany->enabled) {
|
|
||||||
$entitycurrentorall=$extrafields->attribute_entityid[$attrname];
|
|
||||||
}
|
|
||||||
|
|
||||||
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
||||||
{
|
{
|
||||||
@ -220,7 +217,9 @@ else
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- Position -->
|
<!-- Position -->
|
||||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($extrafields->attribute_pos[$attrname]); ?>"></td></tr>
|
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
|
||||||
|
<!-- Language file -->
|
||||||
|
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
|
||||||
<!-- Computed value -->
|
<!-- Computed value -->
|
||||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
|
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
|
||||||
<!-- Default value -->
|
<!-- Default value -->
|
||||||
|
|||||||
@ -37,10 +37,14 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object,
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
//var_dump($extrafields->attributes);
|
||||||
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label']))
|
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label']))
|
||||||
{
|
{
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||||
{
|
{
|
||||||
|
// Load language if required
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||||
|
|
||||||
if ($action == 'edit_extras')
|
if ($action == 'edit_extras')
|
||||||
{
|
{
|
||||||
$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]);
|
$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]);
|
||||||
@ -77,6 +81,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
|||||||
if ($object->element=='shipping') $permok=$user->rights->expedition->creer;
|
if ($object->element=='shipping') $permok=$user->rights->expedition->creer;
|
||||||
if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer;
|
if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer;
|
||||||
if ($object->element=='productlot') $permok=$user->rights->stock->creer;
|
if ($object->element=='productlot') $permok=$user->rights->stock->creer;
|
||||||
|
if ($object->element=='facturerec') $permok=$user->rights->facture->creer;
|
||||||
|
|
||||||
if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
|
if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
|
||||||
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
|
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
|
||||||
|
|||||||
@ -49,7 +49,7 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable
|
|||||||
?>
|
?>
|
||||||
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
|
<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
|
||||||
|
|
||||||
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
|
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
|
||||||
|
|
||||||
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -123,23 +123,28 @@ if ($disablenofollow) echo '</a>';
|
|||||||
</span>
|
</span>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<?php
|
<?php
|
||||||
if (! empty($morelogincontent) && is_array($morelogincontent)) {
|
if (! empty($morelogincontent)) {
|
||||||
foreach ($morelogincontent as $format => $option)
|
if (is_array($morelogincontent)) {
|
||||||
{
|
foreach ($morelogincontent as $format => $option)
|
||||||
if ($format == 'table') {
|
{
|
||||||
echo '<!-- Option by hook -->';
|
if ($format == 'table') {
|
||||||
echo $option;
|
echo '<!-- Option by hook -->';
|
||||||
|
echo $option;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
echo '<!-- Option by hook -->';
|
||||||
|
echo $morelogincontent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php
|
if ($captcha) {
|
||||||
if ($captcha) {
|
// Add a variable param to force not using cache (jmobile)
|
||||||
// Add a variable param to force not using cache (jmobile)
|
$php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time
|
||||||
$php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time
|
if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog');
|
||||||
if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog');
|
else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog');
|
||||||
else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog');
|
// TODO: provide accessible captcha variants
|
||||||
// TODO: provide accessible captcha variants
|
|
||||||
?>
|
?>
|
||||||
<!-- Captcha -->
|
<!-- Captcha -->
|
||||||
<tr>
|
<tr>
|
||||||
@ -275,9 +280,9 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
|
|||||||
|
|
||||||
<!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
|
<!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
|
||||||
|
|
||||||
<?php if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
|
||||||
|
|
||||||
if (! empty($morelogincontent) && is_array($morelogincontent)) {
|
if (! empty($morelogincontent) && is_array($morelogincontent)) {
|
||||||
foreach ($morelogincontent as $format => $option)
|
foreach ($morelogincontent as $format => $option)
|
||||||
{
|
{
|
||||||
@ -287,9 +292,11 @@ if (! empty($morelogincontent) && is_array($morelogincontent)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
else if (! empty($moreloginextracontent)) {
|
||||||
|
echo '<!-- Javascript by hook -->';
|
||||||
|
echo $moreloginextracontent;
|
||||||
|
}
|
||||||
|
|
||||||
<?php
|
|
||||||
// Google Analytics (need Google module)
|
// Google Analytics (need Google module)
|
||||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||||
{
|
{
|
||||||
@ -309,9 +316,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)
|
|||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// Google Adsense
|
// Google Adsense
|
||||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -372,6 +372,9 @@ else {
|
|||||||
elseif ($this->table_element_line=='facture_fourn_det') {
|
elseif ($this->table_element_line=='facture_fourn_det') {
|
||||||
$newline = new SupplierInvoiceLine($this->db);
|
$newline = new SupplierInvoiceLine($this->db);
|
||||||
}
|
}
|
||||||
|
elseif ($this->table_element_line=='facturedet_rec') {
|
||||||
|
$newline = new FactureLigneRec($this->db);
|
||||||
|
}
|
||||||
if (is_object($newline)) {
|
if (is_object($newline)) {
|
||||||
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
|
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ print top_htmlhead('',$langs->trans('SendNewPassword'));
|
|||||||
?>
|
?>
|
||||||
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
|
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
|
||||||
|
|
||||||
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
|
<body class="body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
|
||||||
|
|
||||||
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
<?php if (empty($conf->dol_use_jmobile)) { ?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -88,14 +88,20 @@ if ($disablenofollow) echo '</a>';
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (! empty($hookmanager->resArray['options'])) {
|
if (! empty($morelogincontent)) {
|
||||||
foreach ($hookmanager->resArray['options'] as $format => $option)
|
if (is_array($morelogincontent)) {
|
||||||
{
|
foreach ($morelogincontent as $format => $option)
|
||||||
if ($format == 'table') {
|
{
|
||||||
echo '<!-- Option by hook -->';
|
if ($format == 'table') {
|
||||||
echo $option;
|
echo '<!-- Option by hook -->';
|
||||||
|
echo $option;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
echo '<!-- Option by hook -->';
|
||||||
|
echo $morelogincontent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -175,6 +181,20 @@ if (! empty($hookmanager->resArray['options'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if (! empty($morelogincontent) && is_array($morelogincontent)) {
|
||||||
|
foreach ($morelogincontent as $format => $option)
|
||||||
|
{
|
||||||
|
if ($format == 'js') {
|
||||||
|
echo "\n".'<!-- Javascript by hook -->';
|
||||||
|
echo $option."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (! empty($moreloginextracontent)) {
|
||||||
|
echo '<!-- Javascript by hook -->';
|
||||||
|
echo $moreloginextracontent;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end of center -->
|
</div> <!-- end of center -->
|
||||||
|
|||||||
@ -268,11 +268,13 @@ $filepath=$relativepath.$file->label;
|
|||||||
$rellink.='&file='.urlencode($filepath);
|
$rellink.='&file='.urlencode($filepath);
|
||||||
$fulllink=$urlwithroot.$rellink;
|
$fulllink=$urlwithroot.$rellink;
|
||||||
print img_picto('','object_globe.png').' ';
|
print img_picto('','object_globe.png').' ';
|
||||||
print '<input type="text" class="quatrevingtpercent" name="downloadlink" value="'.dol_escape_htmltag($fulllink).'">';
|
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadlink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||||
print ' <a data-ajax="false" href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print ajax_autoselect('downloadlink');
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if ($_GET["action"] == 'edit')
|
if ($_GET["action"] == 'edit')
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
|
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
|
|||||||
@ -731,6 +731,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->date_create = $now;
|
$this->date_create = $now;
|
||||||
$this->date_debut = $now;
|
$this->date_debut = $now;
|
||||||
$this->date_fin = $now;
|
$this->date_fin = $now;
|
||||||
|
$this->date_valid = $now;
|
||||||
$this->date_approve = $now;
|
$this->date_approve = $now;
|
||||||
|
|
||||||
$type_fees_id = 2; // TF_TRIP
|
$type_fees_id = 2; // TF_TRIP
|
||||||
@ -1058,111 +1059,118 @@ class ExpenseReport extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function setValidate($fuser, $notrigger=0)
|
function setValidate($fuser, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$this->oldref = $this->ref;
|
$now = dol_now();
|
||||||
$expld_car = (empty($conf->global->NDF_EXPLODE_CHAR))?"-":$conf->global->NDF_EXPLODE_CHAR;
|
|
||||||
|
|
||||||
// Sélection de la date de début de la NDF
|
// Protection
|
||||||
$sql = 'SELECT date_debut';
|
if ($this->statut == self::STATUS_VALIDATED)
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
|
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
$objp = $this->db->fetch_object($result);
|
|
||||||
$this->date_debut = $this->db->jdate($objp->date_debut);
|
|
||||||
|
|
||||||
$update_number_int = false;
|
|
||||||
|
|
||||||
// Create next ref if ref is PROVxx
|
|
||||||
// Rename directory if dir was a temporary ref
|
|
||||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
|
||||||
{
|
{
|
||||||
// Sélection du numéro de ref suivant
|
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
|
||||||
$ref_next = $this->getNextNumRef();
|
return 0;
|
||||||
$ref_number_int = ($this->ref+1)-1;
|
|
||||||
$update_number_int = true;
|
|
||||||
// Création du ref_number suivant
|
|
||||||
if($ref_next)
|
|
||||||
{
|
|
||||||
$prefix="ER";
|
|
||||||
if (! empty($conf->global->EXPENSE_REPORT_PREFIX)) $prefix=$conf->global->EXPENSE_REPORT_PREFIX;
|
|
||||||
$this->ref = str_replace(' ','_', $this->user_author_infos).$expld_car.$prefix.$this->ref.$expld_car.dol_print_date($this->date_debut,'%y%m%d');
|
|
||||||
}
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
// We rename directory in order to avoid losing the attachments
|
|
||||||
$oldref = dol_sanitizeFileName($this->oldref);
|
|
||||||
$newref = dol_sanitizeFileName($this->ref);
|
|
||||||
$dirsource = $conf->expensereport->dir_output.'/'.$oldref;
|
|
||||||
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
|
|
||||||
if (file_exists($dirsource))
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
|
|
||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
|
||||||
{
|
|
||||||
dol_syslog("Rename ok");
|
|
||||||
// Rename docs starting with $oldref with $newref
|
|
||||||
$listoffiles=dol_dir_list($conf->expensereport->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
|
||||||
foreach($listoffiles as $fileentry)
|
|
||||||
{
|
|
||||||
$dirsource=$fileentry['name'];
|
|
||||||
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
|
||||||
$dirsource=$fileentry['path'].'/'.$dirsource;
|
|
||||||
$dirdest=$fileentry['path'].'/'.$dirdest;
|
|
||||||
@rename($dirsource, $dirdest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($this->fk_statut != 2)
|
|
||||||
|
$this->date_valid = $now; // Required for the getNextNum later.
|
||||||
|
|
||||||
|
// Define new ref
|
||||||
|
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
|
||||||
{
|
{
|
||||||
$now = dol_now();
|
$num = $this->getNextNumRef();
|
||||||
$this->db->begin();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$num = $this->ref;
|
||||||
|
}
|
||||||
|
if (empty($num)) return -1;
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$this->newref = $num;
|
||||||
$sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = 2, fk_user_valid = ".$fuser->id.", date_valid='".$this->db->idate($now)."'";
|
|
||||||
if ($update_number_int) {
|
|
||||||
$sql.= ", ref_number_int = ".$ref_number_int;
|
|
||||||
}
|
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$this->db->begin();
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
if (!$notrigger)
|
|
||||||
{
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE',$fuser);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
// Validate
|
||||||
$error++;
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||||
|
$sql.= " SET ref = '".$num."',";
|
||||||
|
$sql.= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||||
|
$sql.= " date_valid='".$this->db->idate($this->date_valid)."',";
|
||||||
|
$sql.= " fk_user_valid = ".$user->id;
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if (!$notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE',$fuser);
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->oldref = $this->ref;
|
||||||
|
|
||||||
|
// Rename directory if dir was a temporary ref
|
||||||
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
|
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
|
||||||
|
// in order not to lose the attachments
|
||||||
|
$oldref = dol_sanitizeFileName($this->ref);
|
||||||
|
$newref = dol_sanitizeFileName($num);
|
||||||
|
$dirsource = $conf->expensereport->dir_output.'/'.$oldref;
|
||||||
|
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
|
||||||
|
if (file_exists($dirsource))
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
|
if (@rename($dirsource, $dirdest))
|
||||||
|
{
|
||||||
|
dol_syslog("Rename ok");
|
||||||
|
// Rename docs starting with $oldref with $newref
|
||||||
|
$listoffiles=dol_dir_list($conf->expensereport->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/'));
|
||||||
|
foreach($listoffiles as $fileentry)
|
||||||
|
{
|
||||||
|
$dirsource=$fileentry['name'];
|
||||||
|
$dirdest=preg_replace('/^'.preg_quote($oldref,'/').'/',$newref, $dirsource);
|
||||||
|
$dirsource=$fileentry['path'].'/'.$dirsource;
|
||||||
|
$dirdest=$fileentry['path'].'/'.$dirdest;
|
||||||
|
@rename($dirsource, $dirdest);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error))
|
// Set new ref and current status
|
||||||
{
|
if (! $error)
|
||||||
$this->db->commit();
|
{
|
||||||
return 1;
|
$this->ref = $num;
|
||||||
}
|
$this->statut = self::STATUS_VALIDATED;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
$this->db->rollback();
|
if (empty($error))
|
||||||
$this->error=$this->db->error();
|
{
|
||||||
return -2;
|
$this->db->commit();
|
||||||
}
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::setValidate expensereport already with validated status", LOG_WARNING);
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1467,36 +1475,52 @@ class ExpenseReport extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getNextNumRef()
|
function getNextNumRef()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $langs, $conf;
|
||||||
|
$langs->load("trips");
|
||||||
|
|
||||||
$expld_car = (empty($conf->global->NDF_EXPLODE_CHAR))?"-":$conf->global->NDF_EXPLODE_CHAR;
|
if (! empty($conf->global->EXPENSEREPORT_ADDON))
|
||||||
$num_car = (empty($conf->global->NDF_NUM_CAR_REF))?"5":$conf->global->NDF_NUM_CAR_REF;
|
{
|
||||||
|
$mybool=false;
|
||||||
|
|
||||||
$sql = 'SELECT MAX(de.ref_number_int) as max';
|
$file = $conf->global->EXPENSEREPORT_ADDON.".php";
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' de';
|
$classname = $conf->global->EXPENSEREPORT_ADDON;
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
// Include file with class
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
foreach ($dirmodels as $reldir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/expensereport/");
|
||||||
|
|
||||||
if($this->db->num_rows($result) > 0):
|
// Load file with numbering class (if found)
|
||||||
$objp = $this->db->fetch_object($result);
|
$mybool|=@include_once $dir.$file;
|
||||||
$this->ref = $objp->max;
|
}
|
||||||
$this->ref++;
|
|
||||||
while(strlen($this->ref) < $num_car):
|
|
||||||
$this->ref = "0".$this->ref;
|
|
||||||
endwhile;
|
|
||||||
else:
|
|
||||||
$this->ref = 1;
|
|
||||||
while(strlen($this->ref) < $num_car):
|
|
||||||
$this->ref = "0".$this->ref;
|
|
||||||
endwhile;
|
|
||||||
endif;
|
|
||||||
|
|
||||||
if ($result):
|
if (! $mybool)
|
||||||
return 1;
|
{
|
||||||
else:
|
dol_print_error('',"Failed to include file ".$file);
|
||||||
$this->error=$this->db->error();
|
return '';
|
||||||
return -1;
|
}
|
||||||
endif;
|
|
||||||
|
$obj = new $classname();
|
||||||
|
$numref = $obj->getNextValue($this);
|
||||||
|
|
||||||
|
if ($numref != "")
|
||||||
|
{
|
||||||
|
return $numref;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$obj->error;
|
||||||
|
$this->errors=$obj->errors;
|
||||||
|
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("Error_EXPENSEREPORT_ADDON_NotDefined");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -1459,6 +1459,7 @@ if ($action=='create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -1487,6 +1487,7 @@ if ($action == 'create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -33,18 +34,23 @@ require '../../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('banks');
|
$langs->load('banks');
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
// Security check
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
$confirm = GETPOST('confirm');
|
$confirm = GETPOST('confirm');
|
||||||
|
$facid = GETPOST('facid','int');
|
||||||
$facid=GETPOST('facid','int');
|
$socid = GETPOST('socid','int');
|
||||||
$socid=GETPOST('socid','int');
|
|
||||||
$accountid = GETPOST('accountid');
|
$accountid = GETPOST('accountid');
|
||||||
|
$day = GETPOST('day','int');
|
||||||
|
$month = GETPOST('month','int');
|
||||||
|
$year = GETPOST('year','int');
|
||||||
|
|
||||||
$search_ref=GETPOST("search_ref","int");
|
$search_ref=GETPOST("search_ref","int");
|
||||||
$search_account=GETPOST("search_account","int");
|
$search_account=GETPOST("search_account","int");
|
||||||
@ -316,6 +322,7 @@ $invoicesupplierstatic = new FactureFournisseur($db);
|
|||||||
llxHeader('',$langs->trans('ListPayment'));
|
llxHeader('',$langs->trans('ListPayment'));
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
$formother=new FormOther($db);
|
||||||
|
|
||||||
if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement')
|
if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paiement')
|
||||||
{
|
{
|
||||||
@ -747,6 +754,19 @@ if (empty($action))
|
|||||||
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
|
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
|
||||||
// Search criteria
|
// Search criteria
|
||||||
|
if ($month > 0)
|
||||||
|
{
|
||||||
|
if ($year > 0 && empty($day))
|
||||||
|
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||||
|
else if ($year > 0 && ! empty($day))
|
||||||
|
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(p.datep, '%m') = '".$month."'";
|
||||||
|
}
|
||||||
|
else if ($year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||||
|
}
|
||||||
if ($search_ref) $sql .= natural_search('p.rowid', $search_ref);
|
if ($search_ref) $sql .= natural_search('p.rowid', $search_ref);
|
||||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||||
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
|
||||||
@ -776,6 +796,9 @@ if (empty($action))
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($day) $param.=($day?"&day=".urlencode($day):"");
|
||||||
|
if ($month) $param.=($month?"&month=".urlencode($month):"");
|
||||||
|
if ($year) $param.=($year?"&year=".urlencode($year):"");
|
||||||
if ($search_ref) $param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
|
if ($search_ref) $param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
|
||||||
if ($search_company) $param.=($search_company?"&search_company=".urlencode($search_company):"");
|
if ($search_company) $param.=($search_company?"&search_company=".urlencode($search_company):"");
|
||||||
if ($search_amount != '') $param.=($search_amount?"&search_amount=".urlencode($search_amount):"");
|
if ($search_amount != '') $param.=($search_amount?"&search_amount=".urlencode($search_amount):"");
|
||||||
@ -797,7 +820,6 @@ if (empty($action))
|
|||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
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="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
@ -827,7 +849,11 @@ if (empty($action))
|
|||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre" align="center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||||
|
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -850,14 +876,14 @@ if (empty($action))
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre('RefPayment',$_SERVER["PHP_SELF"],'p.rowid','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],'p.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','',$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],'dp','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('ThirdParty',$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'c.libelle','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],'c.libelle','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
|
print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre('Account',$_SERVER["PHP_SELF"],'ba.label','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],'ba.label','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'p.amount','',$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],'p.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
//print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder);
|
//print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -154,7 +154,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF'
|
|||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong');
|
||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc');
|
||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc');
|
||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', NULL, 1, 'Franc pacifique (XPF)');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', '[70]', 1, 'Franc CFP');
|
||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial');
|
||||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar');
|
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar');
|
||||||
|
|
||||||
|
|||||||
@ -36,26 +36,50 @@ insert into llx_c_type_fees (code,label,active) values ('TF_OTHER', 'Other',
|
|||||||
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Transportation', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_TRIP', 'Transportation', 1);
|
||||||
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
insert into llx_c_type_fees (code,label,active) values ('TF_LUNCH', 'Lunch', 1);
|
||||||
|
|
||||||
INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES
|
|
||||||
('EX_KME', 'ExpLabelKm', 1, '625100'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_KME', 'ExpLabelKm', 1);
|
||||||
('EX_FUE', 'ExpLabelFuelCV', 0, '606150'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_FUE', 'ExpLabelFuelCV', 0);
|
||||||
('EX_HOT', 'ExpLabelHotel', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_HOT', 'ExpLabelHotel', 0);
|
||||||
('EX_PAR', 'ExpLabelParkingCV', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_PAR', 'ExpLabelParkingCV', 0);
|
||||||
('EX_TOL', 'ExpLabelTollCV', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_TOL', 'ExpLabelTollCV', 0);
|
||||||
('EX_TAX', 'ExpLabelVariousTaxes', 0, '637800'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_TAX', 'ExpLabelVariousTaxes', 0);
|
||||||
('EX_IND', 'ExpLabelIndemnityTransportationSubscription', 0, '648100'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_IND', 'ExpLabelIndemnityTransSubscrip', 0);
|
||||||
('EX_SUM', 'ExpLabelMaintenanceSupply', 0, '606300'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_SUM', 'ExpLabelMaintenanceSupply', 0);
|
||||||
('EX_SUO', 'ExpLabelOfficeSupplies', 0, '606400'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_SUO', 'ExpLabelOfficeSupplies', 0);
|
||||||
('EX_CAR', 'ExpLabelCarRental', 0, '613000'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_CAR', 'ExpLabelCarRental', 0);
|
||||||
('EX_DOC', 'ExpLabelDocumentation', 0, '618100'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_DOC', 'ExpLabelDocumentation', 0);
|
||||||
('EX_CUR', 'ExpLabelCustomersReceiving', 0, '625710'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_CUR', 'ExpLabelCustomersReceiving', 0);
|
||||||
('EX_OTR', 'ExpLabelOtherReceiving', 0, '625700'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_OTR', 'ExpLabelOtherReceiving', 0);
|
||||||
('EX_POS', 'ExpLabelPostage', 0, '626100'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_POS', 'ExpLabelPostage', 0);
|
||||||
('EX_CAM', 'ExpLabelMaintenanceRepairCV', 0, '615300'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_CAM', 'ExpLabelMaintenanceRepairCV', 0);
|
||||||
('EX_EMM', 'ExpLabelEmployeesMeal', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_EMM', 'ExpLabelEmployeesMeal', 0);
|
||||||
('EX_GUM', 'ExpLabelGuestsMeal', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_GUM', 'ExpLabelGuestsMeal', 0);
|
||||||
('EX_BRE', 'ExpLabelBreakfast', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_BRE', 'ExpLabelBreakfast', 0);
|
||||||
('EX_FUE_VP', 'ExpLabelFuelPV', 0, '606150'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_FUE_VP', 'ExpLabelFuelPV', 0);
|
||||||
('EX_TOL_VP', 'ExpLabelTollPV', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_TOL_VP', 'ExpLabelTollPV', 0);
|
||||||
('EX_PAR_VP', 'ExpLabelParkingPV', 0, '625160'),
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_PAR_VP', 'ExpLabelParkingPV', 0);
|
||||||
('EX_CAM_VP', 'ExpLabelMaintenanceRepairPV', 0, '615300');
|
INSERT INTO llx_c_type_fees (code, label, active) VALUES('EX_CAM_VP', 'ExpLabelMaintenanceRepairPV', 0);
|
||||||
|
|
||||||
|
-- Set accoutancy_code for french accounting plan
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625100' WHERE code = 'EX_KME';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '606150' WHERE code = 'EX_FUE';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_HOT';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_PAR';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_TOL';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '637800' WHERE code = 'EX_TAX';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '648100' WHERE code = 'EX_IND';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '606300' WHERE code = 'EX_SUM';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '606400' WHERE code = 'EX_SUO';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '613000' WHERE code = 'EX_CAR';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '618100' WHERE code = 'EX_DOC';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625710' WHERE code = 'EX_CUR';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625700' WHERE code = 'EX_OTR';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '626100' WHERE code = 'EX_POS';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '615300' WHERE code = 'EX_CAM';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_EMM';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_GUM';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_BRE';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '606150' WHERE code = 'EX_FUE_VP';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_TOL_VP';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '625160' WHERE code = 'EX_PAR_VP';
|
||||||
|
--UPDATE llx_c_type_fees SET accountancy_code = '615300' WHERE code = 'EX_CAM_VP';
|
||||||
|
|||||||
@ -585,3 +585,23 @@ ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255);
|
|||||||
|
|
||||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'IGST-CGST', 8, 8, '1', 0, '0', 0, 'IGST-CGST', 1);
|
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1176, 117, 'IGST-CGST', 8, 8, '1', 0, '0', 0, 'IGST-CGST', 1);
|
||||||
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'SGST', 0, 0, '0', 16, '1', 0, 'SGST', 1);
|
insert into llx_c_tva(rowid,fk_pays,code,taux,localtax1,localtax1_type,localtax2,localtax2_type,recuperableonly,note,active) values (1177, 117, 'SGST', 0, 0, '0', 16, '1', 0, 'SGST', 1);
|
||||||
|
|
||||||
|
CREATE TABLE llx_facture_rec_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14)
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_facture_rec_extrafields ADD INDEX idx_facture_rec_extrafields (fk_object);
|
||||||
|
|
||||||
|
CREATE TABLE llx_facturedet_rec_extrafields
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14)
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object);
|
||||||
|
|||||||
@ -25,6 +25,13 @@
|
|||||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_menu MODIFY COLUMN perms text;
|
||||||
|
|
||||||
|
ALTER TABLE llx_mailing MODIFY COLUMN titre varchar(128);
|
||||||
|
ALTER TABLE llx_mailing MODIFY COLUMN sujet varchar(128);
|
||||||
|
|
||||||
|
ALTER TABLE llx_mailing MODIFY COLUMN langs varchar(64);
|
||||||
|
|
||||||
ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL;
|
ALTER TABLE llx_facture_fourn ADD COLUMN date_pointoftax date DEFAULT NULL;
|
||||||
ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date;
|
ALTER TABLE llx_facture_fourn ADD COLUMN date_valid date;
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,8 @@ delete from llx_categorie where fk_parent not in (select rowid from tmp_categori
|
|||||||
drop table tmp_categorie;
|
drop table tmp_categorie;
|
||||||
-- Fix: delete orphelin category.
|
-- Fix: delete orphelin category.
|
||||||
delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0);
|
delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0);
|
||||||
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
|
delete from llx_categorie_fournisseur where fk_categorie not in (select rowid from llx_categorie where type = 1);
|
||||||
|
delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type = 2);
|
||||||
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
|
||||||
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
|
||||||
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
|
delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
|
||||||
@ -227,7 +228,7 @@ update llx_product set barcode = null where barcode in ('', '-1', '0');
|
|||||||
update llx_societe set barcode = null where barcode in ('', '-1', '0');
|
update llx_societe set barcode = null where barcode in ('', '-1', '0');
|
||||||
|
|
||||||
|
|
||||||
-- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate.
|
-- Sequence to removed duplicated values of llx_links. Use several times if you still have duplicate.
|
||||||
drop table tmp_links_double;
|
drop table tmp_links_double;
|
||||||
--select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2;
|
--select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2;
|
||||||
create table tmp_links_double as (select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2);
|
create table tmp_links_double as (select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2);
|
||||||
@ -236,7 +237,7 @@ delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_
|
|||||||
drop table tmp_links_double;
|
drop table tmp_links_double;
|
||||||
|
|
||||||
|
|
||||||
-- Sequence to removed duplicated values of barcode in llx_product. Use serveral times if you still have duplicate.
|
-- Sequence to removed duplicated values of barcode in llx_product. Use several times if you still have duplicate.
|
||||||
drop table tmp_product_double;
|
drop table tmp_product_double;
|
||||||
--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2;
|
--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2;
|
||||||
create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2);
|
create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2);
|
||||||
@ -245,7 +246,7 @@ update llx_product set barcode = null where (rowid, barcode) in (select max_rowi
|
|||||||
drop table tmp_product_double;
|
drop table tmp_product_double;
|
||||||
|
|
||||||
|
|
||||||
-- Sequence to removed duplicated values of barcode in llx_societe. Use serveral times if you still have duplicate.
|
-- Sequence to removed duplicated values of barcode in llx_societe. Use several times if you still have duplicate.
|
||||||
drop table tmp_societe_double;
|
drop table tmp_societe_double;
|
||||||
--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2;
|
--select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2;
|
||||||
create table tmp_societe_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2);
|
create table tmp_societe_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2);
|
||||||
@ -254,6 +255,15 @@ update llx_societe set barcode = null where (rowid, barcode) in (select max_rowi
|
|||||||
drop table tmp_societe_double;
|
drop table tmp_societe_double;
|
||||||
|
|
||||||
|
|
||||||
|
-- Sequence to removed duplicated values of llx_accounting_account. Use several times if you still have duplicate.
|
||||||
|
drop table tmp_accounting_account_double;
|
||||||
|
--select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2;
|
||||||
|
create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2);
|
||||||
|
--select * from tmp_accounting_account_double;
|
||||||
|
delete from llx_accounting_account where (rowid) in (select max_rowid from tmp_accounting_account_double); --update to avoid duplicate, delete to delete
|
||||||
|
drop table tmp_accounting_account_double;
|
||||||
|
|
||||||
|
|
||||||
UPDATE llx_projet_task SET fk_task_parent = 0 WHERE fk_task_parent = rowid;
|
UPDATE llx_projet_task SET fk_task_parent = 0 WHERE fk_task_parent = rowid;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user