Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_expense_numbering
@ -1,16 +0,0 @@
|
||||
build
|
||||
build.xml
|
||||
ChangeLog
|
||||
composer.json
|
||||
CONTRIBUTING.md
|
||||
COPYING
|
||||
COPYRIGHT
|
||||
dev
|
||||
doc
|
||||
Dockerfile
|
||||
INSTALL
|
||||
README-FR.md
|
||||
README.md
|
||||
robots.txt
|
||||
scripts
|
||||
test
|
||||
35
ChangeLog
@ -28,7 +28,7 @@ NEW: add property to show warnings when activating modules
|
||||
NEW: add rapport file for supplier paiement
|
||||
NEW: Add statistics on supplier tab.
|
||||
NEW: Add tooltip help on shipment weight and volume calculation
|
||||
NEW: An external module can hook and add mass actions
|
||||
NEW: An external module can hook and add mass actions.
|
||||
NEW: Better reponsive design
|
||||
NEW: Bookmarks are into a combo list.
|
||||
NEW: Bulk actions available on supplier orders
|
||||
@ -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".
|
||||
|
||||
|
||||
***** 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 *****
|
||||
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
|
||||
@ -662,7 +693,7 @@ NEW: Disabled users are striked.
|
||||
NEW: Enhance navigation of project module
|
||||
NEW: fichinter lines ordered by rang AND DATE
|
||||
NEW: hidden conf to use input file multiple from mail form
|
||||
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
|
||||
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
|
||||
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
|
||||
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.
|
||||
|
||||
3
build/docker/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
Dockerfile
|
||||
README.md
|
||||
docker-compose.yml
|
||||
@ -1,4 +1,7 @@
|
||||
FROM php:5.6-apache
|
||||
FROM php:7.0-apache
|
||||
|
||||
ENV HOST_USER_ID 33
|
||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
@ -9,11 +12,9 @@ RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& docker-php-ext-install mysqli \
|
||||
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
|
||||
|
||||
COPY htdocs/ /var/www/html/
|
||||
|
||||
RUN chown -hR www-data:www-data /var/www/html
|
||||
|
||||
VOLUME /var/www/html/conf
|
||||
VOLUME /var/www/html/documents
|
||||
COPY docker-run.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-run.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["docker-run.sh"]
|
||||
25
build/docker/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# How to use it ?
|
||||
|
||||
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||
|
||||
Before build/run, define the variable HOST_USER_ID as following:
|
||||
|
||||
export HOST_USER_ID=$(id -u)
|
||||
|
||||
Go in repository build/docker :
|
||||
|
||||
cd build/docker
|
||||
|
||||
And then, you can run :
|
||||
|
||||
docker-compose up
|
||||
|
||||
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
|
||||
|
||||
The URL to go to the Dolibarr is :
|
||||
|
||||
http://0.0.0.0
|
||||
|
||||
The URL to go to PhpMyAdmin is (login/password is root/root) :
|
||||
|
||||
http://0.0.0.0:8080
|
||||
25
build/docker/docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: dolibarr
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
environment:
|
||||
PMA_HOST: mariadb
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "8080:80"
|
||||
|
||||
web:
|
||||
build: .
|
||||
environment:
|
||||
HOST_USER_ID: $HOST_USER_ID
|
||||
volumes:
|
||||
- ../../htdocs:/var/www/html
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "80:80"
|
||||
15
build/docker/docker-run.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
usermod -u $HOST_USER_ID www-data
|
||||
groupmod -g $HOST_USER_ID www-data
|
||||
|
||||
chown -hR www-data:www-data /var/www
|
||||
|
||||
if [ ! -f /usr/local/etc/php/php.ini ]; then
|
||||
cat <<EOF > /usr/local/etc/php/php.ini
|
||||
date.timezone = $PHP_INI_DATE_TIMEZONE
|
||||
display_errors = On
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec apache2-foreground
|
||||
@ -1,8 +1,10 @@
|
||||
README (English)
|
||||
##################################################
|
||||
Install script for Virtualmin Pro
|
||||
Install script for Virtualmin Professional / GPL
|
||||
##################################################
|
||||
|
||||
This script will install automatically Dolibarr from Virtualmin Pro
|
||||
http://www.virtualmin.com
|
||||
This script will install automatically Dolibarr from Virtualmin.
|
||||
(Included in the professional version and can be added in the GPL version)
|
||||
|
||||
https://www.virtualmin.com
|
||||
http://www.webmin.com/virtualmin.html
|
||||
@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file dolibarr.pl
|
||||
# \brief Dolibarr script install for Virtualmin Pro
|
||||
# \author (c)2009-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
# \author (c)2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -30,7 +30,12 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" );
|
||||
return ( "5.0.4", "4.0.6", "3.9.4" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_release
|
||||
{
|
||||
return 2; # for mysqli fix
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
@ -177,9 +182,9 @@ if ($opts->{'newdb'} && !$upgrade) {
|
||||
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
|
||||
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
|
||||
local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
|
||||
local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" :
|
||||
local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" :
|
||||
$dbtype eq "mysql" ? "mysqli" : "pgsql";
|
||||
local $dbhost = &get_database_host($dbtype);
|
||||
local $dbhost = &get_database_host($dbtype, $d);
|
||||
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
|
||||
return (0, "Database connection failed : $dberr") if ($dberr);
|
||||
|
||||
@ -206,9 +211,6 @@ $pgcharset = $tmpl->{'postgres_encoding'};
|
||||
$charset = $dbtype eq "mysql" ? $mycharset : $pgcharset;
|
||||
$collate = $dbtype eq "mysql" ? $mycollate : "C";
|
||||
|
||||
# Install filename
|
||||
local $step = $version >= 3.8 ? "step" : "etape";
|
||||
|
||||
$path = &script_path_url($d, $opts);
|
||||
if ($path =~ /^https:/ || $d->{'ssl'}) {
|
||||
$url = "https://$d->{'dom'}";
|
||||
@ -222,15 +224,11 @@ if ($opts->{'path'} =~ /\w/) {
|
||||
|
||||
if (!$upgrade) {
|
||||
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
|
||||
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
|
||||
©_source_dest_as_domain_user($d, $cdef, $cfile);
|
||||
&set_permissions_as_domain_user($d, 0777, $cfiledir);
|
||||
&set_permissions_as_domain_user($d, 0666, $cfile);
|
||||
©_source_dest_as_domain_user($d, $cfile);
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
|
||||
&set_permissions_as_domain_user($d, 0777, $docdir);
|
||||
if (!$version >= 3.7.2) {
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
|
||||
&set_permissions_as_domain_user($d, 0777, $altdir);
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Preserve old config file, documents and custom directory
|
||||
@ -266,7 +264,8 @@ if ($upgrade) {
|
||||
[ "versionfrom", $upgrade->{'version'} ],
|
||||
[ "versionto", $ver ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory.
|
||||
@ -289,15 +288,17 @@ else {
|
||||
[ "main_force_https", $opts->{'forcehttps'} ],
|
||||
[ "dolibarr_main_db_character_set", $charset ],
|
||||
[ "dolibarr_main_db_collation", $collate ],
|
||||
[ "main_use_alt_dir", "1" ],
|
||||
[ "usealternaterootdir", "1" ],
|
||||
[ "main_alt_dir_name", "custom" ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step1" : "etape1";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Second page (Populate database)
|
||||
local @params = ( [ "action", "set" ] );
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step2" : "etape2";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Third page (Add administrator account)
|
||||
@ -306,7 +307,8 @@ else {
|
||||
[ "pass", $dompass ],
|
||||
[ "pass_verif", $dompass ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
|
||||
local $p = $ver >= 3.8 ? "step5" : "etape5";
|
||||
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory and protect config file.
|
||||
@ -384,7 +386,10 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
|
After Width: | Height: | Size: 223 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
|
After Width: | Height: | Size: 124 KiB |
@ -145,12 +145,12 @@ else if ($action == 'update') {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card");
|
||||
$helpurl = "";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewFiscalYear"));
|
||||
|
||||
@ -4,7 +4,7 @@ use Stripe\BankAccount;
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* 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-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* 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 Jean Heimburger <jean@tiaris.info>
|
||||
* 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-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* 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 Jean Heimburger <jean@tiaris.info>
|
||||
* 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-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* 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 Jean Heimburger <jean@tiaris.info>
|
||||
* 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-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
|
||||
@ -134,7 +134,7 @@ class AdherentType extends CommonObject
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = '".$this->db->escape($this->vote)."',";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
$sql.= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -252,7 +252,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " WHERE entity IN (".getEntity('adherent').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -114,7 +114,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans($company->error);
|
||||
setEventMessages($company->error, $company->errors, 'errors');
|
||||
}
|
||||
else
|
||||
@ -124,7 +123,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
||||
}
|
||||
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"]);
|
||||
}
|
||||
$subscription=$_POST["subscription"]; // Amount of subscription
|
||||
$subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
|
||||
$label=$_POST["label"];
|
||||
|
||||
// Payment informations
|
||||
@ -230,6 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
if (GETPOST('end') && ! $datesubend)
|
||||
@ -237,6 +237,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
if (! $datesubend)
|
||||
@ -247,16 +248,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$error++;
|
||||
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$action='addsubscription';
|
||||
}
|
||||
|
||||
$amount = price2num(GETPOST("subscription",'alpha'));
|
||||
|
||||
// Check if a payment is mandatory or not
|
||||
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
|
||||
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
$action='addsubscription';
|
||||
}
|
||||
@ -274,7 +279,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
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++;
|
||||
$errmsg=$db->lasterror();
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -327,14 +337,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
$error++;
|
||||
$errmsg=$acct->error;
|
||||
$errmsgs=$acct->errors;
|
||||
}
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errmsg=$acct->error;
|
||||
$errmsgs=$acct->errors;
|
||||
}
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// If option choosed, we create invoice
|
||||
@ -352,6 +364,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -362,6 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$customer->error;
|
||||
$errmsgs=$acct->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -379,6 +393,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$error++;
|
||||
$errmsg='ErrorNoPaymentTermRECEPFound';
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
$invoice->socid=$object->fk_soc;
|
||||
@ -396,6 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
$errmsgs=$invoice->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -416,6 +432,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
if ($result <= 0)
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -428,6 +445,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$invoice->error;
|
||||
$errmsgs=$invoice->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -455,6 +473,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
$errmsgs=$paiement->errors;
|
||||
setEventMessages($errmsg, $errmsgs, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -536,6 +555,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
if ($result < 0)
|
||||
{
|
||||
$errmsg=$object->error;
|
||||
setEventMessages($errmsg, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -131,12 +131,11 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -67,11 +67,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Agenda");
|
||||
|
||||
llxHeader('',$langs->trans("AgendaSetup"));
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
|
||||
@ -125,11 +125,11 @@ $formother=new FormOther($db);
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array();
|
||||
|
||||
llxHeader('',$langs->trans("AgendaSetup"),'','',0,0,$arrayofjs,$arrayofcss);
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('',$langs->trans("AgendaSetup"),$wikihelp,'',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
|
||||
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -210,7 +210,7 @@ while ($i <= $MAXAGENDA)
|
||||
$color='AGENDA_EXT_COLOR'.$key;
|
||||
$enabled='AGENDA_EXT_ENABLED'.$key;
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Nb
|
||||
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
|
||||
|
||||
@ -42,7 +42,7 @@ $action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$param = GETPOST('param','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type = 'action';
|
||||
|
||||
|
||||
@ -174,12 +174,12 @@ else if ($action == 'setdoc')
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader();
|
||||
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"),$wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
@ -273,7 +273,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<td align="center">'."\n";
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -389,37 +389,6 @@ $tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->tra
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA NOTIFICATION
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
255
htdocs/admin/agenda_reminder.php
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/agenda_reminder.php
|
||||
* \ingroup agenda
|
||||
* \brief Page to setup agenda reminder options
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("agenda");
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$param = GETPOST('param','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type = 'action';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
if ($action == 'set')
|
||||
{
|
||||
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else if ($action == 'specimen') // For orders
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db,$commande);
|
||||
|
||||
if ($module->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($module->error, $module->errors, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'setmodel')
|
||||
{
|
||||
//print "sssd".$value;
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->ACTION_EVENT_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* View
|
||||
*/
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader();
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// AGENDA REMINDER EMAIL
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// AGENDA REMINDER BROWSER
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input class="button" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -71,11 +71,11 @@ if ($actionsave)
|
||||
|
||||
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
|
||||
|
||||
llxHeader();
|
||||
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -21,15 +22,14 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -38,12 +38,12 @@ $langs->load("other");
|
||||
$langs->load("banks");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'bankaccount';
|
||||
|
||||
|
||||
@ -52,100 +52,109 @@ $type = 'bankaccount';
|
||||
*/
|
||||
|
||||
//Order display of bank account
|
||||
if ($action == 'setbankorder')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",GETPOST('value','alpha'),'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($action == 'setbankorder') {
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",
|
||||
GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
//Auto report last num releve on conciliate
|
||||
if ($action == 'setreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
elseif ($action == 'unsetreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
if ($modele == 'sepamandate')
|
||||
{
|
||||
if ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
if ($modele == 'sepamandate') {
|
||||
$object = new CompanyBankAccount($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$object = new Account($db);
|
||||
}
|
||||
$object->initAsSpecimen();
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php",
|
||||
0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_" . $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($object,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
|
||||
if ($module->write_file($object, $langs) > 0) {
|
||||
header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
if ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity);
|
||||
}
|
||||
else if ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->BANKADDON_PDF == "$value")
|
||||
dolibarr_del_const($db, 'BANKADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
else if ($action == 'setdoc') {
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '',
|
||||
$conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->BANKADDON_PDF = $value;
|
||||
}
|
||||
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
@ -156,80 +165,78 @@ else if ($action == 'setdoc')
|
||||
* view
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("",$langs->trans("BankSetupModule"));
|
||||
llxHeader("", $langs->trans("BankSetupModule"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback,
|
||||
'title_setup');
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account');
|
||||
|
||||
$var=true;
|
||||
$var = true;
|
||||
|
||||
$var=! $var;
|
||||
$var = !$var;
|
||||
|
||||
//Show bank account order
|
||||
print load_fiche_titre($langs->trans("BankOrderShow"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td width="140">' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td>' . $langs->trans("Example") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Status") . '</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0]=$langs->trans("BankOrderES");
|
||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
$bankorder[0][0] = $langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1] = $langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2] = 'BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0] = $langs->trans("BankOrderES");
|
||||
$bankorder[1][1] = $langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2] = 'BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$nbofbank=count($bankorder);
|
||||
while ($i < $nbofbank)
|
||||
{
|
||||
$var = !$var;
|
||||
$nbofbank = count($bankorder);
|
||||
while ($i < $nbofbank) {
|
||||
$var = !$var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$bankorder[$i][0]."</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray=explode(' ',$bankorder[$i][2]);
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
if ($key > 0) print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $bankorder[$i][0] . "</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray = explode(' ', $bankorder[$i][2]);
|
||||
foreach ($tmparray as $key => $val) {
|
||||
if ($key > 0)
|
||||
print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"),'on');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&value='.$i.'">';
|
||||
print img_picto($langs->trans("Disabled"),'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"), 'on');
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center"><a href="' . $_SERVER['PHP_SELF'] . '?action=setbankorder&value=' . $i . '">';
|
||||
print img_picto($langs->trans("Disabled"), 'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>' . "\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</table>' . "\n";
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
@ -257,7 +264,8 @@ if ($resql) {
|
||||
array_push($def, $array[0]);
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -273,11 +281,10 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$dir = dol_buildpath($reldir . "core/modules/bank" . $valdir);
|
||||
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
@ -286,23 +293,26 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/',
|
||||
$file)) {
|
||||
|
||||
if (file_exists($dir . '/' . $file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
|
||||
require_once $dir . '/' . $file;
|
||||
$module = new $classname($db);
|
||||
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 2)
|
||||
$modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 1)
|
||||
$modulequalified = 0;
|
||||
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
@ -312,29 +322,35 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
print $module->description;
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print img_picto($langs->trans("Enabled"),
|
||||
'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scandir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
||||
// Default
|
||||
print '<td align="center">';
|
||||
if ($conf->global->BANKADDON_PDF == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scandir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
print img_picto($langs->trans("Default"),
|
||||
'on');
|
||||
}
|
||||
else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
|
||||
'off') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Info
|
||||
$htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
|
||||
$htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
@ -342,27 +358,33 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo,
|
||||
1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang,
|
||||
1, 1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print $form->textwithpicto('', $htmltooltip, 1,
|
||||
0);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
|
||||
} else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"),
|
||||
'bill') . '</a>';
|
||||
}
|
||||
else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"),
|
||||
'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -372,9 +394,51 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
//}
|
||||
|
||||
|
||||
|
||||
print '<br /><br />';
|
||||
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', '');
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="center" width="60">' . $langs->trans("Status") . "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print $langs->trans('AccountStatement');
|
||||
print "</td><td>\n";
|
||||
print $langs->trans('AutoReportLastAccountStatement');
|
||||
print '</td>';
|
||||
// Active
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=unsetreportlastnumreleve">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -190,7 +190,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type = 'order';
|
||||
|
||||
|
||||
@ -464,7 +464,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ if (!$user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='contract';
|
||||
|
||||
if (empty($conf->global->CONTRACT_ADDON))
|
||||
@ -397,7 +397,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
67
htdocs/admin/dolistore/ajax/image.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
|
||||
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
|
||||
* it under the terms of the GNU General Public License as published bypliance with the License.
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/commande/info.php
|
||||
* \ingroup commande
|
||||
* \brief Page des informations d'une commande
|
||||
*/
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include("../main.inc.php");
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include("../../main.inc.php");
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include("../../../main.inc.php");
|
||||
if (!$res && file_exists("../../../../main.inc.php")) $res = @include("../../../../main.inc.php");
|
||||
if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php"))
|
||||
$res = @include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
|
||||
if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php"))
|
||||
$res = @include("../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
|
||||
if (!$res && file_exists("../../../../../dolibarr/htdocs/main.inc.php"))
|
||||
$res = @include("../../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
// CORE
|
||||
|
||||
global $lang, $user, $conf;
|
||||
|
||||
|
||||
dol_include_once('/dolistore/class/dolistore.class.php');
|
||||
$dolistore = new Dolistore();
|
||||
|
||||
$id_product = GETPOST('id_product', 'int');
|
||||
$id_image = GETPOST('id_image', 'int');
|
||||
// quality : image resize with this in the URL : "cart_default", "home_default", "large_default", "medium_default", "small_default", "thickbox_default"
|
||||
$quality = GETPOST('quality', 'alpha');
|
||||
|
||||
try {
|
||||
$url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality;
|
||||
$api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api);
|
||||
//echo $url;
|
||||
$request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
|
||||
header('Content-type:image');
|
||||
print $request['response'];
|
||||
} catch (PrestaShopWebserviceException $e) {
|
||||
// Here we are dealing with errors
|
||||
$trace = $e->getTrace();
|
||||
if ($trace[0]['args'][0] == 404) die('Bad ID');
|
||||
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
||||
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||
}
|
||||
413
htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php
Normal file
@ -0,0 +1,413 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* PrestaShop Webservice Library
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
class PrestaShopWebservice
|
||||
{
|
||||
|
||||
/** @var string Shop URL */
|
||||
protected $url;
|
||||
|
||||
/** @var string Authentification key */
|
||||
protected $key;
|
||||
|
||||
/** @var boolean is debug activated */
|
||||
protected $debug;
|
||||
|
||||
/** @var string PS version */
|
||||
protected $version;
|
||||
|
||||
/** @var array compatible versions of PrestaShop Webservice */
|
||||
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
||||
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
|
||||
|
||||
/**
|
||||
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* // Now we have a webservice object to play with
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
* @param string $url Root URL for the shop
|
||||
* @param string $key Authentification key
|
||||
* @param mixed $debug Debug mode Activated (true) or deactivated (false)
|
||||
*/
|
||||
function __construct($url, $key, $debug = true) {
|
||||
if (!extension_loaded('curl'))
|
||||
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
|
||||
$this->url = $url;
|
||||
$this->key = $key;
|
||||
$this->debug = $debug;
|
||||
$this->version = 'unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the status code and throw an exception if the server didn't return 200 or 201 code
|
||||
* @param int $status_code Status code of an HTTP return
|
||||
*/
|
||||
protected function checkStatusCode($status_code)
|
||||
{
|
||||
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
|
||||
switch($status_code)
|
||||
{
|
||||
case 200: case 201: break;
|
||||
case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break;
|
||||
case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break;
|
||||
case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break;
|
||||
case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break;
|
||||
case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break;
|
||||
case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break;
|
||||
default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
|
||||
* @param string $url Resource name
|
||||
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
|
||||
* @return array status_code, response
|
||||
*/
|
||||
public function executeRequest($url, $curl_params = array())
|
||||
{
|
||||
$defaultParams = array(
|
||||
CURLOPT_HEADER => TRUE,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLINFO_HEADER_OUT => TRUE,
|
||||
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
|
||||
CURLOPT_USERPWD => $this->key.':',
|
||||
CURLOPT_HTTPHEADER => array( 'Expect:' )
|
||||
);
|
||||
|
||||
$session = curl_init($url);
|
||||
|
||||
$curl_options = array();
|
||||
foreach ($defaultParams as $defkey => $defval)
|
||||
{
|
||||
if (isset($curl_params[$defkey]))
|
||||
$curl_options[$defkey] = $curl_params[$defkey];
|
||||
else
|
||||
$curl_options[$defkey] = $defaultParams[$defkey];
|
||||
}
|
||||
foreach ($curl_params as $defkey => $defval)
|
||||
if (!isset($curl_options[$defkey]))
|
||||
$curl_options[$defkey] = $curl_params[$defkey];
|
||||
|
||||
curl_setopt_array($session, $curl_options);
|
||||
$response = curl_exec($session);
|
||||
|
||||
$index = strpos($response, "\r\n\r\n");
|
||||
if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD')
|
||||
throw new PrestaShopWebserviceException('Bad HTTP response');
|
||||
|
||||
$header = substr($response, 0, $index);
|
||||
$body = substr($response, $index + 4);
|
||||
|
||||
$headerArrayTmp = explode("\n", $header);
|
||||
|
||||
$headerArray = array();
|
||||
foreach ($headerArrayTmp as &$headerItem)
|
||||
{
|
||||
$tmp = explode(':', $headerItem);
|
||||
$tmp = array_map('trim', $tmp);
|
||||
if (count($tmp) == 2)
|
||||
$headerArray[$tmp[0]] = $tmp[1];
|
||||
}
|
||||
|
||||
if (array_key_exists('PSWS-Version', $headerArray))
|
||||
{
|
||||
$this->version = $headerArray['PSWS-Version'];
|
||||
if (
|
||||
version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMIN, $headerArray['PSWS-Version']) == 1 ||
|
||||
version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMAX, $headerArray['PSWS-Version']) == -1
|
||||
)
|
||||
throw new PrestaShopWebserviceException('This library is not compatible with this version of PrestaShop. Please upgrade/downgrade this library');
|
||||
}
|
||||
|
||||
if ($this->debug)
|
||||
{
|
||||
$this->printDebug('HTTP REQUEST HEADER', curl_getinfo($session, CURLINFO_HEADER_OUT));
|
||||
$this->printDebug('HTTP RESPONSE HEADER', $header);
|
||||
|
||||
}
|
||||
$status_code = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
if ($status_code === 0)
|
||||
throw new PrestaShopWebserviceException('CURL Error: '.curl_error($session));
|
||||
curl_close($session);
|
||||
if ($this->debug)
|
||||
{
|
||||
if ($curl_params[CURLOPT_CUSTOMREQUEST] == 'PUT' || $curl_params[CURLOPT_CUSTOMREQUEST] == 'POST')
|
||||
$this->printDebug('XML SENT', urldecode($curl_params[CURLOPT_POSTFIELDS]));
|
||||
if ($curl_params[CURLOPT_CUSTOMREQUEST] != 'DELETE' && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD')
|
||||
$this->printDebug('RETURN HTTP BODY', $body);
|
||||
}
|
||||
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
|
||||
}
|
||||
|
||||
public function printDebug($title, $content)
|
||||
{
|
||||
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
|
||||
}
|
||||
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load XML from string. Can throw exception
|
||||
* @param string $response String from a CURL response
|
||||
* @return SimpleXMLElement status_code, response
|
||||
*/
|
||||
protected function parseXML($response)
|
||||
{
|
||||
if ($response != '')
|
||||
{
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors(true);
|
||||
$xml = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
if (libxml_get_errors())
|
||||
{
|
||||
$msg = var_export(libxml_get_errors(), true);
|
||||
libxml_clear_errors();
|
||||
throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg);
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
else
|
||||
throw new PrestaShopWebserviceException('HTTP response is empty');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add (POST) a resource
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
* 'resource' => Resource name<br>
|
||||
* 'postXml' => Full XML string to add resource<br><br>
|
||||
* Examples are given in the tutorial</p>
|
||||
*
|
||||
* @param array $options Options
|
||||
* @return SimpleXMLElement status_code, response
|
||||
*/
|
||||
public function add($options)
|
||||
{
|
||||
$xml = '';
|
||||
|
||||
if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml']))
|
||||
{
|
||||
$url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']);
|
||||
$xml = $options['postXml'];
|
||||
if (isset($options['id_shop']))
|
||||
$url .= '&id_shop='.$options['id_shop'];
|
||||
if (isset($options['id_group_shop']))
|
||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
||||
}
|
||||
else
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
|
||||
|
||||
self::checkStatusCode($request['status_code']);
|
||||
return self::parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve (GET) a resource
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
* 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<br>
|
||||
* OR<br>
|
||||
* 'resource' => Resource name,<br>
|
||||
* 'id' => ID of a resource you want to get<br><br>
|
||||
* </p>
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||
* foreach ($xml->children()->children() as $attName => $attValue)
|
||||
* echo $attName.' = '.$attValue.'<br />';
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
* @param array $options Array representing resource to get.
|
||||
* @return SimpleXMLElement status_code, response
|
||||
*/
|
||||
public function get($options)
|
||||
{
|
||||
if (isset($options['url']))
|
||||
$url = $options['url'];
|
||||
elseif (isset($options['resource']))
|
||||
{
|
||||
$url = $this->url.'/api/'.$options['resource'];
|
||||
$url_params = array();
|
||||
if (isset($options['id']))
|
||||
$url .= '/'.$options['id'];
|
||||
|
||||
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
|
||||
foreach ($params as $p)
|
||||
foreach ($options as $k => $o)
|
||||
if (strpos($k, $p) !== false)
|
||||
$url_params[$k] = $options[$k];
|
||||
if (count($url_params) > 0)
|
||||
$url .= '?'.http_build_query($url_params);
|
||||
}
|
||||
else
|
||||
throw new PrestaShopWebserviceException('Bad parameters given ');
|
||||
|
||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
|
||||
self::checkStatusCode($request['status_code']);// check the response validity
|
||||
return self::parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Head method (HEAD) a resource
|
||||
*
|
||||
* @param array $options Array representing resource for head request.
|
||||
* @return SimpleXMLElement status_code, response
|
||||
*/
|
||||
public function head($options)
|
||||
{
|
||||
if (isset($options['url']))
|
||||
$url = $options['url'];
|
||||
elseif (isset($options['resource']))
|
||||
{
|
||||
$url = $this->url.'/api/'.$options['resource'];
|
||||
$url_params = array();
|
||||
if (isset($options['id']))
|
||||
$url .= '/'.$options['id'];
|
||||
|
||||
$params = array('filter', 'display', 'sort', 'limit');
|
||||
foreach ($params as $p)
|
||||
foreach ($options as $k => $o)
|
||||
if (strpos($k, $p) !== false)
|
||||
$url_params[$k] = $options[$k];
|
||||
if (count($url_params) > 0)
|
||||
$url .= '?'.http_build_query($url_params);
|
||||
}
|
||||
else
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
|
||||
self::checkStatusCode($request['status_code']);// check the response validity
|
||||
return $request['header'];
|
||||
}
|
||||
/**
|
||||
* Edit (PUT) a resource
|
||||
* <p>Unique parameter must take : <br><br>
|
||||
* 'resource' => Resource name ,<br>
|
||||
* 'id' => ID of a resource you want to edit,<br>
|
||||
* 'putXml' => Modified XML string of a resource<br><br>
|
||||
* Examples are given in the tutorial</p>
|
||||
* @param array $options Array representing resource to edit.
|
||||
*/
|
||||
public function edit($options)
|
||||
{
|
||||
$xml = '';
|
||||
if (isset($options['url']))
|
||||
$url = $options['url'];
|
||||
elseif ((isset($options['resource'], $options['id']) || isset($options['url'])) && $options['putXml'])
|
||||
{
|
||||
$url = (isset($options['url']) ? $options['url'] : $this->url.'/api/'.$options['resource'].'/'.$options['id']);
|
||||
$xml = $options['putXml'];
|
||||
if (isset($options['id_shop']))
|
||||
$url .= '&id_shop='.$options['id_shop'];
|
||||
if (isset($options['id_group_shop']))
|
||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
||||
}
|
||||
else
|
||||
throw new PrestaShopWebserviceException('Bad parameters given');
|
||||
|
||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
|
||||
self::checkStatusCode($request['status_code']);// check the response validity
|
||||
return self::parseXML($request['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete (DELETE) a resource.
|
||||
* Unique parameter must take : <br><br>
|
||||
* 'resource' => Resource name<br>
|
||||
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once('./PrestaShopWebservice.php');
|
||||
* try
|
||||
* {
|
||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
||||
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
|
||||
* // Following code will not be executed if an exception is thrown.
|
||||
* echo 'Successfully deleted.';
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
* echo 'Error : '.$ex->getMessage();
|
||||
* }
|
||||
* ?>
|
||||
* </code>
|
||||
* @param array $options Array representing resource to delete.
|
||||
*/
|
||||
public function delete($options)
|
||||
{
|
||||
if (isset($options['url']))
|
||||
$url = $options['url'];
|
||||
elseif (isset($options['resource']) && isset($options['id']))
|
||||
if (is_array($options['id']))
|
||||
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
|
||||
else
|
||||
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
|
||||
if (isset($options['id_shop']))
|
||||
$url .= '&id_shop='.$options['id_shop'];
|
||||
if (isset($options['id_group_shop']))
|
||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
|
||||
self::checkStatusCode($request['status_code']);// check the response validity
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
class PrestaShopWebserviceException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
316
htdocs/admin/dolistore/class/dolistore.class.php
Normal file
@ -0,0 +1,316 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
|
||||
* it under the terms of the GNU General Public License as published bypliance with the License.
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
|
||||
/**
|
||||
* Class DolistoreModel
|
||||
*/
|
||||
class Dolistore extends DolistoreModel
|
||||
{
|
||||
// params
|
||||
public $start // beginning of pagination
|
||||
, $end // end of pagination
|
||||
, $per_page // pagination: display per page
|
||||
, $categorie // the current categorie
|
||||
, $search // the search keywords
|
||||
// setups
|
||||
, $url // the url of this page
|
||||
, $shop_url // the url of the shop
|
||||
, $vat_rate // the vat rate used in the shop (prices are provided without vat)
|
||||
, $lang // the integer representing the lang in the store
|
||||
, $debug_api; // usefull if no dialog
|
||||
|
||||
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->start = $options['start'];
|
||||
$this->end = $options['end'];
|
||||
$this->per_page = $options['per_page'];
|
||||
$this->categorie = $options['categorie'];
|
||||
$this->search = $options['search'];
|
||||
|
||||
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
||||
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
||||
$this->vat_rate = 1.2; // 20% de TVA
|
||||
$this->debug_api = false;
|
||||
|
||||
if ($this->end == 0) {
|
||||
$this->end = $this->per_page;
|
||||
}
|
||||
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
|
||||
|
||||
try {
|
||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||
|
||||
// Here we set the option array for the Webservice : we want products resources
|
||||
$opt = array();
|
||||
$opt['resource'] = 'products';
|
||||
// make a search to limit the id returned.
|
||||
if ($this->search != '') {
|
||||
$opt2 = array();
|
||||
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
|
||||
// Call
|
||||
$xml = $this->api->get($opt2);
|
||||
$products = array();
|
||||
foreach ($xml->products->children() as $product) {
|
||||
$products[] = (int) $product['id'];
|
||||
}
|
||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||
} elseif ($this->categorie != 0) {
|
||||
$opt2 = array();
|
||||
$opt2['resource'] = 'categories';
|
||||
$opt2['id'] = $this->categorie;
|
||||
// Call
|
||||
$xml = $this->api->get($opt2);
|
||||
$products = array();
|
||||
foreach ($xml->category->associations->products->children() as $product) {
|
||||
$products[] = (int) $product->id;
|
||||
}
|
||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||
}
|
||||
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
|
||||
$opt['sort'] = 'id_desc';
|
||||
$opt['filter[active]'] = '[1]';
|
||||
$opt['limit'] = "$this->start,$this->end";
|
||||
// Call
|
||||
$xml = $this->api->get($opt);
|
||||
$this->products = $xml->products->children();
|
||||
|
||||
|
||||
// Here we set the option array for the Webservice : we want categories resources
|
||||
$opt = array();
|
||||
$opt['resource'] = 'categories';
|
||||
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
|
||||
$opt['sort'] = 'id_asc';
|
||||
// Call
|
||||
$xml = $this->api->get($opt);
|
||||
$this->categories = $xml->categories->children();
|
||||
} catch (PrestaShopWebserviceException $e) {
|
||||
// Here we are dealing with errors
|
||||
$trace = $e->getTrace();
|
||||
if ($trace[0]['args'][0] == 404) die('Bad ID');
|
||||
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
||||
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||
}
|
||||
}
|
||||
|
||||
function get_previous_url()
|
||||
{
|
||||
$param_array = array();
|
||||
if ($this->start < $this->per_page) {
|
||||
$sub = 0;
|
||||
} else {
|
||||
$sub = $this->per_page;
|
||||
}
|
||||
$param_array['start'] = $this->start - $sub;
|
||||
$param_array['end'] = $this->end - $sub;
|
||||
if ($this->categorie != 0) {
|
||||
$param_array['categorie'] = $this->categorie;
|
||||
}
|
||||
$param = http_build_query($param_array);
|
||||
return $this->url."&".$param;
|
||||
}
|
||||
|
||||
function get_next_url()
|
||||
{
|
||||
$param_array = array();
|
||||
if (count($this->products) < $this->per_page) {
|
||||
$add = 0;
|
||||
} else {
|
||||
$add = $this->per_page;
|
||||
}
|
||||
$param_array['start'] = $this->start + $add;
|
||||
$param_array['end'] = $this->end + $add;
|
||||
if ($this->categorie != 0) {
|
||||
$param_array['categorie'] = $this->categorie;
|
||||
}
|
||||
$param = http_build_query($param_array);
|
||||
return $this->url."&".$param;
|
||||
}
|
||||
|
||||
function version_compare($v1, $v2)
|
||||
{
|
||||
$v1 = explode('.', $v1);
|
||||
$v2 = explode('.', $v2);
|
||||
$ret = 0;
|
||||
$level = 0;
|
||||
$count1 = count($v1);
|
||||
$count2 = count($v2);
|
||||
$maxcount = max($count1, $count2);
|
||||
while ($level < $maxcount) {
|
||||
$operande1 = isset($v1[$level]) ? $v1[$level] : 'x';
|
||||
$operande2 = isset($v2[$level]) ? $v2[$level] : 'x';
|
||||
$level++;
|
||||
if (strtoupper($operande1) == 'X' || strtoupper($operande2) == 'X' || $operande1 == '*' || $operande2 == '*') {
|
||||
break;
|
||||
}
|
||||
if ($operande1 < $operande2) {
|
||||
$ret = -$level;
|
||||
break;
|
||||
}
|
||||
if ($operande1 > $operande2) {
|
||||
$ret = $level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class DolistoreModel
|
||||
*/
|
||||
class DolistoreModel
|
||||
{
|
||||
|
||||
function get_categories($parent = 0)
|
||||
{
|
||||
if (!isset($this->categories)) die('not possible');
|
||||
if ($parent != 0) {
|
||||
$html = '<ul>';
|
||||
} else {
|
||||
$html = '';
|
||||
}
|
||||
|
||||
$nbofcateg = count($this->categories);
|
||||
for ($i = 0; $i < $nbofcateg; $i++)
|
||||
{
|
||||
$cat = $this->categories[$i];
|
||||
if ($cat->is_root_category == 1 && $parent == 0) {
|
||||
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
|
||||
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
|
||||
$select = ($cat->id == $this->categorie) ? ' selected' : '';
|
||||
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
|
||||
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($html == '<ul>') {
|
||||
return '';
|
||||
}
|
||||
if ($parent != 0) {
|
||||
return $html.'</ul>';
|
||||
} else {
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
function get_products()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$html = "";
|
||||
$parity = "pair";
|
||||
$last_month = time() - (30 * 24 * 60 * 60);
|
||||
foreach ($this->products as $product) {
|
||||
$parity = ($parity == "impair") ? 'pair' : 'impair';
|
||||
|
||||
// check new product ?
|
||||
$newapp = '';
|
||||
if ($last_month < strtotime($product->date_add)) {
|
||||
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
|
||||
}
|
||||
|
||||
// check updated ?
|
||||
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
|
||||
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
|
||||
}
|
||||
|
||||
// add image or default ?
|
||||
if ($product->id_default_image != '') {
|
||||
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
|
||||
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
||||
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||
} else {
|
||||
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
|
||||
}
|
||||
|
||||
// free or pay ?
|
||||
if ($product->price > 0) {
|
||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
|
||||
2).'" /></a>';
|
||||
} else {
|
||||
$price = $langs->trans('Free');
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
|
||||
2).'" /></a>';
|
||||
}
|
||||
|
||||
//checking versions
|
||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||
//compatible
|
||||
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = '';
|
||||
} else {
|
||||
//never compatible, module expired
|
||||
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
} else {
|
||||
//need update
|
||||
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
|
||||
//output template
|
||||
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
||||
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
|
||||
.'<br/><small>'.$version.'</small></h2>
|
||||
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
||||
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
||||
<td class="margeCote" align="right">'.$price.'</td>
|
||||
<td class="margeCote">'.$download_link.'</td>
|
||||
</tr>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function get_previous_link($text = '<<')
|
||||
{
|
||||
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
|
||||
function get_next_link($text = '>>')
|
||||
{
|
||||
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
}
|
||||
72
htdocs/admin/dolistore/class/init.php
Normal file
@ -0,0 +1,72 @@
|
||||
<html><head><title>CRUD Tutorial - Customer's list</title></head><body>
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
* PrestaShop Webservice Library
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
// Here we define constants /!\ You need to replace this parameters
|
||||
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
|
||||
define('DEBUG', true); // Debug mode
|
||||
define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store
|
||||
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
|
||||
require_once('./PSWebServiceLibrary.php');
|
||||
// Here we make the WebService Call
|
||||
try
|
||||
{
|
||||
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
|
||||
|
||||
// Here we set the option array for the Webservice : we want customers resources
|
||||
$opt['resource'] = 'categories';
|
||||
$opt['id'] = '1';
|
||||
|
||||
// Call
|
||||
$xml = $webService->get($opt);
|
||||
// Here we get the elements from children of customers markup "customer"
|
||||
$resources = $xml->categories->children();
|
||||
}
|
||||
catch (PrestaShopWebserviceException $e)
|
||||
{
|
||||
// Here we are dealing with errors
|
||||
$trace = $e->getTrace();
|
||||
if ($trace[0]['args'][0] == 404) echo 'Bad ID';
|
||||
else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
|
||||
else echo 'Other error';
|
||||
}
|
||||
// We set the Title
|
||||
echo "<h1>Categories's List</h1>";
|
||||
echo '<table border="5">';
|
||||
// if $resources is set we can lists element in it otherwise do nothing cause there's an error
|
||||
if (isset($resources))
|
||||
{
|
||||
echo '<tr><th>Id</th></tr>';
|
||||
foreach ($resources as $resource)
|
||||
{
|
||||
// Iterates on the found IDs
|
||||
echo '<tr><td>'.$resource->attributes().'</td></tr>';
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
?>
|
||||
</body></html>
|
||||
234
htdocs/admin/dolistore/css/dolistore.css
Normal file
@ -0,0 +1,234 @@
|
||||
|
||||
div.divsearchfield {
|
||||
float: left;
|
||||
margin: 4px 12px 4px 2px;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
.margeCoteGauche,.margeCote{
|
||||
padding-right: 20px!important;
|
||||
}
|
||||
.margeCote,.margeCoteDroite{
|
||||
padding-left: 20px!important;
|
||||
}
|
||||
.nomargesupinf{
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
#category-tree-left{
|
||||
display: none;
|
||||
vertical-align: top;
|
||||
width: 24%;
|
||||
}
|
||||
#listing-content{
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
}
|
||||
.tree{
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding:0px;
|
||||
list-style: none; line-height: 2em; font-family: Arial;
|
||||
}
|
||||
.tree li{
|
||||
font-size: 16px;
|
||||
position: relative;list-style: none;
|
||||
}
|
||||
.tree li:before{
|
||||
position: absolute;
|
||||
left: -15px;
|
||||
top: -4px;
|
||||
content: '';
|
||||
display: block;
|
||||
border-left: 1px solid #ddd;
|
||||
height: 1em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
width: 10px;
|
||||
}
|
||||
.tree li:after{
|
||||
position: absolute;
|
||||
left: -15px;
|
||||
bottom: -7px;
|
||||
content: '';
|
||||
display: block;
|
||||
border-left: 1px solid #ddd;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tree li.root{
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
.tree li.root:before{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tree li.root:after{
|
||||
display: none;
|
||||
}
|
||||
.tree li:last-child:after{
|
||||
display: none
|
||||
}
|
||||
.blockUI {
|
||||
cursor: auto!important;
|
||||
}
|
||||
.newAppParent{
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
min-height: 100px;
|
||||
}
|
||||
.newApp, .updatedApp{
|
||||
background-color: orange;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
|
||||
box-sizing: border-box;
|
||||
color: white;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
left: -34px;
|
||||
padding: 5px 0;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
text-shadow: 0 0 5px rgba(0, 0, 0, 0.35);
|
||||
top: 22px;
|
||||
transform: rotate(-45deg);
|
||||
width: 150px;
|
||||
}
|
||||
.updatedApp{
|
||||
background-color: greenyellow;
|
||||
}
|
||||
.notcompatible {
|
||||
color: red;
|
||||
}
|
||||
.compatibleafterupdate {
|
||||
color: orange;
|
||||
}
|
||||
.compatible {
|
||||
background-image: url("../img/compatible.png");
|
||||
background-position: left center;
|
||||
background-repeat: no-repeat;
|
||||
color: green;
|
||||
display: inline-block;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-left: 35px;
|
||||
}
|
||||
tr.app {
|
||||
height:250px;
|
||||
}
|
||||
|
||||
div#newsDoli.tabBar {
|
||||
margin-top: 50px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
.selected {
|
||||
text-decoration: underline!important;
|
||||
}
|
||||
.searchDolistore, .searchDolistore:hover {
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.searchDolistore:hover {
|
||||
text-decoration: underline!important;
|
||||
}
|
||||
|
||||
.score{
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.formReviewArea{
|
||||
display:none;
|
||||
}
|
||||
.formReview div.divsearchfield{
|
||||
float: none;
|
||||
}
|
||||
.input100{
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
.input50{
|
||||
box-sizing: border-box;
|
||||
width: 49%;
|
||||
}
|
||||
textarea.row4{
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
|
||||
.reviewList {
|
||||
max-height: 150px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.reviewRow{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.reviewRow .reviewMarge {
|
||||
float:left;
|
||||
width: 220px;
|
||||
padding: 0 20px 20px 0;
|
||||
}
|
||||
.reviewRow .score {
|
||||
font-size: 48px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.reviewRow .reviewDate {
|
||||
color:grey;
|
||||
}
|
||||
.reviewRow:after{
|
||||
clear: both;
|
||||
content:'';
|
||||
display: block;
|
||||
}
|
||||
h2.appTitle small{
|
||||
font-weight: normal;
|
||||
}
|
||||
tr.NotCompatible{
|
||||
/* IE 8 */
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=25)";
|
||||
|
||||
/* IE 5-7 */
|
||||
filter: alpha(opacity=25);
|
||||
|
||||
/* Netscape */
|
||||
-moz-opacity: 0.25;
|
||||
|
||||
/* Safari 1.x */
|
||||
-khtml-opacity: 0.25;
|
||||
|
||||
/* Good browsers */
|
||||
opacity: 0.25;
|
||||
}
|
||||
tr.NotCompatible:hover{
|
||||
/* IE 8 */
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
||||
|
||||
/* IE 5-7 */
|
||||
filter: alpha(opacity=100);
|
||||
|
||||
/* Netscape */
|
||||
-moz-opacity: 1;
|
||||
|
||||
/* Safari 1.x */
|
||||
-khtml-opacity: 1;
|
||||
|
||||
/* Good browsers */
|
||||
opacity: 1;
|
||||
}
|
||||
@media only screen and (min-width: 1150px) {
|
||||
#categorieArea{
|
||||
display:none;
|
||||
}
|
||||
#category-tree-left{
|
||||
display:inline-block;
|
||||
}
|
||||
#listing-content{
|
||||
width: 75%;
|
||||
}
|
||||
}
|
||||
span.details{
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
vertical-align: super;
|
||||
}
|
||||
BIN
htdocs/admin/dolistore/img/Download-128.png
Normal file
|
After Width: | Height: | Size: 761 B |
BIN
htdocs/admin/dolistore/img/NoImageAvailable.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
htdocs/admin/dolistore/img/compatible.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
htdocs/admin/dolistore/img/dolistore.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
htdocs/admin/dolistore/img/follow.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
htdocs/admin/dolistore/img/object_dolistore.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
@ -45,7 +45,7 @@ if (! $user->admin)
|
||||
$action=GETPOST('action','alpha');
|
||||
$value=GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='shipping';
|
||||
|
||||
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||
@ -263,7 +263,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$file.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&value='.$file.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
@ -402,7 +402,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -440,7 +440,7 @@ foreach ($dirmodels as $reldir)
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -44,7 +44,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='expensereport';
|
||||
|
||||
|
||||
@ -400,7 +400,7 @@ foreach ($dirmodels as $reldir)
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
@ -408,7 +408,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='ficheinter';
|
||||
|
||||
|
||||
@ -431,7 +431,7 @@ foreach ($dirmodels as $reldir)
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -451,7 +451,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -495,7 +495,6 @@ print "<br>";
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
@ -101,25 +101,24 @@ if ($action == 'edit')
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
clearstatcache();
|
||||
$var=true;
|
||||
|
||||
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="oddeven"><td>';
|
||||
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 '<tr class="oddeven"><td>';
|
||||
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 '<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 $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>';
|
||||
@ -135,25 +134,23 @@ if ($action == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
$var=true;
|
||||
|
||||
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="oddeven"><td>';
|
||||
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 '<tr class="oddeven"><td>';
|
||||
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 '<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 $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
|
||||
print '</td><td align="right">'.$conf->global->MAIN_ROUNDING_RULE_TOT.'</td></tr>';
|
||||
|
||||
@ -44,7 +44,7 @@ if (!$user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='delivery';
|
||||
|
||||
|
||||
@ -385,7 +385,7 @@ foreach ($dirmodels as $reldir)
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
@ -393,7 +393,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S
|
||||
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);
|
||||
|
||||
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
|
||||
@ -127,6 +127,14 @@ $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';
|
||||
@ -238,7 +246,7 @@ if ($action == 'edit')
|
||||
$var=true;
|
||||
|
||||
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
|
||||
|
||||
@ -462,7 +470,7 @@ else
|
||||
$var=true;
|
||||
|
||||
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
|
||||
|
||||
|
||||
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("main");
|
||||
$langs->load("mails");
|
||||
$langs->load("languages");
|
||||
|
||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
@ -85,17 +86,17 @@ $tabsqlsort[25]="label ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$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';
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$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';
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$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';
|
||||
$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']"
|
||||
$elementList = array();
|
||||
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
||||
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
|
||||
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
|
||||
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
|
||||
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
|
||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
|
||||
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['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
|
||||
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
|
||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
|
||||
$parameters=array('elementList'=>$elementList);
|
||||
$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_lines') $value='content_lines-'.$rowid;
|
||||
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='') && $value != 'lang')
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
@ -253,15 +254,16 @@ if (empty($reshook))
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
$keycode=$listfieldvalue[$i];
|
||||
if ($value == 'lang') $keycode='langcode';
|
||||
|
||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
|
||||
if ($i) $sql.=",";
|
||||
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
|
||||
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
|
||||
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
|
||||
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
@ -301,15 +303,16 @@ if (empty($reshook))
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
$keycode=$listfieldvalue[$i];
|
||||
if ($field == 'lang') $keycode='langcode';
|
||||
|
||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||
if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$keycode])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
@ -410,6 +413,14 @@ $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';
|
||||
@ -426,16 +437,13 @@ if ($action == 'delete')
|
||||
//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.=" WHERE entity IN (".getEntity('email_template').")";
|
||||
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||
|
||||
if ($search_country_id > 0)
|
||||
if (empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " c.rowid = ".$search_country_id;
|
||||
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
|
||||
}
|
||||
|
||||
if ($sortfield)
|
||||
@ -461,21 +469,21 @@ $sql.=$db->plimit($listlimit+1,$offset);
|
||||
|
||||
$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
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
// Line for title
|
||||
//if ($action != 'edit')
|
||||
//{
|
||||
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">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
@ -585,12 +593,13 @@ if ($action != 'edit')
|
||||
|
||||
$colspan=count($fieldlist)+1;
|
||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
//}
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -691,6 +700,7 @@ if ($resql)
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
@ -724,15 +734,15 @@ if ($resql)
|
||||
// Show value for field
|
||||
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;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$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 '</td>';
|
||||
print '<td></td><td></td><td></td>';
|
||||
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||
$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 '</td>';
|
||||
print '<td></td><td></td><td></td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -756,12 +766,16 @@ if ($resql)
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
if ($value == 'lang' && $valuetoshow)
|
||||
{
|
||||
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
// Show value for field
|
||||
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')
|
||||
{
|
||||
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>';
|
||||
}
|
||||
// Le type de template
|
||||
elseif ($fieldlist[$field] == 'type_template')
|
||||
{
|
||||
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>';
|
||||
}
|
||||
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_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("admin");
|
||||
@ -371,18 +372,20 @@ if ($mode == 'feature')
|
||||
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
|
||||
else $text.=$langs->trans("None");
|
||||
|
||||
$text.='<br><br><br>';
|
||||
$text.='<br><br>';
|
||||
|
||||
$text.='<strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
$text.='<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
|
||||
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql'));
|
||||
if (count($sqlfiles) > 0)
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->tabs as $val)
|
||||
{
|
||||
$tmp=explode(':',$val,3);
|
||||
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
|
||||
$i++;
|
||||
}
|
||||
$text.=$langs->trans("Yes").' (';
|
||||
$i=0;
|
||||
foreach($sqlfiles as $val)
|
||||
{
|
||||
$text.=($i?', ':'').preg_replace('/\.sql$/','',preg_replace('/llx_/','',$val['name']));
|
||||
$i++;
|
||||
}
|
||||
$text.=')';
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
@ -402,13 +405,24 @@ if ($mode == 'feature')
|
||||
|
||||
$text.='<br>';
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
$text.='<br><strong>'.$langs->trans("AddData").':</strong> ';
|
||||
$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;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
@ -474,6 +488,20 @@ if ($mode == 'feature')
|
||||
|
||||
$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> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
|
||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
@ -46,6 +47,17 @@ $search_status=GETPOST('search_status','alpha');
|
||||
$search_nature=GETPOST('search_nature','alpha');
|
||||
$search_version=GETPOST('search_version','alpha');
|
||||
|
||||
|
||||
// For dolistore search
|
||||
$options = array();
|
||||
$options['per_page'] = 20;
|
||||
$options['categorie'] = GETPOST('categorie', 'int') + 0;
|
||||
$options['start'] = GETPOST('start', 'int') + 0;
|
||||
$options['end'] = GETPOST('end', 'int') + 0;
|
||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||
$dolistore = new Dolistore($options);
|
||||
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
@ -240,6 +252,11 @@ if ($action == 'reset' && $user->admin)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$morejs = array("/admin/dolistore/js/dolistore.js.php");
|
||||
$morecss = array("/admin/dolistore/css/dolistore.css");
|
||||
|
||||
// Set dir where external modules are installed
|
||||
if (! dol_is_dir($dirins))
|
||||
{
|
||||
@ -247,10 +264,8 @@ if (! dol_is_dir($dirins))
|
||||
}
|
||||
$dirins_ok=(dol_is_dir($dirins));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('',$langs->trans("Setup"),$help_url);
|
||||
llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0);
|
||||
|
||||
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
|
||||
$arrayofwarnings=array(); // Array of warning each module want to show when activated
|
||||
@ -423,24 +438,9 @@ print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
|
||||
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
|
||||
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
|
||||
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
|
||||
if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
|
||||
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common";
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace";
|
||||
$head[$h][1] = $langs->trans("ModulesMarketPlaces");
|
||||
$head[$h][2] = 'marketplace';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy";
|
||||
$head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther");
|
||||
$head[$h][2] = 'deploy';
|
||||
$h++;
|
||||
$head = modules_prepare_head();
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
@ -817,7 +817,6 @@ if ($mode == 'marketplace')
|
||||
print '<td>'.$langs->trans("URL").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
$url='https://www.dolistore.com';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
|
||||
@ -825,17 +824,57 @@ if ($mode == 'marketplace')
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
$url='https://partners.dolibarr.org';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
{
|
||||
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span>';
|
||||
|
||||
|
||||
?>
|
||||
<br><br>
|
||||
|
||||
<div class="tabBar">
|
||||
<form method="POST" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||
<input type="hidden" name="mode" value="marketplace" />
|
||||
<div class="divsearchfield"><?php echo $langs->trans('Mot-cle') ?>:
|
||||
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
||||
</div>
|
||||
<div class="divsearchfield">
|
||||
<input class="button butAction searchDolistore" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
||||
<a class="button butActionDelete" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Tout afficher') ?></a>
|
||||
</div><br><br><br style="clear: both">
|
||||
</form>
|
||||
</div>
|
||||
<div id="category-tree-left">
|
||||
<ul class="tree">
|
||||
<?php echo $dolistore->get_categories(); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="listing-content">
|
||||
<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">
|
||||
<thead>
|
||||
<tr class="liste_titre">
|
||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="listOfModules">
|
||||
<?php echo $dolistore->get_products($categorie); ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="liste_titre">
|
||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -952,6 +991,32 @@ if ($mode == 'deploy')
|
||||
|
||||
|
||||
|
||||
if ($mode == 'develop')
|
||||
{
|
||||
dol_fiche_head($head, $mode, '', -1);
|
||||
|
||||
// Marketplace
|
||||
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
//print '<td>'.$langs->trans("Logo").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
|
||||
print '<td>'.$langs->trans("URL").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
$url='https://partners.dolibarr.org';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='invoice';
|
||||
|
||||
if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php';
|
||||
@ -188,7 +188,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='propal';
|
||||
|
||||
/*
|
||||
@ -443,7 +443,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -103,6 +103,7 @@ else if ($action == 'delete')
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@ accessforbidden();
|
||||
$type=GETPOST('type', 'alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
|
||||
$specimenthirdparty=new Societe($db);
|
||||
$specimenthirdparty->initAsSpecimen();
|
||||
@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
|
||||
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
|
||||
//{
|
||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
/*}
|
||||
@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -421,11 +421,11 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
//print img_picto($langs->trans("Default"),'on');
|
||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ $type=GETPOST('type', 'alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
|
||||
$specimenthirdparty=new Societe($db);
|
||||
$specimenthirdparty->initAsSpecimen();
|
||||
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
|
||||
print '<td align="center">'."\n";
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print '<td align="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -445,7 +445,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='supplier_payment';
|
||||
|
||||
|
||||
@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ if (! $user->admin) accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='supplier_proposal';
|
||||
|
||||
$error=0;
|
||||
@ -423,7 +423,7 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -435,7 +435,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value]))
|
||||
if ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
@ -247,6 +247,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
$db->begin();
|
||||
|
||||
$website=new Website($db);
|
||||
$rowid=GETPOST('rowid','int');
|
||||
$website->fetch($rowid);
|
||||
@ -281,14 +283,41 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
||||
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
||||
@rename($srcfile, $destfile);
|
||||
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
||||
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
||||
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@rename($srcfile, $destfile);
|
||||
|
||||
// We must now rename $website->ref into $newname inside files
|
||||
$arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html');
|
||||
$listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$');
|
||||
foreach ($listofilestochange as $key => $value)
|
||||
{
|
||||
dolReplaceInFile($value['fullname'], $arrayreplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
|
||||
@ -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
|
||||
*/
|
||||
private $MAP_ID = array(
|
||||
'product' => 0,
|
||||
'supplier' => 1,
|
||||
'customer' => 2,
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'account' => 5,
|
||||
'project' => 6,
|
||||
'user' => 7,
|
||||
'product' => 0,
|
||||
'supplier' => 1,
|
||||
'customer' => 2,
|
||||
'member' => 3,
|
||||
'contact' => 4,
|
||||
'bank_account' => 5,
|
||||
'project' => 6,
|
||||
'user' => 7,
|
||||
'bank_line' => 8,
|
||||
);
|
||||
public static $MAP_ID_TO_CODE = array(
|
||||
0 => 'product',
|
||||
@ -77,9 +78,10 @@ class Categorie extends CommonObject
|
||||
2 => 'customer',
|
||||
3 => 'member',
|
||||
4 => 'contact',
|
||||
5 => 'account',
|
||||
5 => 'bank_account',
|
||||
6 => 'project',
|
||||
7 => 'user',
|
||||
8 => 'bank_line',
|
||||
);
|
||||
|
||||
/**
|
||||
@ -94,7 +96,8 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'account' => 'account', // old for bank_account
|
||||
'bank_account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
@ -109,7 +112,8 @@ class Categorie extends CommonObject
|
||||
'member' => 'member',
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'account' => 'account', // old for bank_account
|
||||
'bank_account'=> 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
@ -124,7 +128,8 @@ class Categorie extends CommonObject
|
||||
'member' => 'Adherent',
|
||||
'contact' => 'Contact',
|
||||
'user' => 'User',
|
||||
'account' => 'Account',
|
||||
'account' => 'Account', // old for bank account
|
||||
'bank_account' => 'Account',
|
||||
'project' => 'Project',
|
||||
);
|
||||
/**
|
||||
@ -947,8 +952,8 @@ class Categorie extends CommonObject
|
||||
* fulllabel = nom avec chemin complet de la categorie
|
||||
* fullpath = chemin complet compose des id
|
||||
*
|
||||
* @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 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.
|
||||
*
|
||||
* @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
|
||||
* Should be named getListOfCategForObject
|
||||
*
|
||||
* @param int $id Id of element
|
||||
* @param 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
|
||||
* labels, 'id'= Get array of category IDs
|
||||
* @return mixed Array of category objects or < 0 if KO
|
||||
* @param int $id Id of element
|
||||
* @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
|
||||
* labels, 'id'= Get array of category IDs
|
||||
* @return mixed Array of category objects or < 0 if KO
|
||||
*/
|
||||
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 ($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
|
||||
$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_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; }
|
||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||
|
||||
@ -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
|
||||
@ -709,7 +714,7 @@ if ($action == 'create')
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Assigned to
|
||||
@ -965,7 +970,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="minwidth100" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||
@ -1049,7 +1054,7 @@ if ($id > 0)
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$object->location.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.$object->location.'"></td></tr>';
|
||||
}
|
||||
|
||||
// Assigned to
|
||||
@ -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>';
|
||||
$linkback.=$out;
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
//$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;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
|
||||
$genallowed=$user->rights->agenda->myactions->create;
|
||||
$delallowed=$user->rights->agenda->myactions->delete;
|
||||
|
||||
@ -1509,9 +1509,19 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->output = '';
|
||||
$this->error='';
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL))
|
||||
{
|
||||
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ $action=GETPOST('action','aZ09');
|
||||
$search_lastname=GETPOST("search_lastname");
|
||||
$search_firstname=GETPOST("search_firstname");
|
||||
$search_email=GETPOST("search_email");
|
||||
$search_other=GETPOST("search_other");
|
||||
$search_dest_status=GETPOST('search_dest_status');
|
||||
|
||||
// Search modules dirs
|
||||
@ -90,8 +91,7 @@ if ($action == 'add')
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
// We fill $filtersarray. Using this variable is now deprecated.
|
||||
// Kept for backward compatibility.
|
||||
// We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
|
||||
$filtersarray=array();
|
||||
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_firstname='';
|
||||
$search_email='';
|
||||
$search_other='';
|
||||
$search_dest_status='';
|
||||
}
|
||||
|
||||
@ -303,12 +305,10 @@ if ($object->fetch($id) >= 0)
|
||||
if ($qualified)
|
||||
{
|
||||
$var = !$var;
|
||||
//print '<tr class="oddeven">';
|
||||
// print '<div '.$bctag[$var].'>';
|
||||
|
||||
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'].'">';
|
||||
}
|
||||
else
|
||||
@ -316,13 +316,11 @@ if ($object->fetch($id) >= 0)
|
||||
print '<div '.$bctag[$var].'>';
|
||||
}
|
||||
|
||||
//print '<td>';
|
||||
print '<div class="tagtd">';
|
||||
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 $obj->getDesc();
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
try {
|
||||
@ -333,7 +331,6 @@ if ($object->fetch($id) >= 0)
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
//print '<td align="center">';
|
||||
print '<div class="tagtd center">';
|
||||
if ($nbofrecipient >= 0)
|
||||
{
|
||||
@ -343,10 +340,8 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print $langs->trans("Error").' '.img_error($obj->error);
|
||||
}
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
//print '<td align="left">';
|
||||
print '<div class="tagtd" align="left">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
@ -360,10 +355,8 @@ if ($object->fetch($id) >= 0)
|
||||
if ($filter) print $filter;
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
//print '<td align="right">';
|
||||
print '<div class="tagtd" align="right">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
@ -375,19 +368,14 @@ if ($object->fetch($id) >= 0)
|
||||
//print $langs->trans("MailNoChangePossible");
|
||||
print " ";
|
||||
}
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
if ($allowaddtarget) print '</form>';
|
||||
else print '</div>';
|
||||
|
||||
//print "</tr>\n";
|
||||
// print '</div>'."\n";
|
||||
}
|
||||
}
|
||||
} // End foreach dir
|
||||
|
||||
//print '</table>';
|
||||
print '</div>';
|
||||
|
||||
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 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
||||
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
|
||||
if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search("mc.firstname", $search_firstname);
|
||||
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)." ";
|
||||
$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_firstname) $param.= "&search_firstname=".urlencode($search_firstname);
|
||||
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 '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -469,7 +459,7 @@ if ($object->fetch($id) >= 0)
|
||||
print '</td>';
|
||||
// Other
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).'">';
|
||||
print '</td>';
|
||||
// Source
|
||||
print '<td class="liste_titre">';
|
||||
|
||||
@ -605,7 +605,7 @@ if ($resql)
|
||||
// print '<td>';
|
||||
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
|
||||
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
|
||||
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
|
||||
print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
|
||||
print '</div>';
|
||||
if ($options) {
|
||||
print $langs->trans("EventualyAddCategory").': ';
|
||||
@ -649,6 +649,16 @@ if ($resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
/**
|
||||
* Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
|
||||
*/
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) {
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$("#num_releve").val("' . $last_releve . '");
|
||||
</script>
|
||||
';
|
||||
}
|
||||
print '<br><br>';
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
@ -1117,7 +1127,16 @@ if ($resql)
|
||||
// Date ope
|
||||
if (! empty($arrayfields['b.dateo']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do),"day")."</span>";
|
||||
print ' ';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
@ -560,11 +560,7 @@ else
|
||||
$_GET["id"]=$object->id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
|
||||
// Onglets
|
||||
// Show tabs
|
||||
$head=bank_prepare_head($object);
|
||||
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
|
||||
|
||||
@ -592,18 +588,6 @@ else
|
||||
|
||||
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
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td>'.$object->type_lib[$object->type].'</td></tr>';
|
||||
@ -616,26 +600,6 @@ else
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
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
|
||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||
print '<td>';
|
||||
@ -694,7 +658,7 @@ else
|
||||
// Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
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>";
|
||||
}
|
||||
|
||||
|
||||
@ -1959,6 +1959,67 @@ class AccountLine extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Increase/decrease operation date of a rowid
|
||||
*
|
||||
* @param int $rowid Id of line
|
||||
* @param int $sign 1 or -1
|
||||
* @return int >0 if OK, 0 if KO
|
||||
*/
|
||||
function dateo_change($rowid,$sign=1)
|
||||
{
|
||||
$sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$newdate=$this->db->jdate($obj->dateo)+(3600*24*$sign);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
|
||||
$sql.= " dateo = '".$this->db->idate($newdate)."'";
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->affected_rows($result))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase operation date of a rowid
|
||||
*
|
||||
* @param int $id Id of line to change
|
||||
* @return int >0 if OK, 0 if KO
|
||||
*/
|
||||
function dateo_next($id)
|
||||
{
|
||||
return $this->dateo_change($id,1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease operation date of a rowid
|
||||
*
|
||||
* @param int $id Id of line to change
|
||||
* @return int >0 if OK, 0 if KO
|
||||
*/
|
||||
function dateo_previous($id)
|
||||
{
|
||||
return $this->dateo_change($id,-1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load miscellaneous information for tab "Info"
|
||||
*
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* 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');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $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>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
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>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
$modulepart = 'bank';
|
||||
$permission = $user->rights->banque->modifier;
|
||||
$permtoedit = $user->rights->banque->modifier;
|
||||
|
||||
@ -492,21 +492,36 @@ foreach ($accounts as $key=>$type)
|
||||
// Account number
|
||||
if (! empty($arrayfields['b.account_number']['checked']))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$acc->account_number);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
|
||||
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$acc->account_number);
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $acc->account_number;
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($acc->fk_accountancy_journal);
|
||||
|
||||
print '<td>'.$accountingjournal->getNomUrl(0,1,1,'',1).'</td>';
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch('',$acc->fk_accountancy_journal);
|
||||
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
@ -71,13 +71,20 @@ if ($cancel)
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->banque->consolidate && $action == 'dvnext')
|
||||
|
||||
if ($user->rights->banque->consolidate && $action == 'donext')
|
||||
{
|
||||
$al = new AccountLine($db);
|
||||
$al->dateo_next($_GET["rowid"]);
|
||||
}elseif ($user->rights->banque->consolidate && $action == 'doprev')
|
||||
{
|
||||
$al = new AccountLine($db);
|
||||
$al->dateo_previous($_GET["rowid"]);
|
||||
}elseif ($user->rights->banque->consolidate && $action == 'dvnext')
|
||||
{
|
||||
$al = new AccountLine($db);
|
||||
$al->datev_next($_GET["rowid"]);
|
||||
}
|
||||
|
||||
if ($user->rights->banque->consolidate && $action == 'dvprev')
|
||||
}elseif ($user->rights->banque->consolidate && $action == 'dvprev')
|
||||
{
|
||||
$al = new AccountLine($db);
|
||||
$al->datev_previous($_GET["rowid"]);
|
||||
@ -479,6 +486,14 @@ if ($result)
|
||||
{
|
||||
print '<td>';
|
||||
print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro);
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=doprev&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=donext&id='.$id.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_add() ."</a>";
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -55,7 +55,7 @@ if ($action == 'add_confirm')
|
||||
|
||||
if (! $label)
|
||||
{
|
||||
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), null, 'errors');
|
||||
}
|
||||
if (! $amount)
|
||||
|
||||
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
@ -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();
|
||||
@ -664,12 +664,13 @@ if (empty($reshook))
|
||||
if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
|
||||
{
|
||||
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
|
||||
|
||||
$sql = 'SELECT SUM(pf.amount) as total_paiements
|
||||
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p
|
||||
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid ORDER BY p.datep, p.tms';
|
||||
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
|
||||
$res = $db->fetch_object($resql);
|
||||
$total_paiements = $res->total_paiements;
|
||||
|
||||
@ -4128,11 +4129,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
if ($resteapayer == 0) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) {
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} 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>';
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class FactureRec extends CommonInvoice
|
||||
public $table_element_line='facturedet_rec';
|
||||
public $fk_element='fk_facture';
|
||||
public $picto='bill';
|
||||
|
||||
|
||||
var $entity;
|
||||
var $number;
|
||||
var $date;
|
||||
@ -58,7 +58,7 @@ class FactureRec extends CommonInvoice
|
||||
var $date_when;
|
||||
var $nb_gen_done;
|
||||
var $nb_gen_max;
|
||||
|
||||
|
||||
var $rang;
|
||||
var $special_code;
|
||||
|
||||
@ -91,20 +91,20 @@ class FactureRec extends CommonInvoice
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
|
||||
|
||||
// No frequency defined then no next date to execution
|
||||
if (empty($this->frequency))
|
||||
if (empty($this->frequency))
|
||||
{
|
||||
$this->frequency=0;
|
||||
$this->date_when=NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->frequency=abs($this->frequency);
|
||||
$this->nb_gen_done=0;
|
||||
$this->nb_gen_max=empty($this->nb_gen_max)?0:$this->nb_gen_max;
|
||||
$this->auto_validate=empty($this->auto_validate)?0:$this->auto_validate;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Charge facture modele
|
||||
@ -197,7 +197,7 @@ class FactureRec extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add object linked
|
||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||
{
|
||||
@ -210,7 +210,7 @@ class FactureRec extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error)
|
||||
{
|
||||
@ -268,7 +268,7 @@ class FactureRec extends CommonInvoice
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
*/
|
||||
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -326,6 +326,14 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
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
|
||||
*/
|
||||
@ -361,8 +369,8 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Recupere les lignes de factures predefinies dans this->lines
|
||||
*
|
||||
@ -386,7 +394,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang';
|
||||
|
||||
|
||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -396,7 +404,7 @@ class FactureRec extends CommonInvoice
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$line = new FactureLigne($this->db);
|
||||
$line = new FactureLigneRec($this->db);
|
||||
|
||||
$line->id = $objp->rowid;
|
||||
$line->rowid = $objp->rowid;
|
||||
@ -431,11 +439,20 @@ class FactureRec extends CommonInvoice
|
||||
$line->special_code = $objp->special_code;
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
$line->fk_contract_line = $objp->fk_contract_line;
|
||||
|
||||
|
||||
// Ne plus utiliser
|
||||
$line->price = $objp->price;
|
||||
$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;
|
||||
|
||||
$i++;
|
||||
@ -463,12 +480,12 @@ class FactureRec extends CommonInvoice
|
||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
||||
{
|
||||
$rowid=$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
|
||||
dol_syslog($sql);
|
||||
if ($this->db->query($sql))
|
||||
@ -481,7 +498,7 @@ class FactureRec extends CommonInvoice
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error=-3;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-1;
|
||||
@ -492,7 +509,7 @@ class FactureRec extends CommonInvoice
|
||||
$this->error=$this->db->lasterror();
|
||||
$error=-2;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -531,7 +548,7 @@ class FactureRec extends CommonInvoice
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
@ -584,7 +601,7 @@ class FactureRec extends CommonInvoice
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
@ -647,9 +664,10 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX."facturedet_rec");
|
||||
$this->id=$facid;
|
||||
$this->update_price();
|
||||
return 1;
|
||||
return $lineId;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -685,12 +703,12 @@ class FactureRec extends CommonInvoice
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
|
||||
$facid=$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
@ -715,7 +733,7 @@ class FactureRec extends CommonInvoice
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1 = price2num($txlocaltax1);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@ -724,7 +742,7 @@ class FactureRec extends CommonInvoice
|
||||
{
|
||||
$pu=$pu_ttc;
|
||||
}
|
||||
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
@ -736,7 +754,7 @@ class FactureRec extends CommonInvoice
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1=$tabprice[9];
|
||||
$total_localtax2=$tabprice[10];
|
||||
|
||||
|
||||
$product_type=$type;
|
||||
if ($fk_product)
|
||||
{
|
||||
@ -744,7 +762,7 @@ class FactureRec extends CommonInvoice
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
}
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET ";
|
||||
$sql.= "fk_facture = '".$facid."'";
|
||||
$sql.= ", label=".(! empty($label)?"'".$this->db->escape($label)."'":"null");
|
||||
@ -784,12 +802,12 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the next date of
|
||||
*
|
||||
* Return the next date of
|
||||
*
|
||||
* @return timestamp false if KO, timestamp if OK
|
||||
*/
|
||||
function getNextDate()
|
||||
@ -797,27 +815,27 @@ class FactureRec extends CommonInvoice
|
||||
if (empty($this->date_when)) return false;
|
||||
return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create all recurrents invoices (for all entities if multicompany is used).
|
||||
* A result may also be provided into this->output.
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*
|
||||
* WARNING: This method change context $conf->entity to be in correct context for each recurring invoice found.
|
||||
*
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function createRecurringInvoices()
|
||||
{
|
||||
global $conf, $langs, $db, $user;
|
||||
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
$nb_create=0;
|
||||
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day
|
||||
|
||||
|
||||
dol_syslog("createRecurringInvoices");
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec';
|
||||
$sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency
|
||||
@ -825,30 +843,30 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
|
||||
$sql.= $db->order('entity', 'ASC');
|
||||
//print $sql;exit;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
if ($num) $this->output.=$langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
|
||||
else $this->output.=$langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
|
||||
|
||||
|
||||
$saventity = $conf->entity;
|
||||
|
||||
|
||||
while ($i < $num) // Loop on each template invoice
|
||||
{
|
||||
$line = $db->fetch_object($resql);
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$facturerec = new FactureRec($db);
|
||||
$facturerec->fetch($line->rowid);
|
||||
|
||||
|
||||
// Set entity context
|
||||
$conf->entity = $facturerec->entity;
|
||||
|
||||
|
||||
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity);
|
||||
|
||||
$error=0;
|
||||
@ -856,12 +874,12 @@ class FactureRec extends CommonInvoice
|
||||
$facture = new Facture($db);
|
||||
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
|
||||
|
||||
|
||||
$facture->type = self::TYPE_STANDARD;
|
||||
$facture->brouillon = 1;
|
||||
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||
$facture->socid = $facturerec->socid;
|
||||
|
||||
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0)
|
||||
{
|
||||
@ -894,16 +912,16 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$conf->entity = $saventity; // Restore entity context
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
$this->output=trim($this->output);
|
||||
|
||||
|
||||
return $error?$error:0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -920,13 +938,13 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id;
|
||||
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
|
||||
$picto='bill';
|
||||
|
||||
|
||||
$link = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
@ -958,7 +976,7 @@ class FactureRec extends CommonInvoice
|
||||
// Load array of products prodids
|
||||
$num_prods = 0;
|
||||
$prodids = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE entity IN (".getEntity('product').")";
|
||||
@ -1071,7 +1089,7 @@ class FactureRec extends CommonInvoice
|
||||
$this->lines[$xnbp]=$line;
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
|
||||
$this->usenewprice = 1;
|
||||
}
|
||||
|
||||
@ -1091,7 +1109,7 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
@ -1115,12 +1133,12 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
|
||||
if (!empty($unit))
|
||||
if (!empty($unit))
|
||||
{
|
||||
$sql.= ', unit_frequency = \''.$this->db->escape($unit).'\'';
|
||||
}
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -1134,7 +1152,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the next date of execution
|
||||
*
|
||||
@ -1167,7 +1185,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the maximum period
|
||||
*
|
||||
@ -1181,9 +1199,9 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (empty($nb)) $nb=0;
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET nb_gen_max = '.$nb;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
@ -1200,7 +1218,7 @@ class FactureRec extends CommonInvoice
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the auto validate invoice
|
||||
*
|
||||
@ -1214,7 +1232,7 @@ class FactureRec extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= ' SET auto_validate = '.$validate;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
@ -1241,7 +1259,10 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
class FactureLigneRec extends CommonInvoiceLine
|
||||
{
|
||||
|
||||
|
||||
public $element='facturedetrec';
|
||||
public $table_element='facturedet_rec';
|
||||
|
||||
/**
|
||||
* Delete line in database
|
||||
*
|
||||
@ -1250,25 +1271,24 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
function delete()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Call trigger
|
||||
/*$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);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
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();
|
||||
return 1;
|
||||
}
|
||||
@ -1279,5 +1299,160 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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=dol_concatdesc($this->note_private, $langs->trans("GeneratedFromRecurringInvoice", $_facrec->ref));
|
||||
|
||||
$this->array_options=$_facrec->array_options;
|
||||
|
||||
//if (! $this->remise) $this->remise = 0;
|
||||
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
|
||||
$this->brouillon = 1;
|
||||
@ -634,7 +636,7 @@ class Facture extends CommonInvoice
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr);
|
||||
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$_facrec->lines[$i]->desc,
|
||||
$_facrec->lines[$i]->subprice,
|
||||
@ -654,7 +656,7 @@ class Facture extends CommonInvoice
|
||||
null,
|
||||
0,
|
||||
$_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]->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/doleditor.class.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('compta');
|
||||
@ -103,7 +104,7 @@ $hookmanager->initHooks(array('invoicereccard','globalcard'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// 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_');
|
||||
|
||||
$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');
|
||||
}
|
||||
}
|
||||
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
|
||||
if ($action == 'addline' && $user->rights->facture->creer)
|
||||
@ -737,6 +760,18 @@ if (empty($reshook))
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$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
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
@ -1326,6 +1361,11 @@ else
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -39,6 +39,8 @@ $ref=GETPOST("ref",'alpha');
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -60,6 +60,8 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info");
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* 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");
|
||||
$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("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</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("RulesCADue");
|
||||
@ -70,10 +72,12 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
else {
|
||||
else if ($modecompta=="RECETTES-DEPENSES")
|
||||
{
|
||||
$nom=$langs->trans("SalesTurnover");
|
||||
$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("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</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("RulesCAIn");
|
||||
@ -81,6 +85,20 @@ else {
|
||||
$builddate=time();
|
||||
//$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();
|
||||
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||
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)";
|
||||
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)";
|
||||
$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
|
||||
@ -111,9 +131,19 @@ else
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
$sql.= " WHERE p.rowid = pf.fk_paiement";
|
||||
$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;
|
||||
}
|
||||
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.= " ORDER BY dm";
|
||||
|
||||
@ -481,7 +511,7 @@ print '</div>';
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ else
|
||||
dol_fiche_head($head, 'agenda', $title, -1, 'contact');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
@ -223,42 +223,42 @@ else
|
||||
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$object->info($id);
|
||||
print dol_print_object_info($object, 1);
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Actions buttons
|
||||
|
||||
|
||||
$objcon=$object;
|
||||
$object->fetch_thirdparty();
|
||||
$objthirdparty=$object->thirdparty;
|
||||
|
||||
|
||||
$out='';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
||||
{
|
||||
//$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.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
//$out.="</a>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
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 '</div>';
|
||||
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$param='&id='.$id;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
|
||||
|
||||
// List of all actions
|
||||
$filters=array();
|
||||
$filters['search_agenda_label']=$search_agenda_label;
|
||||
|
||||
|
||||
show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,6 +1278,15 @@ class Contrat extends CommonObject
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
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.=($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 || $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 || $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 || $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>':'');
|
||||
return $text;
|
||||
}
|
||||
@ -2509,9 +2518,10 @@ class ContratLigne extends CommonObjectLine
|
||||
* @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 $expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* @param string $moreatt More attribute
|
||||
* @return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$mode,$expired=-1)
|
||||
function LibStatut($statut,$mode,$expired=-1,$moreatt='')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
@ -2541,11 +2551,11 @@ class ContratLigne extends CommonObjectLine
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
|
||||
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',$moreatt); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
|
||||
@ -39,8 +39,10 @@ $result = restrictedArea($user, 'contrat', $id, '');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Contract"),"");
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
$search_product_category=0;
|
||||
$search_name="";
|
||||
$search_contract="";
|
||||
$search_service="";
|
||||
@ -176,6 +177,8 @@ if (empty($reshook))
|
||||
$filter_opcloture="";
|
||||
$mode='';
|
||||
$filter='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* 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/
|
||||
*
|
||||
*
|
||||
* $elementype must be defined.
|
||||
*/
|
||||
|
||||
@ -158,12 +158,11 @@ if ($action == 'add')
|
||||
$params['options'][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$result=$extrafields->addExtraField(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
$type,
|
||||
GETPOST('pos', 'alpha'),
|
||||
GETPOST('pos', 'int'),
|
||||
$extrasize,
|
||||
$elementtype,
|
||||
(GETPOST('unique', 'alpha')?1:0),
|
||||
@ -175,8 +174,8 @@ if ($action == 'add')
|
||||
(GETPOST('list', 'alpha')?1:0),
|
||||
(GETPOST('ishidden', 'alpha')?1:0),
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:'')
|
||||
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
GETPOST('langfile', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -338,7 +337,8 @@ if ($action == 'update')
|
||||
(GETPOST('ishidden', 'alpha')?1:0),
|
||||
GETPOST('default_value','alpha'),
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:'')
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
GETPOST('langfile')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -440,26 +440,26 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) {
|
||||
if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
{
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
|
||||
if (count($files)>0)
|
||||
{
|
||||
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
|
||||
@ -474,14 +474,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// Create empty PDF
|
||||
@ -519,18 +518,18 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
if ($pagecount)
|
||||
{
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
|
||||
@ -345,7 +345,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}
|
||||
|
||||
// Send mail
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
|
||||
if (empty($sendcontext)) $sendcontext = 'standard';
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid,'',$sendcontext);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
// $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
|
||||
|
||||
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, ...)
|
||||
if ($action == 'setModuleOptions')
|
||||
{
|
||||
|
||||
@ -39,11 +39,11 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$file=urldecode(GETPOST('file'));
|
||||
$section=GETPOST("section");
|
||||
$module=GETPOST("module");
|
||||
$urlsource=GETPOST("urlsource");
|
||||
$action=GETPOST('action','aZ09');
|
||||
$file=urldecode(GETPOST('file','alpha'));
|
||||
$section=GETPOST("section",'alpha');
|
||||
$module=GETPOST("module",'alpha');
|
||||
$urlsource=GETPOST("urlsource",'alpha');
|
||||
$search_doc_ref=GETPOST('search_doc_ref','alpha');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -56,7 +56,9 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file));
|
||||
$rootdirfordoc = $conf->ecm->dir_output;
|
||||
|
||||
$upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file));
|
||||
|
||||
$ecmdir = new EcmDirectory($db);
|
||||
$result=$ecmdir->fetch($section);
|
||||
@ -68,7 +70,9 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
|
||||
}
|
||||
else // For no ajax call
|
||||
{
|
||||
$ecmdir = new EcmDirectory($db);
|
||||
$rootdirfordoc = $conf->ecm->dir_output;
|
||||
|
||||
$ecmdir = new EcmDirectory($db);
|
||||
$relativepath='';
|
||||
if ($section > 0)
|
||||
{
|
||||
@ -80,7 +84,7 @@ else // For no ajax call
|
||||
}
|
||||
}
|
||||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
$upload_dir = $rootdirfordoc.'/'.$relativepath;
|
||||
}
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
@ -95,8 +99,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
//print 'xxx'.$upload_dir;
|
||||
|
||||
// Security:
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans
|
||||
// les noms de fichiers.
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
|
||||
if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir))
|
||||
{
|
||||
dol_syslog("Refused to deliver file ".$upload_dir);
|
||||
@ -105,6 +108,16 @@ if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir))
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
if (! $user->rights->ecm->read) accessforbidden();
|
||||
}
|
||||
if ($modulepart == 'medias')
|
||||
{
|
||||
// Always allowed
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -153,7 +166,7 @@ if ($type == 'directory')
|
||||
$excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview.*\.png)$','^temp$','^payments$','^CVS$','^thumbs$');
|
||||
$sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC);
|
||||
|
||||
// Right area. If module is defined, we are in automatic ecm.
|
||||
// Right area. If module is defined here, we are in automatic ecm.
|
||||
$automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport');
|
||||
|
||||
// TODO change for multicompany sharing
|
||||
@ -197,20 +210,33 @@ if ($type == 'directory')
|
||||
$filter=preg_quote($search_doc_ref, '/');
|
||||
$filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1);
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url,1);
|
||||
$perm=$user->rights->ecm->upload;
|
||||
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$perm,1,$textifempty,$maxlengthname,$url,1);
|
||||
}
|
||||
// Manual list
|
||||
else
|
||||
{
|
||||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$relativepath=GETPOST('file','alpha');
|
||||
$upload_dir = $dolibarr_main_data_root.'/medias/'.$relativepath;
|
||||
}
|
||||
else
|
||||
{
|
||||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
}
|
||||
|
||||
// If $section defined with value 0
|
||||
if ($section === '0' || empty($section))
|
||||
if (($section === '0' || empty($section)) && ($module != 'medias'))
|
||||
{
|
||||
$filearray=array();
|
||||
}
|
||||
else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1);
|
||||
else
|
||||
{
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1);
|
||||
}
|
||||
|
||||
if ($section)
|
||||
{
|
||||
@ -222,7 +248,18 @@ if ($type == 'directory')
|
||||
else if ($section === '0') $textifempty='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
|
||||
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
|
||||
|
||||
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$modulepart='medias';
|
||||
$perm=($user->rights->websites->creer || $user->rights->emailing->creer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$modulepart='ecm';
|
||||
$perm=$user->rights->ecm->upload;
|
||||
}
|
||||
|
||||
$formfile->list_of_documents($filearray,'',$modulepart,$param,1,$relativepath,$perm,1,$textifempty,$maxlengthname,'',$url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,13 +45,14 @@ if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir);
|
||||
|
||||
$langs->load("ecm");
|
||||
|
||||
// Define selecteddir (fullpath).
|
||||
// Define fullpathselecteddir.
|
||||
$fullpathselecteddir='<none>';
|
||||
if ($modulepart == 'ecm') $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
|
||||
if ($modulepart == 'medias') $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : '');
|
||||
|
||||
|
||||
// Security:
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans
|
||||
// les noms de fichiers.
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
|
||||
if (preg_match('/\.\./',$fullpathselecteddir) || preg_match('/[<>|]/',$fullpathselecteddir))
|
||||
{
|
||||
dol_syslog("Refused to deliver file ".$original_file);
|
||||
@ -63,9 +64,12 @@ if (preg_match('/\.\./',$fullpathselecteddir) || preg_match('/[<>|]/',$fullpaths
|
||||
// Check permissions
|
||||
if ($modulepart == 'ecm')
|
||||
{
|
||||
if (! $user->rights->ecm->read) accessforbidden();
|
||||
if (! $user->rights->ecm->read) accessforbidden();
|
||||
}
|
||||
if ($modulepart == 'medias')
|
||||
{
|
||||
// Always allowed
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -97,7 +101,8 @@ foreach($sqltree as $keycursor => $val)
|
||||
if (file_exists($fullpathselecteddir))
|
||||
{
|
||||
$files = @scandir($fullpathselecteddir);
|
||||
if ($files)
|
||||
|
||||
if ($files)
|
||||
{
|
||||
natcasesort($files);
|
||||
if ( count($files) > 2 ) /* The 2 accounts for . and .. */
|
||||
|
||||
@ -71,3 +71,27 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext')
|
||||
{
|
||||
// Increase date
|
||||
$al = new AccountLine($db);
|
||||
$al->dateo_next(GETPOST('rowid','int'));
|
||||
$al->fetch(GETPOST('rowid','int'));
|
||||
|
||||
print '<span>'.dol_print_date($db->jdate($al->dateo),"day").'</span>';
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev')
|
||||
{
|
||||
// Decrease date
|
||||
$al =new AccountLine($db);
|
||||
$al->dateo_previous(GETPOST('rowid','int'));
|
||||
$al->fetch(GETPOST('rowid','int'));
|
||||
|
||||
print '<span>'.dol_print_date($db->jdate($al->dateo),"day").'</span>';
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -97,181 +97,95 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$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';
|
||||
$facturestatic=new Facture($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic=new Propal($db);
|
||||
|
||||
// part 1
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice'.$fileid;
|
||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||
$filename = '/boxactivity-propal'.$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);
|
||||
$data = array();
|
||||
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";
|
||||
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);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$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);
|
||||
}
|
||||
$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=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data))
|
||||
{
|
||||
$j=0;
|
||||
while ($line < count($cumuldata))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
'logo' => 'object_propal'
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||
'text' => $data[$j]->nb,
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
'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(
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
||||
);
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'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
|
||||
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="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),
|
||||
);
|
||||
}
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'";
|
||||
$sql.= " AND c.facture=0";
|
||||
$sql.= " GROUP BY c.fk_statut";
|
||||
$sql.= " ORDER BY c.fk_statut DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$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';
|
||||
$propalstatic=new Propal($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||
$filename = '/boxactivity-propal'.$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";
|
||||
// part 1
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice'.$fileid;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
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";
|
||||
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;
|
||||
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);
|
||||
}
|
||||
$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))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
'logo' => 'object_propal'
|
||||
);
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($line < count($cumuldata)) {
|
||||
$billurl="search_status=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$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("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
'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][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||
'text' => $data[$j]->nb,
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'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),
|
||||
);
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
||||
);
|
||||
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
// We add only for the current year
|
||||
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
|
||||
|
||||
@ -38,8 +38,7 @@ class CMailFile
|
||||
{
|
||||
public $sendcontext;
|
||||
public $sendmode;
|
||||
public $sendsetup;
|
||||
|
||||
|
||||
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).
|
||||
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
|
||||
@ -115,14 +114,15 @@ class CMailFile
|
||||
global $conf, $dolibarr_main_data_root;
|
||||
|
||||
$this->sendcontext = $sendcontext;
|
||||
|
||||
|
||||
// Define 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='mail';
|
||||
|
||||
$this->sendsetup = array();
|
||||
|
||||
|
||||
// We define end of line (RFC 821).
|
||||
$this->eol="\r\n";
|
||||
@ -145,7 +145,7 @@ class CMailFile
|
||||
$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: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG);
|
||||
dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG);
|
||||
|
||||
if (empty($subject))
|
||||
{
|
||||
@ -157,7 +157,7 @@ class CMailFile
|
||||
{
|
||||
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
|
||||
$msg='.'; // Avoid empty message (with empty message conten show a multipart structure)
|
||||
}
|
||||
}
|
||||
|
||||
// Detect if message is HTML (use fast method)
|
||||
if ($msgishtml == -1)
|
||||
@ -230,7 +230,7 @@ class CMailFile
|
||||
$this->addr_bcc = $addr_bcc;
|
||||
$this->deliveryreceipt = $deliveryreceipt;
|
||||
$this->trackid = $trackid;
|
||||
|
||||
|
||||
$smtp_headers = $this->write_smtpheaders();
|
||||
if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n
|
||||
|
||||
@ -339,7 +339,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
|
||||
// TODO Add trackid into smtp header
|
||||
// TODO if (! empty($moreinheader)) ...
|
||||
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
@ -487,9 +487,7 @@ class CMailFile
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks(array(
|
||||
'maildao'
|
||||
));
|
||||
$hookmanager->initHooks(array('maildao'));
|
||||
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (! empty($reshook))
|
||||
{
|
||||
@ -532,6 +530,22 @@ class CMailFile
|
||||
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
|
||||
if ($this->sendmode == 'mail')
|
||||
{
|
||||
@ -548,9 +562,9 @@ class CMailFile
|
||||
@ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2));
|
||||
}
|
||||
|
||||
// Forcage parametres
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_set('SMTP',$conf->global->MAIN_MAIL_SMTP_SERVER);
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_set('smtp_port',$conf->global->MAIN_MAIL_SMTP_PORT);
|
||||
// Force parameters
|
||||
if (! empty($conf->global->$keyforsmtpserver)) ini_set('SMTP',$conf->global->$keyforsmtpserver);
|
||||
if (! empty($conf->global->$keyforsmtpport)) ini_set('smtp_port',$conf->global->$keyforsmtpport);
|
||||
|
||||
$dest=$this->getValidAddress($this->addr_to,2);
|
||||
if (! $dest)
|
||||
@ -610,9 +624,9 @@ class CMailFile
|
||||
@ini_restore('sendmail_from');
|
||||
}
|
||||
|
||||
// Forcage parametres
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP');
|
||||
if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port');
|
||||
// Restore parameters
|
||||
if (! empty($conf->global->$keyforsmtpserver)) ini_restore('SMTP');
|
||||
if (! empty($conf->global->$keyforsmtpport)) ini_restore('smtp_port');
|
||||
}
|
||||
else if ($this->sendmode == 'smtps')
|
||||
{
|
||||
@ -622,28 +636,30 @@ class CMailFile
|
||||
$this->smtps->setTransportType(0); // Only this method is coded in SMTPs library
|
||||
|
||||
// Clean parameters
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
||||
|
||||
// TODO Manage alternative parameters
|
||||
if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP');
|
||||
if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port');
|
||||
|
||||
// If we use SSL/TLS
|
||||
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
|
||||
$port=$conf->global->MAIN_MAIL_SMTP_PORT;
|
||||
$server=$conf->global->$keyforsmtpserver;
|
||||
$secure='';
|
||||
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->setPort($port); // 25, 465...;
|
||||
|
||||
$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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -651,14 +667,14 @@ class CMailFile
|
||||
$from=$this->smtps->getFrom('org');
|
||||
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);
|
||||
$res=false;
|
||||
}
|
||||
$dest=$this->smtps->getTo();
|
||||
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);
|
||||
$res=false;
|
||||
}
|
||||
@ -666,7 +682,7 @@ class CMailFile
|
||||
if ($res)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
|
||||
|
||||
|
||||
$result=$this->smtps->sendMsg();
|
||||
//print $result;
|
||||
|
||||
@ -684,26 +700,24 @@ class CMailFile
|
||||
}
|
||||
else if ($this->sendmode == 'swiftmailer')
|
||||
{
|
||||
|
||||
// Use Swift Mailer library
|
||||
// ------------------------------------------
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
|
||||
// Forcage parametres
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP');
|
||||
if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port');
|
||||
// Clean parameters
|
||||
if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP');
|
||||
if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port');
|
||||
|
||||
// If we use SSL/TLS
|
||||
$server=$conf->global->MAIN_MAIL_SMTP_SERVER;
|
||||
$server=$conf->global->$keyforsmtpserver;
|
||||
$secure='';
|
||||
//var_dump(stream_get_transports());
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl';
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls';
|
||||
if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure='ssl';
|
||||
if (! empty($conf->global->$keyforstarttls) && 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->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW);
|
||||
if (! empty($conf->global->$keyforsmtpid)) $this->transport->setUsername($conf->global->$keyforsmtpid);
|
||||
if (! empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw);
|
||||
//$smtps->_msgReplyTo = 'reply@web.com';
|
||||
|
||||
// Create the Mailer using your created Transport
|
||||
@ -1026,7 +1040,7 @@ class CMailFile
|
||||
$out.= $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
|
||||
{
|
||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||
@ -1036,7 +1050,7 @@ class CMailFile
|
||||
$out.= $this->eol.$strContentAltText.$this->eol;
|
||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||
}
|
||||
|
||||
|
||||
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
||||
$out.= $this->eol.$strContent.$this->eol;
|
||||
|
||||
@ -1154,13 +1168,30 @@ class CMailFile
|
||||
function check_server_port($host,$port)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$_retVal=0;
|
||||
$timeout=5; // Timeout in seconds
|
||||
|
||||
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 (! 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
|
||||
//if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host;
|
||||
|
||||
@ -1355,7 +1386,7 @@ class CMailFile
|
||||
if ($email)
|
||||
{
|
||||
$i++;
|
||||
|
||||
|
||||
$newemail='';
|
||||
if ($format == 4)
|
||||
{
|
||||
|
||||
@ -374,13 +374,12 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>(! empty($object->total_vat)?price2num($object->total_vat):price2num($object->total_tva)),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
|
||||
|
||||
$array_key.'_multicurrency_code' => price2num($object->multicurrency_code),
|
||||
$array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx),
|
||||
@ -411,18 +410,29 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT')
|
||||
);
|
||||
|
||||
if (method_exists($object, 'getTotalDiscount')) {
|
||||
$resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs);
|
||||
$resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount());
|
||||
} else {
|
||||
$resarray[$array_key.'_total_discount_ht_locale'] = '';
|
||||
$resarray[$array_key.'_total_discount_ht'] = '';
|
||||
}
|
||||
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
if (is_array($object->lines) && count($object->lines)>0)
|
||||
{
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
|
||||
$vatformated=vatrate($line->tva_tx);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
|
||||
$vatformated=vatrate($line->tva_tx);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
|
||||
}
|
||||
}
|
||||
// Retrieve extrafields
|
||||
if (is_array($object->array_options) && count($object->array_options))
|
||||
|
||||
@ -3876,7 +3876,7 @@ abstract class CommonObject
|
||||
*
|
||||
* @param string $modelspath Relative folder where generators are placed
|
||||
* @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example.
|
||||
* @param Translate $outputlangs Language to use
|
||||
* @param Translate $outputlangs Output language to use
|
||||
* @param int $hidedetails 1 to hide details. 0 by default
|
||||
* @param int $hidedesc 1 to hide product description. 0 by default
|
||||
* @param int $hideref 1 to hide product reference. 0 by default
|
||||
@ -3885,7 +3885,7 @@ abstract class CommonObject
|
||||
*/
|
||||
protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$srctemplatepath='';
|
||||
|
||||
@ -3903,7 +3903,6 @@ abstract class CommonObject
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array('/');
|
||||
@ -3995,7 +3994,10 @@ abstract class CommonObject
|
||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
||||
}
|
||||
else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
else
|
||||
{
|
||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
if ($resultwritefile > 0)
|
||||
{
|
||||
@ -4005,6 +4007,58 @@ abstract class CommonObject
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_delete_preview($this);
|
||||
|
||||
// Index file in database
|
||||
if (! empty($obj->result['fullpath']))
|
||||
{
|
||||
$destfull = $obj->result['fullpath'];
|
||||
$upload_dir = dirname($destfull);
|
||||
$destfile = basename($destfull);
|
||||
$rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir);
|
||||
|
||||
if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir
|
||||
{
|
||||
$filename = basename($destfile);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
if ($result > 0)
|
||||
{
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING);
|
||||
}
|
||||
|
||||
// Success in building document. We build meta file.
|
||||
dol_meta_create($this);
|
||||
|
||||
@ -4153,7 +4207,7 @@ abstract class CommonObject
|
||||
|
||||
if (! is_array($optionsArray))
|
||||
{
|
||||
// $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page.
|
||||
// If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page.
|
||||
// TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first)
|
||||
// global $extrafields;
|
||||
//if (! is_object($extrafields))
|
||||
@ -4174,7 +4228,7 @@ abstract class CommonObject
|
||||
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||
|
||||
// Request to get complementary values
|
||||
if (count($optionsArray) > 0)
|
||||
if (is_array($optionsArray) && count($optionsArray) > 0)
|
||||
{
|
||||
$sql = "SELECT rowid";
|
||||
foreach ($optionsArray as $name => $label)
|
||||
@ -4298,6 +4352,12 @@ abstract class CommonObject
|
||||
$this->array_options[$key] = null;
|
||||
}
|
||||
break;
|
||||
/*case 'select': // Not required, we chosed value='0' for undefined values
|
||||
if ($value=='-1')
|
||||
{
|
||||
$this->array_options[$key] = null;
|
||||
}
|
||||
break;*/
|
||||
case 'price':
|
||||
$this->array_options[$key] = price2num($this->array_options[$key]);
|
||||
break;
|
||||
@ -4431,6 +4491,12 @@ abstract class CommonObject
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
break;
|
||||
/*case 'select': // Not required, we chosed value='0' for undefined values
|
||||
if ($value=='-1')
|
||||
{
|
||||
$this->array_options[$key] = null;
|
||||
}
|
||||
break;*/
|
||||
case 'price':
|
||||
$this->array_options["options_".$key] = price2num($this->array_options["options_".$key]);
|
||||
break;
|
||||
@ -4499,6 +4565,9 @@ abstract class CommonObject
|
||||
$e = 0;
|
||||
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 (array_key_exists('colspan',$params)) {
|
||||
$colspan=$params['colspan'];
|
||||
@ -4881,7 +4950,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$queryarray[$field] = (int) price2num($this->{$field});
|
||||
if (empty($queryarray[$field])) $queryarray[$field]=0; // May be rest to null later if property 'nullifempty' is on for this field.
|
||||
if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field.
|
||||
}
|
||||
}
|
||||
else if($this->isFloat($info))
|
||||
@ -4895,7 +4964,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]);
|
||||
if (! empty($info['nullifempty']) && empty($queryarray[$field])) $queryarray[$field] = null;
|
||||
if (! empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null;
|
||||
}
|
||||
|
||||
return $queryarray;
|
||||
@ -4985,7 +5054,7 @@ abstract class CommonObject
|
||||
$fieldvalues = $this->set_save_query();
|
||||
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now);
|
||||
if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id;
|
||||
unset($fieldvalues['rowid']); // We suppose the field rowid is reserved field for autoincrement field.
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
||||
|
||||
$keys=array();
|
||||
$values = array();
|
||||
@ -5002,7 +5071,7 @@ abstract class CommonObject
|
||||
$sql.= ' ('.implode( ", ", $keys ).')';
|
||||
$sql.= ' VALUES ('.implode( ", ", $values ).')';
|
||||
|
||||
$res = $this->db->query( $sql );
|
||||
$res = $this->db->query($sql);
|
||||
if ($res===false) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
|
||||
@ -579,6 +579,9 @@ class Conf
|
||||
$conf->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on.
|
||||
}
|
||||
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
|
||||
|
||||
// For backward compatibility
|
||||
if (isset($this->product)) $this->produit=$this->product;
|
||||
if (isset($this->facture)) $this->invoice=$this->facture;
|
||||
|
||||
@ -63,7 +63,7 @@ class DolEditor
|
||||
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
|
||||
* @param int $readonly 0=Read/Edit, 1=Read only
|
||||
*/
|
||||
function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0,$readonly=0)
|
||||
function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -282,11 +282,10 @@ class DolEditor
|
||||
$out.= ($this->height?' height: '.$this->height.'px; ':'');
|
||||
//$out.=" min-height: 100px;";
|
||||
$out.= '">';
|
||||
/*$out.= preg_replace(array('/^<\?php/','/\?>$/'), array('<?php','?>'), $this->content); */
|
||||
$out.= htmlentities($this->content);
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</pre>';
|
||||
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
|
||||
$out.= htmlentities($this->content);
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</textarea>';
|
||||
|
||||
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
/**
|
||||
* Class to build graphs.
|
||||
* Usage is:
|
||||
* Usage is:
|
||||
* $dolgraph=new DolGraph();
|
||||
* $dolgraph->SetTitle($langs->transnoentities('Tracking_Projects_Pourcent').'<br>'.$langs->transnoentities('Tracking_IndicatorDefGraph').'%');
|
||||
* $dolgraph->SetMaxValue(50);
|
||||
@ -570,6 +570,7 @@ class DolGraph
|
||||
function GetFloorMinValue()
|
||||
{
|
||||
$min = $this->GetMinValueInData();
|
||||
if ($min == '') $min=0;
|
||||
if ($min != 0) $min--;
|
||||
$size=dol_strlen(abs(floor($min)));
|
||||
$factor=1;
|
||||
@ -868,7 +869,7 @@ class DolGraph
|
||||
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.='<script id="'.$tag.'">'."\n";
|
||||
$this->stringtoshow.='$(function () {'."\n";
|
||||
$i=$firstlot;
|
||||
|
||||
@ -64,7 +64,9 @@ class ExtraFields
|
||||
var $attribute_alwayseditable;
|
||||
// Array to store permission to check
|
||||
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;
|
||||
// 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.
|
||||
@ -117,6 +119,7 @@ class ExtraFields
|
||||
$this->attribute_unique = array();
|
||||
$this->attribute_required = array();
|
||||
$this->attribute_perms = array();
|
||||
$this->attribute_langfile = array();
|
||||
$this->attribute_list = array();
|
||||
$this->attribute_hidden = array();
|
||||
}
|
||||
@ -124,25 +127,26 @@ class ExtraFields
|
||||
/**
|
||||
* Add a new extra field parameter
|
||||
*
|
||||
* @param string $attrname Code 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 $pos Position of attribute
|
||||
* @param string $size Size/length of attribute
|
||||
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
||||
* @param int $unique Is field unique 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 array $param Params for field
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @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 string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $attrname Code 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 $pos Position of attribute
|
||||
* @param string $size Size/length of attribute
|
||||
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
|
||||
* @param int $unique Is field unique 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 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 string $perms Permission to check
|
||||
* @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 string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $langfile Language file
|
||||
* @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($label)) return -1;
|
||||
@ -159,7 +163,7 @@ class ExtraFields
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||
{
|
||||
// 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;
|
||||
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 int $unique Is field unique 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 string $perms Permission to check
|
||||
* @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 $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $langfile Language file
|
||||
* @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;
|
||||
|
||||
@ -320,6 +325,7 @@ class ExtraFields
|
||||
$sql.= " param,";
|
||||
$sql.= " alwayseditable,";
|
||||
$sql.= " perms,";
|
||||
$sql.= " langs,";
|
||||
$sql.= " list,";
|
||||
$sql.= " ishidden,";
|
||||
$sql.= " fielddefault,";
|
||||
@ -340,6 +346,7 @@ class ExtraFields
|
||||
$sql.= " '".$params."',";
|
||||
$sql.= " '".$alwayseditable."',";
|
||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
|
||||
$sql.= " ".$list.",";
|
||||
$sql.= " ".$ishidden.",";
|
||||
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
|
||||
@ -348,7 +355,7 @@ class ExtraFields
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= "'" . $this->db->idate(dol_now()) . "'";
|
||||
$sql.=')';
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -466,13 +473,13 @@ class ExtraFields
|
||||
*
|
||||
* @param string $attrname Name 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 string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
|
||||
* @param int $unique Is field unique or not
|
||||
* @param int $required Is field required or not
|
||||
* @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 string $perms Permission to check
|
||||
* @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 $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $langfile Language file
|
||||
* @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 == 'contact') $elementtype='socpeople';
|
||||
@ -530,7 +538,7 @@ class ExtraFields
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -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 $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
* @param string $langfile Language file
|
||||
* @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;
|
||||
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
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
@ -624,6 +633,7 @@ class ExtraFields
|
||||
$sql.= " fieldunique,";
|
||||
$sql.= " fieldrequired,";
|
||||
$sql.= " perms,";
|
||||
$sql.= " langs,";
|
||||
$sql.= " pos,";
|
||||
$sql.= " alwayseditable,";
|
||||
$sql.= " param,";
|
||||
@ -644,6 +654,7 @@ class ExtraFields
|
||||
$sql.= " '".$unique."',";
|
||||
$sql.= " '".$required."',";
|
||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
|
||||
$sql.= " '".$pos."',";
|
||||
$sql.= " '".$alwayseditable."',";
|
||||
$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.
|
||||
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.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
@ -721,8 +732,6 @@ class ExtraFields
|
||||
{
|
||||
$array_name_label[$tab->name]=$tab->label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Old usage
|
||||
$this->attribute_type[$tab->name]=$tab->type;
|
||||
@ -737,11 +746,10 @@ class ExtraFields
|
||||
$this->attribute_pos[$tab->name]=$tab->pos;
|
||||
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||
$this->attribute_langfile[$tab->langs]=$tab->langs;
|
||||
$this->attribute_list[$tab->name]=$tab->list;
|
||||
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
||||
$this->attribute_entityid[$tab->name]=$tab->entity;
|
||||
|
||||
|
||||
|
||||
// New usage
|
||||
$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]['alwayseditable'][$tab->name]=$tab->alwayseditable;
|
||||
$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]['ishidden'][$tab->name]=$tab->ishidden;
|
||||
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
||||
|
||||
|
||||
|
||||
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
|
||||
$resql_entity_name=$this->db->query($sql_entity_name);
|
||||
@ -820,7 +829,7 @@ class ExtraFields
|
||||
$unique=$this->attribute_unique[$key];
|
||||
$required=$this->attribute_required[$key];
|
||||
$param=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$langfile=$this->attribute_langfile[$key];
|
||||
$list=$this->attribute_list[$key];
|
||||
$hidden=$this->attribute_hidden[$key];
|
||||
|
||||
@ -944,10 +953,10 @@ class ExtraFields
|
||||
$out.='<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val)
|
||||
{
|
||||
if ($key == '') continue;
|
||||
if ((string) $key == '') continue;
|
||||
list($val, $parent) = explode('|', $val);
|
||||
$out.='<option value="'.$key.'"';
|
||||
$out.= ($value==$key?' selected':'');
|
||||
$out.= (((string) $value == (string) $key)?' selected':'');
|
||||
$out.= (!empty($parent)?' parent="'.$parent.'"':'');
|
||||
$out.='>'.$val.'</option>';
|
||||
}
|
||||
@ -1352,6 +1361,7 @@ class ExtraFields
|
||||
$required=$this->attribute_required[$key];
|
||||
$params=$this->attribute_param[$key];
|
||||
$perms=$this->attribute_perms[$key];
|
||||
$langfile=$this->attribute_langfile[$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.
|
||||
|
||||
|
||||
@ -2322,10 +2322,6 @@ class Form
|
||||
unset($producttmpselect);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
}
|
||||
// mode=2 means suppliers products
|
||||
$urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
|
||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
@ -2333,11 +2329,6 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED))
|
||||
{
|
||||
print '<input type="hidden" id="idprod" name="idprod" value="0" />';
|
||||
print '<script type="text/javascript">$("#'.$htmlname.'").change(function() { $("#idprod").val($(this).val());});</script>';
|
||||
}
|
||||
print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice);
|
||||
}
|
||||
}
|
||||
@ -3410,12 +3401,12 @@ class Form
|
||||
/**
|
||||
* 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 $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
|
||||
* @param string $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @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 $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @return string
|
||||
* @see select_categories
|
||||
*/
|
||||
@ -3458,7 +3449,7 @@ class Form
|
||||
else
|
||||
{
|
||||
$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.'">';
|
||||
@ -4729,8 +4720,8 @@ class Form
|
||||
|
||||
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
|
||||
$usecalendar='combo';
|
||||
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'eldy':$conf->global->MAIN_POPUP_CALENDAR;
|
||||
if ($conf->browser->phone) $usecalendar='combo';
|
||||
if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'jquery':$conf->global->MAIN_POPUP_CALENDAR;
|
||||
//if (! empty($conf->browser->phone)) $usecalendar='combo';
|
||||
|
||||
if ($d)
|
||||
{
|
||||
@ -4772,9 +4763,21 @@ class Form
|
||||
{
|
||||
if (! $disabled)
|
||||
{
|
||||
print "<script type='text/javascript'>";
|
||||
print "$(function(){ $('#".$prefix."').datepicker({ dateFormat: '".$langs->trans("FormatDateShortJQueryInput")."', autoclose: true, todayHighlight: true }) });";
|
||||
print "</script>";
|
||||
$retstring.="<script type='text/javascript'>";
|
||||
$retstring.="$(function(){ $('#".$prefix."').datepicker({
|
||||
dateFormat: '".$langs->trans("FormatDateShortJQueryInput")."',
|
||||
autoclose: true,
|
||||
todayHighlight: true,";
|
||||
if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS))
|
||||
{
|
||||
$retstring.="
|
||||
showOn: 'button',
|
||||
buttonImage: '".DOL_URL_ROOT."/theme/".$conf->theme."/img/object_calendarday.png',
|
||||
buttonImageOnly: true";
|
||||
}
|
||||
$retstring.="
|
||||
}) });";
|
||||
$retstring.="</script>";
|
||||
}
|
||||
|
||||
// Zone de saisie manuelle de la date
|
||||
@ -4786,14 +4789,20 @@ class Form
|
||||
// Icone calendrier
|
||||
if (! $disabled)
|
||||
{
|
||||
//$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||
//$base=DOL_URL_ROOT.'/core/';
|
||||
//$retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
|
||||
//$retstring.='>';
|
||||
$retstring.=img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"');
|
||||
//$retstring.='</button>';
|
||||
/* Not required. Managed by option buttonImage of jquery
|
||||
$retstring.=img_object($langs->trans("SelectDate"),'calendarday','id="'.$prefix.'id" class="datecallink"');
|
||||
$retstring.="<script type='text/javascript'>";
|
||||
$retstring.="jQuery(document).ready(function() {";
|
||||
$retstring.=' jQuery("#'.$prefix.'id").click(function() {';
|
||||
$retstring.=" jQuery('#".$prefix."').focus();";
|
||||
$retstring.=' });';
|
||||
$retstring.='});';
|
||||
$retstring.="</script>";*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
|
||||
}
|
||||
else $retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
|
||||
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
|
||||
$retstring.='<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
|
||||
@ -4801,7 +4810,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Bad value of MAIN_POPUP_CALENDAR";
|
||||
$retstring.="Bad value of MAIN_POPUP_CALENDAR";
|
||||
}
|
||||
}
|
||||
// Show date with combo selects
|
||||
@ -5071,7 +5080,7 @@ class Form
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array (key => value)
|
||||
* @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 $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
|
||||
|
||||
@ -69,7 +69,7 @@ class FormAdmin
|
||||
$out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||
if ($showempty)
|
||||
{
|
||||
$out.= '<option value=""';
|
||||
$out.= '<option value="0"';
|
||||
if ($selected == '') $out.= ' selected';
|
||||
$out.= '>';
|
||||
if ($showempty != '1') $out.=$showempty;
|
||||
@ -85,16 +85,11 @@ class FormAdmin
|
||||
|
||||
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)
|
||||
{
|
||||
$valuetoshow=$value;
|
||||
if ($showcode) $valuetoshow=$key.' - '.$value;
|
||||
|
||||
if ($showwarning && in_array($key,$uncompletelanguages))
|
||||
{
|
||||
//$value.=' - '.$langs->trans("TranslationUncomplete",$key);
|
||||
}
|
||||
|
||||
if ($filter && is_array($filter))
|
||||
{
|
||||
if ( ! array_key_exists($key, $filter))
|
||||
|
||||