Merge branch 'develop' of git://github.com/Dolibarr/dolibarr.git into webservices

This commit is contained in:
jfefe 2012-12-05 01:12:40 +01:00
commit 002ccaf81d
334 changed files with 11768 additions and 7687 deletions

View File

@ -14,7 +14,7 @@ For users:
configured. Show also total number of activated modules.
- New: Can filter list of proposal, order or invoice on sales representative.
- New: Add supplier ref on supplier orders.
- New: Can export supplier orders.
- New: Can export supplier orders and customers shipments.
- New: First change to install external plugins from gui (experimental).
- New: Monaco is like France for default vat calculation
- New: Can list elements (invoices, orders or proposals) on a particular
@ -26,10 +26,11 @@ For users:
- New: Can insert URL links into elements lines. Also reported into PDF.
- New: When a member is validated, we can subscribe to mailing-lists
according to its type.
- New: Add a tab into members statistics to count members by nature.
- New: Add link to third party into sells and purchase journal.
- New: Suggest a method to generate a backup file for user with no access
to mysqldump binary.
- New: Can use extrafields on contacts/addresses.
- New: Can also use extrafields on contacts/addresses and users.
- New: Support unique field for extrafields.
- New: Extra fields supports more types (int, string, double, date, datetime).
- New: Can correct stock of a warehouse from warehouse card.
@ -50,9 +51,10 @@ For users:
- New: Allow to search product from barcodes directly from invoices, proposals... through AJAX.
- New: Can make one invoice for several orders.
- New: POS module can works with only one payment method (cach, chq, credit card).
- New: Add possibility to defined position/job of a user
- New: [ task #210 ] Can choose cash account during POS login
- New: [ task #104 ] Can create an invoice from several orders
- New: Add possibility to defined position/job of a user.
- New: Add hidden option to add slashes between lines into PDF.
- New: [ task #210 ] Can choose cash account during POS login.
- New: [ task #104 ] Can create an invoice from several orders.
- New: Update libs/tools/logo for DoliWamp (now use PHP 5.3).
- New: Added ODT Template tag {object_total_discount}
- New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices
@ -60,10 +62,12 @@ For users:
- New: Can choose menu entry to show with external site module.
- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM
to force margins of generated PDF.
- New: [ task #314 ] Can define if prof id are mandatory or not
New experimental modules:
- New: Add margin management module.
- New: Add commissions management module.
- Fix: [ bug #499 ]: Supplier order input method not translated
- Fix: No images into product description lines as PDF generation does
not work with this.

View File

@ -34,16 +34,6 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
</IfModule>
# OPTIMIZE: To use gzip compressed files (for Dolibarr already compressed files).
# Note that constant MAIN_OPTIMIZE_SPEED must have a value with bit 0 set.
#AddType text/javascript .jgz
#AddEncoding gzip .jgz
# OPTIMIZE: To use gzip compression (on the fly).
# Note that you must also enable the module mod_deflate.
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
#TODO
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
# Note that you must also enable the module mod_expires.
#ExpiresActive On

View File

@ -161,12 +161,11 @@ $dolibarr_main_authentication='dolibarr';
# $dolibarr_main_auth_ldap_filter = ''; # If defined, two previous parameters are not used to find a user into LDAP. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com).
# $dolibarr_main_auth_ldap_admin_login=''; # Required only if anonymous bind disabled. Ex: cn=admin,dc=example,dc=com
# $dolibarr_main_auth_ldap_admin_pass=''; # Required only if anonymous bind disabled. Ex: secret
# $dolibarr_main_auth_ldap_debug='false';
# dolibarr_main_demo
# Login and pass to use in a demo mode
# Login and pass to use in a demo mode.
# Default value: ''
# Examples:
# $dolibarr_main_demo='autologin,autopass'

View File

@ -1,55 +0,0 @@
Package: dolibarr
Version: __VERSION__
Architecture: all
Maintainer: Laurent Destailleur <eldy@users.sourceforge.net>
Installed-Size: 61200
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
php5-mysql | php5-mysqli,
php5-cli, php5-curl, php5-gd, php5-ldap, php-pear, php-mail-mime, php5-geoip,
libphp-adodb,
libnusoap-php,
libphp-pclzip,
libjs-jquery, libjs-jquery-ui, ckeditor,
ttf-dejavu-core,
xdg-utils,
mysql-server
Section: web
Priority: optional
Homepage: http://www.dolibarr.org
Description: Web based software to manage a small company or foundation
Dolibarr ERP & CRM is an easy to use open source/free software for small
and medium companies, foundations or freelances. It includes different
features for Enterprise Resource Planning (ERP) and Customer Relationship
Management (CRM) but also for different other activities.
It's a web software you can install as a standalone program or on any web
hosting provider to use it from anywhere with any web browser.
.
Dolibarr was designed to be easy to use. Only features you need are
visible, depending on which module were activated.
Most common used modules are:
.
Customers, Suppliers or Prospects directory,
Contacts directory,
Orders management,
Commercial proposals management,
Invoices management,
Products and services catalog,
Stock management,
Foundations members management,
Bank accounts management,
Point of Sale,
Payments management,
Commercial actions management,
Contracts management,
Standing orders management,
Shipping management,
Donations management,
Bookmarks management,
Mass Emailings,
Reports,
Wizards to export and import data,
LDAP connectivity,
PDF exports,
And a lot of more modules...
.
You can also add third parties external modules or develop yours.

View File

@ -29,13 +29,14 @@ $force_install_lockinstall='444';
// If we enable/disable libraries declaration during install, we must also check they are
// not removed from package (see in rules file),
// declared into dependencies (see in control file)
$force_dolibarr_lib_TCPDF_PATH='';
$force_dolibarr_lib_FPDF_PATH='/usr/share/php/fpdf';
$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
$force_dolibarr_js_JQUERY='/javascript/jquery';
$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';

View File

@ -337,6 +337,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
}
# Build package for each target

View File

@ -111,9 +111,9 @@ class modMyModule extends DolibarrModules
$this->const = array();
// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// 'objecttype:-tabname'); // To remove an existing tab identified by code tabname
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// 'objecttype:-tabname':NU:conditiontoremove); // To remove an existing tab identified by code tabname
// where objecttype can be
// 'thirdparty' to add a tab in third party view
// 'intervention' to add a tab in intervention view

View File

@ -33,8 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* \class Adherent
* \brief Class to manage members of a foundation
* Class to manage members of a foundation
*/
class Adherent extends CommonObject
{
@ -705,7 +704,7 @@ class Adherent extends CommonObject
$this->db->begin();
// Suppression options
// Remove extrafields
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_extrafields WHERE fk_object = ".$rowid;
dol_syslog(get_class($this)."::delete sql=".$sql);

View File

@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* \class AdherentType
* \brief Class to manage members type
* Class to manage members type
*/
class AdherentType extends CommonObject
{

View File

@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
/**
* \class AdherentStats
* \brief Classe permettant la gestion des stats des adherents
* Class to manage statistics of members
*/
class AdherentStats extends Stats
{

View File

@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* \class Cotisation
* \brief Class to manage subscriptions of foundation members
* Class to manage subscriptions of foundation members
*/
class Cotisation extends CommonObject
{

View File

@ -0,0 +1,151 @@
<?php
/* Copyright (c) 2012 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/adherents/stats/byproperties.php
* \ingroup member
* \brief Page with statistics on members
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$graphwidth = 700;
$mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio);
$mode=GETPOST('mode')?GETPOST('mode'):'';
// Security check
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
if (! $user->rights->adherent->cotisation->lire)
accessforbidden();
$year = strftime("%Y", time());
$startyear=$year-2;
$endyear=$year;
/*
* View
*/
$memberstatic=new Adherent($db);
llxHeader('','','','',0,0,array('http://www.google.com/jsapi'));
$title=$langs->trans("MembersStatisticsByProperties");
print_fiche_titre($title, $mesg);
dol_mkdir($dir);
$tab='byproperties';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" WHERE d.entity IN (".getEntity().")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY d.morphy";
$foundphy=$foundmor=0;
// Define $data array
dol_syslog("Count member sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
$obj=$db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
$data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate));
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
$head = member_stats_prepare_head($adh);
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
// Print title
if (! count($data))
{
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
}
else
{
print_fiche_titre($langs->trans("MembersByNature"),'','');
}
// Print array
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Nature").'</td>';
print '<td align="center">'.$langs->trans("NbOfMembers").'</td>';
print '<td align="center">'.$langs->trans("LastMemberDate").'</td>';
print '</tr>';
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'');
$oldyear=0;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td align="center">'.$memberstatic->getmorphylib($val['label']).'</td>';
print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right">'.dol_print_date($val['lastdate'],'dayhour').'</td>';
print '</tr>';
$oldyear=$year;
}
print '</table>';
dol_fiche_end();
llxFooter();
$db->close();
?>

View File

@ -277,7 +277,8 @@ if ($mode)
dol_fiche_end();
$db->close();
llxFooter();
$db->close();
?>

View File

@ -94,6 +94,34 @@ if ($action == "save" && empty($cancel))
}
}
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);
}
}
/**
@ -159,6 +187,46 @@ print "</form>\n";
print '</div>';
/*
* Other options
*/
print_titre($langs->trans("OtherOptions"));
$var=true;
print '<table class="noborder allwidth">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>'."\n";
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n";
// Manual or automatic
$var=!$var;
print '<tr '.$bc[$var].'>'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>'."\n";
print '<td align="center" width="100">'."\n";
if ($conf->use_javascript_ajax)
{
print ajax_constantonoff('AGENDA_USE_EVENT_TYPE');
}
else
{
if($conf->global->AGENDA_USE_EVENT_TYPE == 0)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
else if($conf->global->BUSINESS_VISIBLE_TO_ALL_BY_DEFAULT == 1)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
}
print '</td></tr>'."\n";
print "<br>";
dol_htmloutput_mesg($mesg);

View File

@ -547,7 +547,7 @@ if ($action == 'edit' || $action == 'updateedit')
/*
* Local Taxes
*/
if ($mysoc->country_code=='ES')
if ($mysoc->hasLocalTax(1))
{
// Local Tax 1
print '<br>';
@ -563,7 +563,8 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
@ -572,11 +573,14 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
print "</table>";
}
if ($mysoc->hasLocalTax(2))
{
// Local Tax 2
print '<br>';
print '<table class="noborder" width="100%">';
@ -591,7 +595,8 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
@ -600,7 +605,8 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
print "</table>";
@ -921,7 +927,7 @@ else
/*
* Local Taxes
*/
if ($mysoc->country_code=='ES')
if ($mysoc->hasLocalTax(1))
{
// Local Tax 1
print '<br>';
@ -937,7 +943,8 @@ else
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example",$mysoc->country_code).': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
@ -946,12 +953,15 @@ else
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example",$mysoc->country_code).': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code);
print ($example!="LocalTax1IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
print "</table>";
}
if ($mysoc->hasLocalTax(2))
{
// Local Tax 2
print '<br>';
print '<table class="noborder" width="100%">';
@ -966,7 +976,8 @@ else
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";
@ -975,7 +986,8 @@ else
print '<td colspan="2">';
print "<table>";
print "<tr><td>".$langs->transcountry("LocalTax2IsNotUsedDesc",$mysoc->country_code)."</td></tr>";
print "<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n";
$example=$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code);
print ($example!="LocalTax2IsNotUsedExample"?"<tr><td><i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$mysoc->country_code)."</i></td></tr>\n":"");
print "</table>";
print "</td></tr>\n";

View File

@ -1066,7 +1066,6 @@ if ($id)
}
}
print '<td align="center" nowrap="nowrap">';
// Est-ce une entree du dictionnaire qui peut etre desactivee ?
$iserasable=1; // Oui par defaut
if (isset($obj->code) && ($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) $iserasable=0;
@ -1074,8 +1073,14 @@ if ($id)
if (isset($obj->code) && $obj->code == 'EF0') $iserasable=0;
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0;
// Active
print '<td align="center" nowrap="nowrap">';
if ($iserasable) print '<a href="'.$_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print $langs->trans("AlwaysActive");
else
{
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link

View File

@ -40,7 +40,16 @@ $action = GETPOST('action','alpha');
* Actions
*/
if ($action == 'setvalue' && $user->admin)
if ($action == 'setMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",1,'chaine',0,'',$conf->entity);
}
if ($action == 'unsetMAILING_EMAIL_UNSUBSCRIBE')
{
$res=dolibarr_del_const($db, "MAILING_EMAIL_UNSUBSCRIBE");
}
if ($action == 'setvalue')
{
$db->begin();
@ -129,14 +138,14 @@ print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>';
if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=off">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
$readonly='';
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=on">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setMAILING_EMAIL_UNSUBSCRIBE">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
$readonly='disabled="disabled"';
@ -149,11 +158,13 @@ print $langs->trans("ActivateCheckReadKey").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
print '</td></tr>';
print '</table></form>';
print '</table>';
print '<br>';
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>';
llxFooter();
$db->close();

View File

@ -591,19 +591,19 @@ else
print '</table>';
// Warning 1
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
//print 'x'.$sendmailoption;
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
@ -657,11 +657,11 @@ else
print '<br>';
}
// Affichage formulaire de TEST simple
if ($action == 'test')
// Show email send test form
if ($action == 'test' || $action == 'testhtml')
{
print '<br>';
print_titre($langs->trans("DoTestSend"));
print_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
@ -678,62 +678,16 @@ else
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
$formmail->withtopicreadonly=0;
$formmail->withfile=2;
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:$langs->trans("PredefinedMailTest"));
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->trans("PredefinedMailTestHtml"):$langs->trans("PredefinedMailTest")));
$formmail->withbodyreadonly=0;
$formmail->withcancel=1;
$formmail->withdeliveryreceipt=1;
$formmail->withfckeditor=0;
// 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();
}
$formmail->show_form('addfile','removefile');
print '<br>';
}
// Affichage formulaire de TEST HTML
if ($action == 'testhtml')
{
print '<br>';
print_titre($langs->trans("DoTestSendHTML"));
// 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->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']:$langs->trans("PredefinedMailTestHtml"));
//$formmail->withbody='Test <b>aaa</b> __LOGIN__';
$formmail->withbodyreadonly=0;
$formmail->withcancel=1;
$formmail->withdeliveryreceipt=1;
$formmail->withfckeditor=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"]="sendhtml";
$formmail->param["action"]=($action == 'testhtml'?"sendhtml":"send");
$formmail->param["models"]="body";
$formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
@ -744,7 +698,7 @@ else
$formmail->clear_attached_files();
}
$formmail->show_form('addfilehtml','removefilehtml');
$formmail->show_form(($action == 'testhtml'?'addfilehtml':'addfile'),($action == 'testhtml'?'removefilehtml':'removefile'));
print '<br>';
}

View File

@ -27,7 +27,9 @@
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("admin");
$langs->load("members");
@ -35,6 +37,9 @@ $langs->load("users");
if (! $user->admin) accessforbidden();
$extrafields = new ExtraFields($db);
/*
* Action
*/
@ -71,14 +76,17 @@ if (preg_match('/del_(.*)/',$action,$reg))
* View
*/
llxHeader();
$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios';
llxHeader('',$langs->trans("UsersSetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("UsersSetup"),$linkback,'setup');
print "<br>";
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
$head=user_admin_prepare_head();
dol_fiche_head($head,'card', $langs->trans("User"), 0, 'user');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
@ -114,7 +122,8 @@ else
print '</td></tr>';
print '</table>';
print '<br><br>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -23,8 +23,7 @@
/**
* \class Bookmark
* \brief Class to manage bookmarks
* Class to manage bookmarks
*/
class Bookmark
{

View File

@ -477,12 +477,14 @@ class ActionComm extends CommonObject
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
* @param string $filter Other filter
* @return int <0 if KO, >0 if OK
* @return array <0 if KO, array with actions
*/
function getActions($socid=0, $fk_element=0, $elementtype='', $filter='')
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='')
{
global $conf, $langs;
$resarray=array();
$sql = "SELECT a.id";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " WHERE a.entity = ".$conf->entity;
@ -495,27 +497,27 @@ class ActionComm extends CommonObject
if (! empty($filter)) $sql.= $filter;
dol_syslog(get_class($this)."::getActions sql=".$sql);
$resql=$this->db->query($sql);
$resql=$db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$num = $db->num_rows($resql);
if ($num)
{
for($i=0;$i<$num;$i++)
{
$obj = $this->db->fetch_object($resql);
$actioncommstatic = new ActionComm($this->db);
$obj = $db->fetch_object($resql);
$actioncommstatic = new ActionComm($db);
$actioncommstatic->fetch($obj->id);
$this->actions[$i] = $actioncommstatic;
$resarray[$i] = $actioncommstatic;
}
}
$this->db->free($resql);
return 1;
$db->free($resql);
return $resarray;
}
else
{
$this->error=$this->db->lasterror();
$this->error=$db->lasterror();
return -1;
}
}
@ -707,26 +709,34 @@ class ActionComm extends CommonObject
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'">';
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$this->id.'">';
$lienfin='</a>';
//print $this->libelle;
$label=$this->label;
if (empty($label)) $label=$this->libelle; // Fro backward compatibility
//print 'rrr'.$this->libelle;
if ($withpicto == 2)
{
$libelle=$langs->trans("Action".$this->type_code);
$libelle=$label;
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code);
$libelleshort='';
}
else if (empty($this->libelle))
{
$libelle=$langs->trans("Action".$this->type_code);
$libelleshort=$langs->trans("Action".$this->type_code,'','','','',$maxlength);
$libelle=$label;
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code);
$libelleshort=dol_trunc($label, $maxlength);
}
else
{
$libelle=$this->libelle;
$libelleshort=dol_trunc($this->libelle,$maxlength);
{
$libelle=$label;
$libelleshort=dol_trunc($label,$maxlength);
}
if ($withpicto)
{
$libelle.=(($this->type_code && $libelle!=$langs->trans("Action".$this->type_code) && $langs->trans("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->trans("Action".$this->type_code).')':'');
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
$libelle.=(($this->type_code && $libelle!=$langs->trans("Action".$this->type_code) && $langs->trans("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->trans("Action".$this->type_code).')':'');
}
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle,($overwritepicto?$overwritepicto:'action')).$lienfin;
}
if ($withpicto==1) $result.=' ';

View File

@ -100,9 +100,10 @@ class CActionComm
* @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not
* @return array Array of all event types if OK, <0 if KO
*/
function liste_array($active='',$idorcode='id',$excludetype='')
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
{
global $langs,$conf;
$langs->load("commercial");
@ -110,7 +111,7 @@ class CActionComm
$repid = array();
$repcode = array();
$sql = "SELECT id, code, libelle, module";
$sql = "SELECT id, code, libelle, module, type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
if ($active != '') $sql.=" WHERE active=".$active;
if (! empty($excludetype)) $sql.=($active != ''?" AND":" WHERE")." type <> '".$excludetype."'";
@ -127,20 +128,31 @@ class CActionComm
while ($i < $nump)
{
$obj = $this->db->fetch_object($resql);
$qualified=1;
if ($obj->module)
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTHER)
if ($qualified && $obj->module)
{
if ($obj->module == 'invoice' && ! $conf->facture->enabled) $qualified=0;
if ($obj->module == 'order' && ! $conf->commande->enabled) $qualified=0;
if ($obj->module == 'propal' && ! $conf->propal->enabled) $qualified=0;
if ($obj->module == 'invoice_supplier' && ! $conf->fournisseur->enabled) $qualified=0;
if ($obj->module == 'order_supplier' && ! $conf->fournisseur->enabled) $qualified=0;
if ($obj->module == 'shipping' && ! $conf->expedition->enabled) $qualified=0;
}
if ($qualified)
{
$transcode=$langs->trans("Action".$obj->code);
$repid[$obj->id] = ($transcode!="Action".$obj->code?$transcode:$langs->trans($obj->libelle));
$repcode[$obj->code] = ($transcode!="Action".$obj->code?$transcode:$langs->trans($obj->libelle));
$code=$obj->code;
if ($onlyautoornot && $code == 'AC_OTH') $code='AC_MANUAL';
if ($onlyautoornot && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
$transcode=$langs->trans("Action".$code);
$repid[$obj->id] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->libelle));
$repcode[$obj->code] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->libelle));
if ($onlyautoornot && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
}
$i++;
}

View File

@ -0,0 +1,429 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/comm/action/contact.php
* \ingroup agenda
* \brief Page for multi-users event
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load("companies");
$langs->load("commercial");
$langs->load("other");
$langs->load("bills");
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$ref = GETPOST('ref');
$confirm = GETPOST('confirm');
$lineid = GETPOST('lineid','int');
// Security check
if ($user->societe_id > 0)
{
unset($_GET["action"]);
$action='';
$socid = $user->societe_id;
}
$object = new ActionComm($db);
/*
* Actions
*/
/*
* Ajout d'un nouveau contact
*/
if ($action == 'addcontact')
{
$result = $object->fetch($id);
if ($object->id > 0)
{
$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
}
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
}
else
{
setEventMessage($object->error, 'errors');
}
}
}
// modification d'un contact. On enregistre le type
if ($action == 'updateline')
{
if ($object->fetch($id))
{
$contact = $object->detail_contact($_POST["line"]);
$type = $_POST["type"];
$statut = $contact->statut;
$result = $object->update_contact($_POST["line"], $statut, $type);
if ($result >= 0)
{
$db->commit();
} else
{
dol_print_error($db, "result=$result");
$db->rollback();
}
}
else
{
setEventMessage($object->error, 'errors');
}
}
// Bascule du statut d'un contact
else if ($action == 'swapstatut')
{
if ($object->id > 0)
{
$result=$object->swapContactStatus(GETPOST('ligne'));
}
}
// Efface un contact
else if ($action == 'deletecontact')
{
$result = $object->delete_contact($lineid);
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
$form = new Form($db);
$formcompany= new FormCompany($db);
$contactstatic=new Contact($db);
$userstatic=new User($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
if ($id > 0 || ! empty($ref))
{
dol_htmloutput_mesg($mesg,$mesgs);
if ($object->fetch($id,$ref) > 0)
{
$head=actions_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans("Action"),0,'action');
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
print '</td></tr>';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
}
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>';
// Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour');
else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td rowspan="4" align="center" valign="middle" width="180">'."\n";
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour');
else print dol_print_date($object->datef,'day');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$object->location.'</td></tr>';
print '</table>';
print '</div>';
/*
* Lignes de contacts
*/
print '<br><table class="noborder" width="100%">';
/*
* Ajouter une ligne de contact
* Non affiche en mode modification de ligne
*/
if ($action != 'editline')
{
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
$var = false;
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="source" value="internal">';
print '<input type="hidden" name="id" value="'.$id.'">';
// Ligne ajout pour contact interne
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
print img_object('','user').' '.$langs->trans("Users");
print '</td>';
print '<td colspan="1">';
print $conf->global->MAIN_INFO_SOCIETE_NOM;
print '</td>';
print '<td colspan="1">';
// On recupere les id des users deja selectionnes
$form->select_users($user->id,'contactid',0);
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object, '', 'type','internal','rowid');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
print '</tr>';
print '</form>';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addcontact">';
print '<input type="hidden" name="source" value="external">';
print '<input type="hidden" name="id" value="'.$id.'">';
// Line to add external contact. Only if project is linked to a third party.
if ($object->socid)
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
print img_object('','contact').' '.$langs->trans("ThirdPartyContacts");
print '</td>';
print '<td colspan="1">';
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid;
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany');
print '</td>';
print '<td colspan="1">';
$nbofcontacts=$form->select_contacts($selectedCompany,'','contactid');
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>';
print '<td>';
$formcompany->selectTypeContact($object,'','type','external','rowid');
print '</td>';
print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"';
if (! $nbofcontacts) print ' disabled="true"';
print '></td>';
print '</tr>';
}
print "</form>";
print '<tr><td colspan="6">&nbsp;</td></tr>';
}
// Liste des contacts lies
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Source").'</td>';
print '<td>'.$langs->trans("Company").'</td>';
print '<td>'.$langs->trans("Contacts").'</td>';
print '<td>'.$langs->trans("ContactType").'</td>';
print '<td align="center">'.$langs->trans("Status").'</td>';
print '<td colspan="2">&nbsp;</td>';
print "</tr>\n";
$companystatic = new Societe($db);
$var = true;
foreach(array('internal','external') as $source)
{
$tab = $object->liste_contact(-1,$source);
$num=sizeof($tab);
$i = 0;
while ($i < $num)
{
$var = !$var;
print '<tr '.$bc[$var].' valign="top">';
// Source
print '<td align="left">';
if ($tab[$i]['source']=='internal') print $langs->trans("User");
if ($tab[$i]['source']=='external') print $langs->trans("ThirdPartyContact");
print '</td>';
// Societe
print '<td align="left">';
if ($tab[$i]['socid'] > 0)
{
$companystatic->fetch($tab[$i]['socid']);
print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
print $conf->global->MAIN_INFO_SOCIETE_NOM;
}
if (! $tab[$i]['socid'])
{
print '&nbsp;';
}
print '</td>';
// Contact
print '<td>';
if ($tab[$i]['source']=='internal')
{
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$tab[$i]['id'].'">';
print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].'</a>';
}
if ($tab[$i]['source']=='external')
{
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$tab[$i]['id'].'">';
print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].'</a>';
}
print '</td>';
// Type de contact
print '<td>'.$tab[$i]['libelle'].'</td>';
// Statut
print '<td align="center">';
// Activation desativation du contact
if ($object->statut >= 0 ) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=swapstatut&amp;line='.$tab[$i]['rowid'].'">';
print $contactstatic->LibStatut($tab[$i]['status'],3);
if ($object->statut >= 0 ) print '</a>';
print '</td>';
// Icon update et delete
print '<td align="center" nowrap>';
/*if ($user->rights->business->write && $userAccess)
{*/
print '&nbsp;';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deleteline&amp;line='.$tab[$i]['rowid'].'">';
print img_delete();
print '</a>';
//}
print '</td>';
print "</tr>\n";
$i ++;
}
}
print "</table>";
}
else
{
print "ErrorRecordNotFound";
}
}
llxFooter();
$db->close();
?>

View File

@ -127,7 +127,10 @@ if ($objectid > 0)
print '</td></tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
}
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';

View File

@ -107,6 +107,13 @@ if ($action == 'add_action')
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")).'</div>';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
{
$error++;
$action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Title")).'</div>';
}
// Initialisation objet cactioncomm
if (! GETPOST('actioncode'))
{
@ -122,13 +129,13 @@ if ($action == 'add_action')
// Initialisation objet actioncomm
$actioncomm->type_id = $cactioncomm->id;
$actioncomm->type_code = $cactioncomm->code;
$actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0;
$actioncomm->priority = GETPOST("priority")?GETPOST("priority"):0;
$actioncomm->fulldayevent = (! empty($fulldayevent)?1:0);
$actioncomm->location = isset($_POST["location"])?$_POST["location"]:'';
$actioncomm->label = trim($_POST["label"]);
if (! $_POST["label"])
$actioncomm->location = GETPOST("location");
$actioncomm->label = trim(GETPOST('label'));
if (! GETPOST('label'))
{
if ($_POST["actioncode"] == 'AC_RDV' && $contact->getFullName($langs))
if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs))
{
$actioncomm->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs));
}
@ -390,11 +397,13 @@ if ($action == 'create')
$(".fulldaystartmin").removeAttr("disabled");
$(".fulldayendhour").removeAttr("disabled");
$(".fulldayendmin").removeAttr("disabled");
$("#p2").removeAttr("disabled");
} else {
$(".fulldaystarthour").attr("disabled","disabled").val("00");
$(".fulldaystartmin").attr("disabled","disabled").val("00");
$(".fulldayendhour").attr("disabled","disabled").val("23");
$(".fulldayendmin").attr("disabled","disabled").val("59");
$("#p2").attr("disabled","disabled").val("");
}
}
setdatefields();
@ -432,21 +441,25 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Type d'action actifs
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
if (GETPOST("actioncode"))
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<input type="hidden" name="actioncode" value="'.GETPOST("actioncode").'">'."\n";
$cactioncomm->fetch(GETPOST("actioncode"));
print $cactioncomm->getNomUrl();
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
if (GETPOST("actioncode"))
{
print '<input type="hidden" name="actioncode" value="'.GETPOST("actioncode").'">'."\n";
$cactioncomm->fetch(GETPOST("actioncode"));
print $cactioncomm->getNomUrl();
}
else
{
$htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto");
}
print '</td></tr>';
}
else
{
$htmlactions->select_type_actions($actioncomm->type_code, "actioncode","systemauto");
}
print '</td></tr>';
else print '<input type="hidden" name="actioncode" value="AC_OTH">';
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
// Full day
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
@ -678,10 +691,13 @@ if ($id)
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>';
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
}
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->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" size="50" value="'.$act->label.'"></td></tr>';
// Full day event
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="checked"':'').'></td></tr>';
@ -797,7 +813,10 @@ if ($id)
print '</td></tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
}
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';

View File

@ -340,6 +340,7 @@ if ($action == 'create')
$langs->load("bills");
print '<center>';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraft").'">';
print '&nbsp;<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</center>';
print "</form>";

View File

@ -78,8 +78,6 @@ if ($action == 'del_bookmark' && ! empty($bid))
* View
*/
$now=dol_now();
$form = new Form($db);
$formfile = new FormFile($db);
$companystatic=new Societe($db);

View File

@ -136,7 +136,7 @@ if ($action == 'delete')
$classname = "MailingTargets";
$obj = new $classname($db);
$obj->update_nb($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
@ -298,7 +298,7 @@ if ($object->fetch($id) >= 0)
}
print '<td>';
if (! $obj->picto) $obj->picto='generic';
if (empty($obj->picto)) $obj->picto='generic';
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc();
print '</td>';

View File

@ -337,16 +337,30 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
$i++;
}
}
else
{
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
}
// Loop finished, set global statut of mail
if ($nbko > 0)
{
$statut=2; // Status 'sent partially' (because at least one error)
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
if ($nbok >= $num) $statut=3; // Send to everybody
else $statut=2; // Status 'sent partially' (because not send to everybody)
if ($nbok >= $num)
{
$statut=3; // Send to everybody
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
else
{
$statut=2; // Status 'sent partially' (because not send to everybody)
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
}
}
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
@ -388,8 +402,8 @@ if ($action == 'send' && empty($_POST["cancel"]))
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
// Pratique les substitutions sur le sujet et message
$object->sujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$object->body=make_substitutions($object->body,$object->substitutionarrayfortest);
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
$arr_file = array();
$arr_mime = array();
@ -412,7 +426,7 @@ if ($action == 'send' && empty($_POST["cancel"]))
}
}
$mailfile = new CMailFile($object->sujet,$object->sendto,$object->email_from,$object->body, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
$mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
$result=$mailfile->sendfile();
if ($result)
@ -1148,7 +1162,6 @@ else
}
}
llxFooter();
$db->close();
?>

View File

@ -1565,21 +1565,19 @@ print '<td align="right" nowrap>'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Amount Local Taxes
if ($mysoc->country_code=='ES')
if ($mysoc->localtax1_assuj=="1") //Localtax1
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
// Amount TTC
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>';

View File

@ -43,7 +43,7 @@ $result = restrictedArea($user, 'propal');
/*
* View
*/
$now=dol_now();
$propalstatic=new Propal($db);
$companystatic=new Societe($db);
$form = new Form($db);
@ -288,7 +288,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$now=dol_now();
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -328,7 +328,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
if ($db->jdate($obj->dp) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);

View File

@ -1581,18 +1581,16 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->country_code=='ES')
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
}
else
@ -1814,11 +1812,8 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
if (! empty($conf->projet->enabled)) $nbrow++;
//Local taxes
if ($mysoc->country_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($mysoc->localtax2_assuj=="1") $nbrow++;
}
if($mysoc->localtax1_assuj=="1") $nbrow++;
if($mysoc->localtax2_assuj=="1") $nbrow++;
print '<table class="border" width="100%">';
@ -2075,20 +2070,17 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Amount Local Taxes
if ($mysoc->country_code=='ES')
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
// Total TTC

View File

@ -41,8 +41,10 @@ function commissions_admin_prepare_head()
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin','remove');
return $head;
}

View File

@ -18,7 +18,6 @@
/**
* \file htdocs/compta/ajaxpayment.php
* \brief File to return Ajax response on payment breakdown process
* \version ajaxpayment.php,v 1.0
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
@ -33,8 +32,14 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$langs->Load('compta');
$langs->load('compta');
/*
* View
*/
//init var
$amountPayment = $_POST['amountPayment'];
@ -42,26 +47,31 @@ $amounts = $_POST['amounts']; // from text inputs : invoice amount payment (c
$remains = $_POST['remains']; // from dolibarr's object (no need to check)
$currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id)
// Getting the posted keys=>values, sanitize the ones who are from text inputs
// from text inputs : total amount
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment)
: ''
)
: ''; // keep void if not a valid entry
// Checkamounts
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry
// Clean checkamounts
foreach ($amounts as $key => $value)
{
$value = price2num($value);
if (!is_numeric($value)) unset($amounts[$key]);
$amounts[$key]=$value;
if (empty($value)) unset($amounts[$key]);
}
// Clean remains
foreach ($remains as $key => $value)
{
$value = price2num($value);
$remains[$key]=$value;
if (empty($value)) unset($remains[$key]);
}
// Treatment
$result = $amountPayment != '' ? $amountPayment - array_sum($amounts) : $amountPayment + array_sum($amounts); // Remaining amountPayment
$result = $amountPayment != '' ? ($amountPayment - array_sum($amounts)) : ($amountPayment + array_sum($amounts)); // Remaining amountPayment
$toJsonArray = array();
$totalRemaining = price2num(array_sum($remains));
$toJsonArray['label'] = $amountPayment == '' ? $langs->transnoentities('AmountToBeCharged') : $langs->transnoentities('RemainingAmountPayment');
if($currentInvId) // Here to breakdown
$toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment');
if ($currentInvId) // Here to breakdown
{
// Get the current amount (from form) and the corresponding remainToPay (from invoice)
$currentAmount = $amounts['amount_'.$currentInvId];
@ -99,9 +109,11 @@ if($currentInvId) // Here to breakdown
}
$toJsonArray['amount_'.$currentInvId] = price2num($currentAmount).""; // Param will exist only if an img has been clicked
}
// Encode to JSON to return
$toJsonArray['makeRed'] = $totalRemaining < price2num($result) || price2num($result) < 0 ? true : false;
$toJsonArray['result'] = price2num($result);
echo json_encode($toJsonArray); // Printing the call's result
$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0) ? true : false;
$toJsonArray['result'] = price($result); // Return value to user format
$toJsonArray['resultnum'] = price2num($result); // Return value to numeric format
// Encode to JSON to return
echo dol_json_encode($toJsonArray); // Printing the call's result
?>

View File

@ -757,6 +757,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->amount = $_POST['amount'];
$object->remise_absolue = $_POST['remise_absolue'];
$object->remise_percent = $_POST['remise_percent'];
$object->fetch_thirdparty();
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid'])
@ -2078,17 +2079,14 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->pays_code=='ES')
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
}
@ -2654,11 +2652,8 @@ else if ($id > 0 || ! empty($ref))
if (! empty($conf->banque->enabled)) $nbcols++;
//Local taxes
if ($mysoc->pays_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++;
}
if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++;
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';

View File

@ -280,12 +280,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
$(\'#fieldchqemetteur\').val(\'\');
}
}';
// For paiement auto-completion
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
{
print "\n".'
function elemToJson(selector)
}
function _elemToJson(selector)
{
var subJson = {};
$.map(selector.serializeArray(), function(n,i)
@ -300,14 +297,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
var form = $("#payment_form");
json["amountPayment"] = $("#amountpayment").attr("value");
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]"));
json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]"));
if (imgId != null) {
json["imgClicked"] = imgId;
}
$.post("ajaxpayment.php", json, function(data)
$.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
{
json = $.parseJSON(data);
@ -317,9 +314,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
if (key == "result") {
if (json["makeRed"]) {
$("#"+key).css("color", "red");
$("#"+key).addClass("error");
} else {
$("#"+key).removeAttr("style");
$("#"+key).removeClass("error");
}
json[key]=json["label"]+" "+json[key];
$("#"+key).text(json[key]);
@ -331,27 +328,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
});
}
function callToBreakdown(imgSelector) {
var form = $("#payment_form"), imgId;
imgId = imgSelector.attr("id");
callForResult(imgId);
}
$("#payment_form").find("img").click(function() {
callToBreakdown(jQuery(this));
});
$("#payment_form").find("input[name*=\"amount_\"]").change(function() {
callForResult();
});
$("#payment_form").find("input[name*=\"amount_\"]").keyup(function() {
callForResult();
});
';
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
{
print ' $("#payment_form").find("img").click(function() {
callForResult(jQuery(this).attr("id"));
});
$("#amountpayment").change(function() {
callForResult();
});';
}
print '});
</script>'."\n";
print ' });'."\n";
print ' </script>'."\n";
}
print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -573,7 +570,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print '</b></td>';
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight:bold;"></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n";
}

View File

@ -28,9 +28,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
// FIXME don't include external module class
if (! empty($conf->esaeb->enabled))
dol_include_once('/esaeb/class/esaeb19.class.php');
/**
@ -481,7 +478,6 @@ class BonPrelevement extends CommonObject
/*
* End of procedure
*
*/
if ($error == 0)
{
@ -550,17 +546,12 @@ class BonPrelevement extends CommonObject
// TODO Call trigger to create a notification using notification module
}
else
{
{
dol_syslog(get_class($this)."::set_infotrans Erreur 1", LOG_ERR);
dol_syslog($this->db->error());
$error++;
}
/*
* End of procedure
*
*/
if ($error == 0)
{
$this->db->commit();
@ -928,7 +919,7 @@ class BonPrelevement extends CommonObject
}
/*
* Creation process
* Create withdrawal receipt
*/
if (!$error)
{
@ -1051,6 +1042,44 @@ class BonPrelevement extends CommonObject
}
/**
* Get object and lines from database
*
* @return int >0 if OK, <0 if KO
*/
function delete()
{
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = '".$this->id."')";
$resql1=$this->db->query($sql);
if (! $resql1) dol_print_error($this->db);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = '".$this->id."'";
$resql2=$this->db->query($sql);
if (! $resql2) dol_print_error($this->db);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = '".$this->id."'";
$resql3=$this->db->query($sql);
if (! $resql3) dol_print_error($this->db);
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = '".$this->id."'";
$resql4=$this->db->query($sql);
if (! $resql4) dol_print_error($this->db);
if ($resql1 && $resql2 && $resql3)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return -1;
}
}
/**
* Returns clickable name (with picto)
*
@ -1181,12 +1210,15 @@ class BonPrelevement extends CommonObject
$this->file = fopen($this->filename,"w");
// TODO Move code for es and fr into an external module file with selection into setup of prelevement module
// Build file for Spain
if ($mysoc->country_code=='ES')
{
// TODO replace by a hook (external modules)
if (! empty($conf->esaeb->enabled))
{
dol_include_once('/esaeb/class/esaeb19.class.php');
//Head
$esaeb19 = new AEB19DocWritter;
$esaeb19->configuraPresentador($this->numero_national_emetteur,$conf->global->ESAEB_SUFIX_PRESENTADOR,$this->raison_sociale,$this->emetteur_code_banque,$this->emetteur_code_guichet);
@ -1239,7 +1271,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, $esaeb19->generaRemesa());
}
else
{
{
$this->total = 0;
$sql = "SELECT pl.amount";
$sql.= " FROM";
@ -1271,10 +1303,8 @@ class BonPrelevement extends CommonObject
$langs->load('withdrawals');
fputs($this->file, $langs->trans('WithdrawalFileNotCapable'));
}
}
//Build file for France
// Build file for France
elseif ($mysoc->country_code=='FR')
{
/*
@ -1316,7 +1346,7 @@ class BonPrelevement extends CommonObject
}
}
else
{
{
$result = -2;
}
@ -1326,10 +1356,9 @@ class BonPrelevement extends CommonObject
$this->EnregTotal($this->total);
}
//Build file for Other Countries with unknow format
// Build file for Other Countries with unknow format
else
{
{
$this->total = 0;
$sql = "SELECT pl.amount";
$sql.= " FROM";
@ -1599,20 +1628,20 @@ class BonPrelevement extends CommonObject
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut4').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut4');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 3)
{
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut4');
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
}

View File

@ -55,27 +55,21 @@ if ($prev_id)
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipt"), '', 'payment');
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
@ -89,10 +83,19 @@ if ($prev_id)
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
print '</div>';
print '</table>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
}
else
{

View File

@ -54,27 +54,21 @@ if ($prev_id)
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipt"), '', 'payment');
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
@ -88,10 +82,19 @@ if ($prev_id)
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
print '</div>';
print '</table>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
}
else
{
@ -103,8 +106,6 @@ $rej = new RejetPrelevement($db, $user);
/*
* Liste des factures
*
*
*/
$sql = "SELECT pl.rowid, pl.amount, pl.statut";
$sql.= " , s.rowid as socid, s.nom";
@ -141,10 +142,10 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print "<tr $bc[$var]><td>";
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print "<tr ".$bc[$var]."><td>";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
@ -164,7 +165,7 @@ if ($resql)
print '<tr class="liste_total"><td>&nbsp;</td>';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>\n";
print '<td>&nbsp;</td>';
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n</table>\n";
$db->free($resql);
}

View File

@ -58,24 +58,17 @@ if ($prev_id)
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
@ -89,10 +82,19 @@ if ($prev_id)
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
print '</div>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
}
else
{

View File

@ -42,14 +42,28 @@ if ($user->societe_id > 0) accessforbidden();
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
/*
* Actions
*/
if ( $action == 'confirm_delete' )
{
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$res=$bon->delete();
if ($res > 0)
{
header("Location: index.php");
exit;
}
}
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
{
$bon = new BonPrelevement($db,"");
$bon->id = $id;
$bon->fetch($id);
$bon->set_credite();
header("Location: fiche.php?id=".$id);
@ -63,14 +77,15 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
/*
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
{
$dir = $conf->prelevement->dir_output.'/receipts';
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
{
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
}
@ -81,6 +96,14 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
dol_syslog("Fichier invalide",LOG_WARNING);
$mesg='BadFile';
}*/
$error = $bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
if ($error)
{
header("Location: fiche.php?id=".$id."&error=$error");
exit;
}
}
@ -92,15 +115,11 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
$error = $bon->set_infocredit($user, $dt);
if ($error == 0)
{
header("Location: fiche.php?id=".$id);
}
else
if ($error)
{
header("Location: fiche.php?id=".$id."&error=$error");
exit;
}
exit;
}
@ -108,132 +127,139 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
* View
*/
llxHeader('',$langs->trans("WithdrawalReceipt"));
$bon = new BonPrelevement($db,"");
$form = new Form($db);
if ($id)
llxHeader('',$langs->trans("WithdrawalReceipt"));
if ($id > 0)
{
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
if ($bon->fetch($id) == 0)
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment');
if (GETPOST('error','alpha')!='')
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment');
print '<div class="error">'.$bon->ReadError(GETPOST('error','alpha')).'</div>';
}
if (GETPOST('error','alpha')!='')
{
print '<div class="error">'.$bon->ReadError(GETPOST('error','alpha')).'</div>';
}
/*if ($action == 'credite')
{
$ret=$form->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
if ($ret == 'html') print '<br>';
}*/
if ($action == 'credite')
{
$ret=$form->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
if ($ret == 'html') print '<br>';
}
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print '</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>';
if($bon->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
{
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
dol_fiche_end();
if($bon->date_trans == 0 && $user->rights->prelevement->bons->send)
{
print '<form method="post" name="userfile" action="fiche.php?id='.$bon->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infotrans">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print $form->select_date('','','','','',"userfile");
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans);
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input class="flat" type="file" name="userfile"><br>';
print '</td></tr>';
print '</table><br>';
print '<center><input type="submit" class="button" value="'.$langs->trans("Send").'">';
print '</form>';
}
if($bon->date_trans <> 0 && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit)
{
print '<form name="infocredit" method="post" action="fiche.php?id='.$bon->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infocredit">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print $form->select_date('','','','','',"infocredit");
print '</td></tr>';
print '</table><br>';
print '<center><input type="submit" class="button" value="'.$langs->trans("ClassCredited").'">';
print '</form>';
}
}
else
if($bon->date_credit <> 0)
{
dol_print_error($db);
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print '</td></tr>';
}
print '</table>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
{
print '<form method="post" name="userfile" action="fiche.php?id='.$bon->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infotrans">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print $form->select_date('','','','','',"userfile",1,1);
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans);
print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input class="flat" type="file" name="userfile"><br>';
print '</td></tr>';*/
print '</table><br>';
print '<center><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("SetToStatusSent")).'">';
print '</form>';
}
if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
{
print '<form name="infocredit" method="post" action="fiche.php?id='.$bon->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infocredit">';
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print $form->select_date('','','','','',"infocredit",1,1);
print '</td></tr>';
print '</table>';
print '<br>'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice");
print '<center><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("ClassCredited")).'">';
print '</form>';
}
// Actions
if ($action != 'settransmitted' && $action != 'setcredited')
{
print "\n<div class=\"tabsAction\">\n";
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send)
{
print "<a class=\"butAction\" href=\"fiche.php?action=settransmitted&id=".$bon->id."\">".$langs->trans("SetToStatusSent")."</a>";
}
if (! empty($bon->date_trans) && $bon->date_credit == 0)
{
print "<a class=\"butAction\" href=\"fiche.php?action=setcredited&id=".$bon->id."\">".$langs->trans("ClassCredited")."</a>";
}
print "<a class=\"butActionDelete\" href=\"fiche.php?action=confirm_delete&id=".$bon->id."\">".$langs->trans("Delete")."</a>";
print "</div>";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
/*
print "\n</div>\n<div class=\"tabsAction\">\n";
if ($bon->statut == 0)
{
print "<a class=\"butAction\" href=\"fiche.php?action=credite&amp;id=$bon->id\">".$langs->trans("ClassCredited")."</a>";
}
*/
print "</div>";
$db->close();
llxFooter();
$db->close();
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
@ -93,10 +93,10 @@ print '</td><td valign="top" width="70%">';
* Withdraw receipts
*/
$limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec";
$sql .= " ,p.statut ";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " ORDER BY datec DESC LIMIT ".$limit;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " ORDER BY datec DESC";
$sql.= $db->plimit($limit);
$result = $db->query($sql);
if ($result)
@ -110,6 +110,7 @@ if ($result)
print '<tr class="liste_titre"><td>'.$langs->trans("LastWithdrawalReceipt",$limit).'</td>';
print '<td>'.$langs->trans("Date").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td align="right">'.$langs->trans("Status").'</td>';
print '</tr>';
while ($i < min($num,$limit))
@ -117,15 +118,17 @@ if ($result)
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a>&nbsp;';
print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print "<tr ".$bc[$var].">";
print "<td>";
$bprev->id=$obj->rowid;
$bprev->ref=$obj->ref;
$bprev->statut=$obj->statut;
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td>'.dol_print_date($db->jdate($obj->datec),"dayhour")."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="right">'.$bprev->getLibStatut(3)."</td>\n";
print "</tr>\n";
$i++;

View File

@ -65,13 +65,6 @@ if ($prev_id)
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr>';
// Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
@ -99,7 +92,16 @@ if ($prev_id)
print '</table>';
print '</div>';
print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref;
print '<a href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
dol_fiche_end();
}
else
{

View File

@ -214,11 +214,11 @@ if ($action == 'create')
print '<td>&nbsp;</td>';
// Label
print '<td align="left"><input type="text" size="34" name="label" class="flat"></td>';
print '<td align="left"><input type="text" size="34" name="label" class="flat" value="'.GETPOST('label').'"></td>';
// Type
print '<td align="left">';
$formsocialcontrib->select_type_socialcontrib(isset($_POST["actioncode"])?$_POST["actioncode"]:'','actioncode',1);
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode")?GETPOST("actioncode"):'','actioncode',1);
print '</td>';
// Date end period

View File

@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* \class Contact
* \brief Classe permettant la gestion des contacts
* Class to manage contact/addresses
*/
class Contact extends CommonObject
{
@ -128,6 +127,7 @@ class Contact extends CommonObject
$sql.= ", priv";
$sql.= ", canvas";
$sql.= ", entity";
$sql.= ", import_key";
$sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."',";
if ($this->socid > 0) $sql.= " ".$this->socid.",";
@ -136,8 +136,9 @@ class Contact extends CommonObject
$sql.= "'".$this->db->escape($this->firstname)."',";
$sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").",";
$sql.= " ".$this->priv.",";
$sql.= " ".($this->canvas?"'".$this->canvas."'":"null").",";
$sql.= " ".$conf->entity;
$sql.= " ".(! empty($this->canvas)?"'".$this->canvas."'":"null").",";
$sql.= " ".$conf->entity.",";
$sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null");
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql);

View File

@ -361,7 +361,7 @@ else
$object->state_id = $_POST["state_id"];
// We set country_id, country_code and label for the selected country
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$object->country_id=$_POST["country_id"]?$_POST["country_id"]:(empty($objsoc->country_id)?$mysoc->country_id:$objsoc->country_id);
if ($object->country_id)
{
$tmparray=getCountry($object->country_id,'all');
@ -434,7 +434,7 @@ else
$colspan=3;
if ($conf->use_javascript_ajax && $socid > 0) $colspan=2;
// Address
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party
print '<tr><td>'.$langs->trans("Address");
@ -442,9 +442,9 @@ else
if ($conf->use_javascript_ajax && $socid > 0)
{
$rowspan=3;
$rowspan=3;
if (empty($conf->global->SOCIETE_DISABLE_STATE)) $rowspan++;
print '<td valign="middle" align="center" rowspan="'.$rowspan.'">';
print '<a href="#" id="copyaddressfromsoc">'.$langs->trans('CopyAddressFromSoc').'</a>';
print '</td>';
@ -460,7 +460,6 @@ else
print '</td></tr>';
// Country
if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->country_id; // Predefined with third party
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="'.$colspan.'">';
print $form->select_country((isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id),'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);

View File

@ -221,14 +221,16 @@ abstract class CommonObject
* @param int $rowid Id of line contact-element
* @param int $statut New status of link
* @param int $type_contact_id Id of contact type (not modified if 0)
* @param int $fk_socpeople Id of soc_people to update (not modified if 0)
* @return int <0 if KO, >= 0 if OK
*/
function update_contact($rowid, $statut, $type_contact_id=0)
function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0)
{
// Insertion dans la base
$sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set";
$sql.= " statut = ".$statut;
if ($type_contact_id) $sql.= ", fk_c_type_contact = '".$type_contact_id ."'";
if ($fk_socpeople) $sql.= ", fk_socpeople = '".$fk_socpeople ."'";
$sql.= " where rowid = ".$rowid;
$resql=$this->db->query($sql);
if ($resql)
@ -1516,27 +1518,49 @@ abstract class CommonObject
$this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc;
// Define vatrates with totals for each line and for all lines
// TODO $vatrates and $vatrates_alllines not used ?
if (! empty($this->vatrate))
// Check if global invoice tax for this vat rate
if (! empty($obj->vatrate))
{
$vatrates[$this->vatrate][]=array(
'total_ht' =>$obj->total_ht,
'total_tva' =>$obj->total_tva,
'total_ttc' =>$obj->total_ttc,
'total_localtax1'=>$obj->total_localtax1,
'total_localtax2'=>$obj->total_localtax2
);
if (! isset($vatrates_alllines[$this->vatrate]['total_ht'])) $vatrates_alllines[$this->vatrate]['total_ht']=0;
if (! isset($vatrates_alllines[$this->vatrate]['total_tva'])) $vatrates_alllines[$this->vatrate]['total_tva']=0;
if (! isset($vatrates_alllines[$this->vatrate]['total_localtax1'])) $vatrates_alllines[$this->vatrate]['total_localtax1']=0;
if (! isset($vatrates_alllines[$this->vatrate]['total_localtax2'])) $vatrates_alllines[$this->vatrate]['total_localtax2']=0;
if (! isset($vatrates_alllines[$this->vatrate]['total_ttc'])) $vatrates_alllines[$this->vatrate]['total_ttc']=0;
$vatrates_alllines[$this->vatrate]['total_ht'] +=$obj->total_ht;
$vatrates_alllines[$this->vatrate]['total_tva'] +=$obj->total_tva;
$vatrates_alllines[$this->vatrate]['total_localtax1']+=$obj->total_localtax1;
$vatrates_alllines[$this->vatrate]['total_localtax2']+=$obj->total_localtax2;
$vatrates_alllines[$this->vatrate]['total_ttc'] +=$obj->total_ttc;
if ($this->total_localtax1 == 0)
{
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$this->client->country_code."'";
$sql .= " AND t.taux = ".$obj->vatrate." AND t.active = 1";
dol_syslog("get_localtax sql=".$sql);
$resqlt=$this->db->query($sql);
if ($resqlt)
{
$objt = $this->db->fetch_object($resqlt);
if ($objt->localtax1_type == '7')
{
$this->total_localtax1 += $objt->localtax1;
$this->total_ttc += $objt->localtax1;
}
}
}
if ($this->total_localtax2 == 0)
{
// Search local taxes
$sql = "SELECT t.localtax2, t.localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$this->client->country_code."'";
$sql .= " AND t.taux = ".$obj->vatrate." AND t.active = 1";
dol_syslog("get_localtax sql=".$sql);
$resqlt=$this->db->query($sql);
if ($resqlt)
{
$objt = $this->db->fetch_object($resqlt);
if ($objt->localtax2_type == '7')
{
$this->total_localtax2 += $objt->localtax2;
$this->total_ttc += $objt->localtax2;
}
}
}
}
$i++;
@ -1544,21 +1568,6 @@ abstract class CommonObject
$this->db->free($resql);
// TODO
if ($roundingadjust)
{
// For each vatrate, calculate if two method of calculation differs
// If it differs
if (1==2)
{
// Adjust a line and update it
}
}
// Now update global field total_ht, total_ttc and tva
$fieldht='total_ht';
$fieldtva='tva';

View File

@ -60,6 +60,7 @@ class Conf
public $societe_modules = array();
var $logbuffer = array();
var $loghandlers = array();
//! To store properties of multi-company
public $multicompany;
@ -371,7 +372,7 @@ class Conf
$this->css = "/theme/".$this->theme."/style.css.php";
// conf->email_from = email pour envoi par dolibarr des mails automatiques
$this->email_from = "dolibarr-robot@domain.com";
$this->email_from = "robot@domain.com";
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
// conf->notification->email_from = email pour envoi par Dolibarr des notifications
@ -456,6 +457,27 @@ class Conf
{
if (is_object($mc)) $mc->setValues($this);
}
// We init log handlers
if (defined('SYSLOG_HANDLERS')) $handlers = json_decode(constant('SYSLOG_HANDLERS'));
else $handlers = array();
foreach ($handlers as $handler)
{
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
if (!file_exists($file))
{
throw new Exception('Missing log handler file '.$handler.'.php');
}
require_once $file;
$loghandlerinstance = new $handler();
if (!$loghandlerinstance instanceof LogHandlerInterface)
{
throw new Exception('Log handler does not extend LogHandlerInterface');
}
$this->loghandlers[]=$loghandlerinstance;
}
}
}

View File

@ -42,7 +42,7 @@ class ExtraFields
var $attribute_unique;
// Array to store if attribute is required or not
var $attribute_required;
var $error;
var $errno;
@ -439,6 +439,10 @@ class ExtraFields
$array_name_label=array();
// For avoid conflicts with external modules
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
return $array_name_label;
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity = ".$conf->entity;

View File

@ -115,7 +115,8 @@ class HookManager
* @param Object &$object Object to use hooks on
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,...: Return HTML string.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Must always return an int and things to print into ->resprints.
* Can also return some values into an array ->results.
* $this->error or this->errors are also defined by class called by this function if error.
*/
function executeHooks($method, $parameters=false, &$object='', &$action='')
@ -127,45 +128,58 @@ class HookManager
// Loop on each hook to qualify modules that declared context
$modulealreadyexecuted=array();
$resaction=0; $resprint='';
$resaction=0; $error=0;
$this->resPrint=''; $this->resArray=array();
foreach($this->hooks as $modules) // this->hooks is an array with context as key and value is an array of modules that handle this context
{
if (! empty($modules))
{
foreach($modules as $module => $actionclassinstance)
{
// test to avoid to run twice a hook, when a module implements several active contexts
// jump to next class if method does not exists
if (! method_exists($actionclassinstance,$method)) continue;
// test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$module]=$module;
// Hooks that return int
if (($method == 'doActions' || $method == 'formObjectOptions') && method_exists($actionclassinstance,$method))
if (($method == 'doActions' || $method == 'formObjectOptions'))
{
$resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
{
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
if ($method == 'doActions')
{
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
if ($action=='update') $action='edit'; // TODO this change must be inside the doActions
}
}
$resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
{
$error++;
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
// TODO remove this. Change must be inside the method if required
if ($method == 'doActions')
{
if ($action=='add') $action='create';
if ($action=='update') $action='edit';
}
}
}
// Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...)
else if (method_exists($actionclassinstance,$method))
// Generic hooks that return a string (printSearchForm, printLeftBlock, printTopRightMenu, formAddObjectLine, formBuilddocOptions, ...)
else
{
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
// TODO. this should be done into the method by returning nothing
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
$result = $actionclassinstance->$method($parameters, $object, $action, $this);
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
// TODO. remove this. array result must be set into $actionclassinstance->results
if (is_array($result)) $this->resArray = array_merge($this->resArray, $result);
else $resprint.=$result;
// TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string
if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
}
}
}
}
if ($method == 'doActions' || $method == 'formObjectOptions') return $resaction;
return $resprint;
if ($method != 'doActions' && $method != 'formObjectOptions') return $this->resPrint; // TODO remove this. When there is something to print, ->resPrint is filled.
return ($error?-1:$resaction);
}
}

View File

@ -165,6 +165,10 @@ class Form
{
$ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname);
}
else if ($typeofdata == 'datehourpicker')
{
$ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname,1,1);
}
else if (preg_match('/^select;/',$typeofdata))
{
$arraydata=explode(',',preg_replace('/^select;/','',$typeofdata));
@ -183,7 +187,7 @@ class Form
$ret.=$doleditor->Create(1);
}
$ret.='</td>';
if ($typeofdata != 'day' && $typeofdata != 'datepicker') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
$ret.='</tr></table>'."\n";
$ret.='</form>'."\n";
}
@ -192,6 +196,7 @@ class Form
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
else if (preg_match('/^select;/',$typeofdata))
{
$arraydata=explode(',',preg_replace('/^select;/','',$typeofdata));
@ -272,7 +277,7 @@ class Form
if (! empty($tmp[1])) $inputOption=$tmp[1];
if (! empty($tmp[2])) $savemethod=$tmp[2];
}
else if (preg_match('/^datepicker/',$inputType))
else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType)))
{
$tmp=explode(':',$inputType);
$inputType=$tmp[0];
@ -1447,7 +1452,8 @@ class Form
$num = $this->db->num_rows($result);
$outselect.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';
//$outselect.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax
$outselect.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
if (! $selected) $outselect.='<option value="0" selected="selected">&nbsp;</option>';
else $outselect.='<option value="0">&nbsp;</option>';
@ -2231,6 +2237,9 @@ class Form
$inputok=array();
$inputko=array();
// Clean parameters
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
if (is_array($formquestion) && ! empty($formquestion))
{
$more.='<table class="paddingrightonly" width="100%">'."\n";
@ -2337,7 +2346,15 @@ class Form
$formconfirm.='
$(function() {
$( "#'.$dialogconfirm.'" ).dialog({
autoOpen: '.($autoOpen ? "true" : "false").',
autoOpen: '.($autoOpen ? "true" : "false").',';
if ($newselectedchoice == 'no')
{
$formconfirm.='
open: function() {
$(this).parent().find("button.ui-button:eq(1)").focus();
},';
}
$formconfirm.='
resizable: false,
height: "'.$height.'",
width: "'.$width.'",
@ -2383,11 +2400,12 @@ class Form
}
});
var button = "'.$button.'";
if (button.length > 0) {
$( "#" + button ).click(function() {
$("#'.$dialogconfirm.'").dialog("open");
});
});
}
});
</script>';
@ -2417,7 +2435,6 @@ class Form
$formconfirm.= '<tr class="valid">';
$formconfirm.= '<td class="valid">'.$question.'</td>';
$formconfirm.= '<td class="valid">';
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
$formconfirm.= $this->selectyesno("confirm",$newselectedchoice);
$formconfirm.= '</td>';
$formconfirm.= '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>';
@ -2601,9 +2618,11 @@ class Form
* @param string $page Page
* @param string $selected Date preselected
* @param string $htmlname Name of input html field
* @param int $displayhour Display hour selector
* @param int $displaymin Display minutes selector
* @return void
*/
function form_date($page, $selected, $htmlname)
function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0)
{
global $langs;
@ -2614,7 +2633,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname);
print $this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';

View File

@ -144,10 +144,10 @@ class FormActions
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
$actioncomm->getActions($socid, $object->id, $typeelement);
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
if (is_numeric($listofactions) && $listofactions < 0) dol_print_error($this->db,'FailedToGetActions');
$num = count($actioncomm->actions);
$num = count($listofactions);
if ($num)
{
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
@ -164,17 +164,29 @@ class FormActions
$total = 0; $var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans('Ref').'</th><th class="liste_titre">'.$langs->trans('Date').'</th><th class="liste_titre">'.$langs->trans('Action').'</th><th class="liste_titre">'.$langs->trans('By').'</th></tr>';
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans('Ref').'</th>';
print '<th class="liste_titre">'.$langs->trans('Action').'</th>';
print '<th class="liste_titre">'.$langs->trans('Date').'</th>';
print '<th class="liste_titre">'.$langs->trans('By').'</th>';
print '</tr>';
print "\n";
foreach($actioncomm->actions as $action)
$userstatic = new User($this->db);
foreach($listofactions as $action)
{
$savlabel=$action->label;
$action->label=$action->ref;
$ref=$action->getNomUrl(1);
$action->label=$savlabel;
$label=$action->getNomUrl(0,38);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$action->getNomUrl(1).'</td>';
print '<td>'.$ref.'</td>';
print '<td>'.$label.'</td>';
print '<td>'.dol_print_date($action->datep,'day').'</td>';
print '<td title="'.dol_escape_htmltag($action->label).'">'.dol_trunc($action->label,32).'</td>';
$userstatic = new User($this->db);
$userstatic->id = $action->author->id;
$userstatic->firstname = $action->author->firstname;
$userstatic->lastname = $action->author->lastname;
@ -194,9 +206,10 @@ class FormActions
* @param string $selected Type pre-selectionne
* @param string $htmlname Nom champ formulaire
* @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not
* @return void
*/
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='')
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0)
{
global $langs,$user;
@ -205,12 +218,13 @@ class FormActions
$caction=new CActionComm($this->db);
$form=new Form($this->db);
$arraylist=$caction->liste_array(1, 'code', $excludetype);
array_unshift($arraylist,'&nbsp;'); // Add empty line at start
//asort($arraylist);
// Suggest a list with manual event or all auto events
$arraylist=$caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
array_unshift($arraylist,'&nbsp;'); // Add empty line at start
//asort($arraylist);
print $form->selectarray($htmlname, $arraylist, $selected);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
if ($user->admin && empty($onlyautoornot)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
}

View File

@ -143,6 +143,9 @@ class Translate
* If data for file already loaded, do nothing.
* All data in translation array are stored in UTF-8 format.
* tab_loaded is completed with $domain key.
* Warning: MAIN_USE_CUSTOM_TRANSLATION is an old deprecated feature. Do not use it. It will revert
* rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do.
*
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
*
* @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files:
@ -198,13 +201,14 @@ class Translate
// Directory of translation files
$file_lang = $searchdir.($modulename?'/'.$modulename:'')."/langs/".$langofdir."/".$newdomain.".lang";
$file_lang_osencoded=dol_osencode($file_lang);
$filelangexists=is_file($file_lang_osencoded);
//dol_syslog('Translate::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' file_lang='.$file_lang." => filelangexists=".$filelangexists);
if ($filelangexists)
{
// TODO Move cache read out of loop on dirs
// TODO Move cache read out of loop on dirs or at least filelangexists
$found=false;
// Enable caching of lang file in memory (not by default)

View File

@ -26,8 +26,7 @@
/**
* \class DoliDBMysql
* \brief Class to manage Dolibarr database access for a Mysql database
* Class to manage Dolibarr database access for a Mysql database
*/
class DoliDBMysql
{
@ -291,12 +290,14 @@ class DoliDBMysql
{
$this->transaction_opened++;
dol_syslog("BEGIN Transaction",LOG_DEBUG);
dol_syslog('',0,1);
}
return $ret;
}
else
{
$this->transaction_opened++;
dol_syslog('',0,1);
return 1;
}
}
@ -309,6 +310,7 @@ class DoliDBMysql
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
@ -334,6 +336,7 @@ class DoliDBMysql
*/
function rollback($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");

View File

@ -26,8 +26,7 @@
/**
* \class DoliDBMysqli
* \brief Class to manage Dolibarr database access for a Mysql database
* Class to manage Dolibarr database access for a Mysql database
*/
class DoliDBMysqli
{
@ -286,12 +285,14 @@ class DoliDBMysqli
{
$this->transaction_opened++;
dol_syslog("BEGIN Transaction",LOG_DEBUG);
dol_syslog('',0,1);
}
return $ret;
}
else
{
$this->transaction_opened++;
dol_syslog('',0,1);
return 1;
}
}
@ -304,7 +305,8 @@ class DoliDBMysqli
*/
function commit($log='')
{
if ($this->transaction_opened<=1)
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
@ -329,7 +331,8 @@ class DoliDBMysqli
*/
function rollback($log='')
{
if ($this->transaction_opened<=1)
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;

View File

@ -474,12 +474,14 @@ class DoliDBPgsql
{
$this->transaction_opened++;
dol_syslog("BEGIN Transaction",LOG_DEBUG);
dol_syslog('',0,1);
}
return $ret;
}
else
{
$this->transaction_opened++;
dol_syslog('',0,1);
return 1;
}
}
@ -492,6 +494,7 @@ class DoliDBPgsql
*/
function commit($log='')
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT;");
@ -516,6 +519,7 @@ class DoliDBPgsql
*/
function rollback()
{
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK;");

View File

@ -416,12 +416,14 @@ class DoliDBSqlite
{
$this->transaction_opened++;
dol_syslog("BEGIN Transaction",LOG_DEBUG);
dol_syslog('',0,1);
}
return $ret;
}
else
{
$this->transaction_opened++;
dol_syslog('',0,1);
return 1;
}
}
@ -434,7 +436,8 @@ class DoliDBSqlite
*/
function commit($log='')
{
if ($this->transaction_opened<=1)
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("COMMIT");
if ($ret)
@ -445,8 +448,8 @@ class DoliDBSqlite
return $ret;
}
else
{
$this->transaction_opened--;
{
$this->transaction_opened--;
return 1;
}
}
@ -459,7 +462,8 @@ class DoliDBSqlite
*/
function rollback($log='')
{
if ($this->transaction_opened<=1)
dol_syslog('',0,-1);
if ($this->transaction_opened<=1)
{
$ret=$this->query("ROLLBACK");
$this->transaction_opened=0;

View File

@ -729,6 +729,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
modal: true,
buttons: [
{
id : 'yesButton_' + code,
text : yesButton,
click : function() {
if (action == "set") {
@ -748,6 +749,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
}
},
{
id : 'noButton_' + code,
text : noButton,
click : function() {
$(this).dialog("close");
@ -755,6 +757,10 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
}
]
});
// For information dialog box only, hide the noButton
if (boxConfirm.info) {
$("#noButton_" + code).button().hide();
}
}
/*

View File

@ -93,7 +93,10 @@ function print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirt
print '<td nowrap="nowrap">';
print $langs->trans("Type");
print ' &nbsp;</td><td nowrap="nowrap">';
print $formactions->select_type_actions(GETPOST('actioncode'), "actioncode");
// print $formactions->select_type_actions(GETPOST('actioncode'), "actioncode");
print $formactions->select_type_actions(GETPOST('actioncode')?GETPOST('actioncode'):'manual', "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0));
print '</td></tr>';
}
@ -403,6 +406,14 @@ function actions_prepare_head($object)
$head[$h][2] = 'card';
$h++;
if (! empty($conf->global->AGENDA_USE_SEVERAL_CONTACTS))
{
$head[$h][0] = DOL_URL_ROOT.'/comm/action/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans("Contacts");
$head[$h][2] = 'contact';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
@ -440,9 +451,11 @@ function calendars_prepare_head($param)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda');
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda','remove');
return $head;
}

View File

@ -48,8 +48,14 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
var options = '.json_encode($ajaxoptions).';
// Remove product id before select another product
// use keyup instead change to avoid loosing the product id
$("input#search_'.$htmlname.'").keydown(function() {
//console.log(\'purge_id_after_keydown\');
$("#'.$htmlname.'").val("");
});
$("input#search_'.$htmlname.'").change(function() {
$("#'.$htmlname.'").val("").trigger("change");
//console.log(\'keyup\');
$("#'.$htmlname.'").trigger("change");
});
// Check when keyup
$("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() {
@ -115,6 +121,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
dataType: "json",
minLength: '.$minLength.',
select: function( event, ui ) {
//console.log(\'set value of id with \'+ui.item.id);
$("#'.$htmlname.'").val(ui.item.id).trigger("change");
// Disable an element
if (options.option_disabled) {
@ -163,7 +170,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}).data( "autocomplete" )._renderItem = function( ul, item ) {
return $( "<li></li>" )
.data( "item.autocomplete", item )
.append( \'<a href="#"><span class="tag">\' + item.label + "</span></a>" )
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
.appendTo(ul);
};
});';
@ -368,6 +375,11 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Set constant
$("#set_" + code).click(function() {
if (input.alert && input.alert.set) {
// Posibility to force label of buttons
if (input.alert.set.yesButton)
yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton)
noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
} else {
setConstant(url, code, input, entity);
@ -377,6 +389,11 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Del constant
$("#del_" + code).click(function() {
if (input.alert && input.alert.del) {
// Posibility to force label of buttons
if (input.alert.del.yesButton)
yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton)
noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
} else {
delConstant(url, code, input, entity);

View File

@ -51,9 +51,11 @@ function categories_prepare_head($object,$type)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type);
complete_head_from_modules($conf,$langs,$object,$head,$h,'categories_'.$type,'remove');
return $head;
}

View File

@ -777,7 +777,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('actioncomm').")";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($object) == 'Adherent') {
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if (! empty($object->id))
@ -916,7 +916,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('actioncomm').")";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;

View File

@ -63,7 +63,7 @@ function contact_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact');
$head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
@ -71,7 +71,7 @@ function contact_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'contact','remove');
return $head;
}

View File

@ -38,7 +38,7 @@ function contract_prepare_head($object)
$head[$h][1] = $langs->trans("ContractCard");
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
@ -50,9 +50,9 @@ function contract_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id;
@ -71,6 +71,8 @@ function contract_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract','remove');
return $head;
}

View File

@ -759,25 +759,30 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
}
/**
* Fonction retournant le nombre de jour entre deux dates sans les jours feries (jours ouvres)
* Function to return number of working days (and text of units) between two dates (jours ouvres)
*
* @param timestamp $timestampStart Timestamp de debut
* @param timestamp $timestampEnd Timestamp de fin
* @param int $inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max)
* @param int $lastday We include last day, 0: non, 1:oui
* @return int Nombre de jours ou d'heures
* @param timestamp $timestampStart Timestamp for start date
* @param timestamp $timestampEnd Timestamp for end date
* @param int $inhour 0: return number of days, 1: return number of hours (72 max)
* @param int $lastday We include last day, 0: no, 1:yes
* @return int Number of days or hours
*/
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{
global $langs;
dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday);
// Check parameters
if (! is_int($timestampStart) && ! is_float($timestampStart)) return 'ErrorBadParameter_num_open_day';
if (! is_int($timestampEnd) && ! is_float($timestampEnd)) return 'ErrorBadParameter_num_open_day';
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
if ($timestampStart < $timestampEnd)
{
//print num_between_day($timestampStart, $timestampEnd, $lastday).' - '.num_public_holiday($timestampStart, $timestampEnd);
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $lastday);
$nbOpenDay.= " ".$langs->trans("Days");
$nbOpenDay.= " " . $langs->trans("Days");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay;
}
@ -785,7 +790,7 @@ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{
$nbOpenDay=$lastday;
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay=1;
return $nbOpenDay;
}
else
{

View File

@ -42,7 +42,7 @@ function fichinter_prepare_head($object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
@ -62,9 +62,9 @@ function fichinter_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
@ -83,7 +83,9 @@ function fichinter_prepare_head($object)
$head[$h][2] = 'info';
$h++;
return $head;
complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention','remove');
return $head;
}
?>

View File

@ -52,7 +52,7 @@ function facturefourn_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_invoice');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
@ -77,7 +77,9 @@ function facturefourn_prepare_head($object)
$head[$h][2] = 'info';
$h++;
return $head;
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_invoice','remove');
return $head;
}

View File

@ -232,10 +232,11 @@ function dol_getprefix()
function dol_include_once($relpath, $classname='')
{
global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var']
if (! empty($classname) && ! class_exists($classname)) {
return @include dol_buildpath($relpath);
return @include dol_buildpath($relpath); // Remove @ to find error into php log file if you have problems
} else {
return @include_once dol_buildpath($relpath);
return @include_once dol_buildpath($relpath); // Remove @ to find error into php log file if you have problems
}
}
@ -483,90 +484,73 @@ function dol_strtoupper($utf8_string)
*
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
* @param int $level Log level
* 0=Show nothing
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @return void
*/
function dol_syslog($message, $level = LOG_INFO)
function dol_syslog($message, $level = LOG_INFO, $ident = 0)
{
global $conf, $user, $langs;
global $conf, $user;
// If syslog module enabled
if (empty($conf->syslog->enabled)) return false;
if (!defined('SYSLOG_HANDLERS') || !constant('SYSLOG_HANDLERS')) return false;
$logLevels = array(
LOG_EMERG,
LOG_ALERT,
LOG_CRIT,
LOG_ERR,
LOG_WARNING,
LOG_NOTICE,
LOG_INFO,
LOG_DEBUG
);
if (!in_array($level, $logLevels))
if (! empty($level))
{
throw new Exception('Incorrect log level');
}
if ($level > $conf->global->SYSLOG_LEVEL) return false;
// If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML))
{
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
}
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
{
print "\n\n<!-- Log start\n";
print $message."\n";
print "Log end -->\n";
}
$data = array(
'message' => $message,
'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false),
'level' => $level,
'user' => ((is_object($user) && $user->id) ? $user->login : false),
'ip' => false
);
if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR'];
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
//We load SYSLOG handlers
if (defined('SYSLOG_HANDLERS')) $handlers = json_decode(SYSLOG_HANDLERS);
else $handlers = array();
foreach ($handlers as $handler)
{
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
if (!file_exists($file))
// Test log level
$logLevels = array( LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
if (!in_array($level, $logLevels))
{
throw new Exception('Missing log handler');
throw new Exception('Incorrect log level');
}
if ($level > $conf->global->SYSLOG_LEVEL) return false;
// If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML))
{
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
}
require_once $file;
$class = new $handler();
if (!$class instanceof LogHandlerInterface)
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
{
throw new Exception('Log handler does not extend LogHandlerInterface');
print "\n\n<!-- Log start\n";
print $message."\n";
print "Log end -->\n";
}
$class->export($data);
$data = array(
'message' => $message,
'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false),
'level' => $level,
'user' => ((is_object($user) && $user->id) ? $user->login : false),
'ip' => false
);
if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR'];
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
// Loop on each log handler and send output
foreach ($conf->loghandlers as $loghandlerinstance)
{
$loghandlerinstance->export($data);
}
unset($data);
}
if (! empty($ident))
{
foreach ($conf->loghandlers as $loghandlerinstance)
{
$loghandlerinstance->setIdent($ident);
}
}
}
@ -2190,17 +2174,18 @@ function dol_print_error($db='',$error='')
}
/**
* Show email to contact if technical error
* Show a public email and error code to contact if technical error
*
* @param string $prefixcode Prefix of public error code
* @return void
*/
function dol_print_error_email()
function dol_print_error_email($prefixcode)
{
global $langs,$conf;
$langs->load("errors");
$now=dol_now();
print '<br><div class="error">'.$langs->trans("ErrorContactEMail",$conf->global->MAIN_INFO_SOCIETE_MAIL,'ERRORNEWPAYMENT'.dol_print_date($now,'%Y%m%d')).'</div>';
print '<br><div class="error">'.$langs->trans("ErrorContactEMail", $conf->global->MAIN_INFO_SOCIETE_MAIL, $prefixcode.dol_print_date($now,'%Y%m%d')).'</div>';
}
/**
@ -2700,8 +2685,16 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')." thirdparty_seller=".$thirdparty_seller->id);
// Some test to guess with no need to make database access
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
if ($mysoc->country_code == 'ES') // For spain, localtaxes are qualified if both supplier and seller use local taxe
{
if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
}
else
{
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
}
//if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0);
$code_country=$thirdparty_seller->country_code;
@ -2712,7 +2705,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
}
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax2";
$sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_country."'";
$sql .= " AND t.taux = ".$tva." AND t.active = 1";
@ -2722,9 +2715,8 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2;
//else return array($obj->localtax1,$obj->localtax2);
if ($local==1 && $obj->localtax1_type != '7') return $obj->localtax1;
elseif ($local==2 && $obj->localtax2_type != '7') return $obj->localtax2;
}
return 0;
@ -2985,18 +2977,27 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod)
*/
function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
{
global $mysoc;
if (!is_object($thirdparty_seller)) return -1;
if (!is_object($thirdparty_buyer)) return -1;
if ($local==1) //RE
if ($local==1) // Localtax 1
{
// Si vendeur non assujeti a RE, localtax1 par default=0
if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0;
if ($mysoc->country_code == 'ES')
{
if (is_numeric($thirdparty_buyer->localtax1_assuj) && ! $thirdparty_buyer->localtax1_assuj) return 0;
}
else
{
// Si vendeur non assujeti a Localtax1, localtax1 par default=0
if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0;
}
}
elseif ($local==2) //IRPF
elseif ($local==2) //I Localtax 2
{
// Si vendeur non assujeti a IRPF, localtax2 par default=0
// Si vendeur non assujeti a Localtax2, localtax2 par default=0
if (is_numeric($thirdparty_seller->localtax2_assuj) && ! $thirdparty_seller->localtax2_assuj) return 0;
if (! is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj=='localtax2off') return 0;
}
@ -3565,7 +3566,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
*/
function setEventMessage($mesgs, $style='mesgs')
{
if (! in_array($style,array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
if (! is_array($mesgs)) // If mesgs is a string
{
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;
@ -4199,6 +4200,35 @@ function getCurrencySymbol($currency_code)
return $currency_sign;
}
/**
* Get type of one localtax
*
* @param int $vatrate VAT Rate
* @param int $number Number of localtax (1 / 2)
* @param int $thirdparty company object
* @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax)
*/
function getTypeOfLocalTaxFromRate($vatrate, $number, $thirdparty)
{
global $db;
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($number == 1) return array($obj->localtax1_type, $obj->localtax1);
elseif ($number == 2) return array($obj->localtax2_type, $obj->localtax2);
}
return 0;
}
if (! function_exists('getmypid'))
{

View File

@ -0,0 +1,53 @@
<?php
/* Copyright (C) 2006-2011 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/lib/holiday.lib.php
* \brief Ensemble de fonctions de base pour les adherents
*/
/**
* Return array head with list of tabs to view object informations
*
* @param Object $object Holiday
* @return array head
*/
function holiday_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/holiday/fiche.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'holiday');
complete_head_from_modules($conf,$langs,$object,$head,$h,'holiday','remove');
return $head;
}
?>

View File

@ -39,7 +39,7 @@ function facture_prepare_head($object)
$head[$h][1] = $langs->trans('CardBill');
$head[$h][2] = 'compta';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
@ -68,9 +68,9 @@ function facture_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id;
@ -93,6 +93,8 @@ function facture_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice','remove');
return $head;
}

View File

@ -96,7 +96,7 @@ function member_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'member','remove');
return $head;
@ -175,12 +175,19 @@ function member_stats_prepare_head($object)
$head[$h][2] = 'statstown';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/byproperties.php';
$head[$h][1] = $langs->trans('ByProperties');
$head[$h][2] = 'statsbyproperties';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats');
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats','remove');
return $head;
}
?>

View File

@ -67,7 +67,7 @@ function commande_prepare_head($object)
$head[$h][2] = 'preview';
$h++;
}
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
@ -79,7 +79,7 @@ function commande_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'order');
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
@ -90,7 +90,7 @@ function commande_prepare_head($object)
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$object->id;
@ -104,7 +104,9 @@ function commande_prepare_head($object)
$head[$h][2] = 'info';
$h++;
return $head;
complete_head_from_modules($conf,$langs,$object,$head,$h,'order','remove');
return $head;
}
?>

View File

@ -80,8 +80,10 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI))
return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together";
// We use by default TCPDF
// We use by default TCPDF else FPDF
if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php';
else require_once FPDF_PATH.'fpdf.php';
// We need to instantiate fpdi object (instead of tcpdf) to use merging features. But we can disable it.
if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php';
@ -90,7 +92,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
//$metric=$arrayformat['unit'];
// Protection et encryption du pdf
if (! empty($conf->global->PDF_SECURITY_ENCRYPTION))
if (empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->PDF_SECURITY_ENCRYPTION))
{
/* Permission supported by TCPDF
- print : Print the document;
@ -103,20 +105,11 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
*/
if (! empty($conf->global->MAIN_USE_FPDF))
{
require_once FPDI_PATH.'fpdi_protection.php';
$pdf = new FPDI_Protection($pagetype,$metric,$format);
// For FPDF, we specify permission we want to open
$pdfrights = array('print');
}
else
{
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format);
// For TCPDF, we specify permission we want to block
$pdfrights = array('modify','copy');
}
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format);
// For TCPDF, we specify permission we want to block
$pdfrights = array('modify','copy');
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
@ -126,9 +119,43 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format);
}
// If we use FPDF class, we may need to add method writeHTMLCell
if (! empty($conf->global->MAIN_USE_FPDF) && ! method_exists($pdf, 'writeHTMLCell'))
{
// Declare here a class to overwrite FPDFI to add method writeHTMLCell
/**
* This class if a enhanced FPDI class that support method writeHTMLCell
*/
class FPDI_DolExtended extends FPDI
{
public function __call($method, $args)
{
if (isset($this->$method)) {
$func = $this->$method;
$func($args);
}
}
public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true)
{
$this->SetXY($x,$y);
$val=str_replace('<br>',"\n",$html);
$val=dol_string_nohtmltag($val,false,'ISO-8859-1');
//print 'eee'.$val;exit;
$this->MultiCell($w,$h,$val,$border,$align,$fill);
}
}
$pdf2=new FPDI_DolExtended($pagetype,$metric,$format);
unset($pdf);
$pdf=$pdf2;
}
return $pdf;
}
/**
* Return font name to use for PDF generation
*
@ -691,7 +718,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
{
$pdf->SetFont('','B',7);
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
$pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line1, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
@ -700,7 +727,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
{
$pdf->SetFont('','B',7);
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
$pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line2, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
@ -708,22 +735,23 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
if (! empty($line3))
{
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line3, 0, 'C', 0);
$pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line3, 0, 'C', 0);
}
if (! empty($line4))
{
$posy-=3;
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line4, 0, 'C', 0);
$pdf->MultiCell($dims['wk']-$dims['rm'], 2, $line4, 0, 'C', 0);
}
// Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
{
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
else $pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
}
return $marginwithfooter;

View File

@ -75,9 +75,11 @@ function prelevement_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement');
complete_head_from_modules($conf,$langs,$object,$head,$h,'prelevement','remove');
return $head;
}

View File

@ -27,11 +27,11 @@
/**
* Calculate totals (net, vat, ...) of a line.
* Value for localtaxX_type are '0' : local tax not applied
* '1' : local tax apply on products and services without vat (vat is not applied on local tax)
* '1' : local tax apply on products and services without vat (vat is not applied for local tax calculation)
* '2' : local tax apply on products and services before vat (vat is calculated on amount + localtax)
* '3' : local tax apply on products without vat (vat is not applied on local tax)
* '3' : local tax apply on products without vat (vat is not applied for local tax calculation)
* '4' : local tax apply on products before vat (vat is calculated on amount + localtax)
* '5' : local tax apply on services without vat (vat is not applied on local tax)
* '5' : local tax apply on services without vat (vat is not applied for local tax calculation)
* '6' : local tax apply on services before vat (vat is calculated on amount + localtax)
* '7' : local tax is a fix amount applied on global invoice
*
@ -46,7 +46,22 @@
* @param int $info_bits Miscellanous informations on line
* @param int $type 0/1=Product/service
* @param string $seller Thirdparty seller (we need $seller->country_code property). Provided only if seller is the supplier.
* @return result[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount, ...)
* @return result[ 0=total_ht,
* 1=total_vat,
* 2=total_ttc,
* 3=pu_ht,
* 4=pu_tva,
* 5=pu_ttc,
* 6=total_ht_without_discount,
* 7=total_vat_without_discount,
* 8=total_ttc_without_discount,
* 9=amount tax1 for total_ht,
* 10=amount tax2 for total_ht,
* 11=amount tax1 for pu_ht,
* 12=amount tax2 for pu_ht,
* 13=not used???,
* 14=amount tax1 for total_ht_without_discount,
* 15=amount tax1 for total_ht_without_discount]
*/
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '')
{
@ -177,16 +192,17 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
}
// if there's some localtax without vat, we calculate localtaxes (we will add them at end)
$apply_tax = false;
//If price is 'TTC' we need to have the totals without VAT for a correct calculation
if ($price_base_type=='TTC')
{
$tot_sans_remise= price2num($tot_sans_remise / (1 + ($txtva / 100)),'MU');
$tot_avec_remise= price2num($tot_avec_remise / (1 + ($txtva / 100)),'MU');
$pu = price2num($pu / (1 + ($txtva / 100)),'MU');
}
switch($localtax1_type) {
$apply_tax = false;
switch($localtax1_type) {
case '1': // localtax on product or service
$apply_tax = true;
break;

View File

@ -113,7 +113,7 @@ function product_prepare_head($object, $user)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'product');
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
@ -158,8 +158,8 @@ function product_admin_prepare_head($object=null)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin');
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php';

View File

@ -61,7 +61,7 @@ function project_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'project');
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
@ -96,7 +96,9 @@ function project_prepare_head($object)
$head[$h][2] = 'gantt';
$h++;
return $head;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
return $head;
}
@ -130,7 +132,7 @@ function task_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'task');
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');;
@ -147,6 +149,8 @@ function task_prepare_head($object)
$head[$h][2] = 'task_notes';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'task','remove');
return $head;
}
@ -208,7 +212,7 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen
//else $labeltoshow.=' ('.$langs->trans("Private").')';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
print '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
print '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.' - '.dol_trunc($obj->title,$maxlength).'</option>';
}
else
{

View File

@ -73,7 +73,7 @@ function propal_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
@ -98,6 +98,8 @@ function propal_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal','remove');
return $head;
}

View File

@ -66,10 +66,12 @@ function shipping_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery');
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove');
return $head;
}
@ -105,10 +107,12 @@ function delivery_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery');
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove');
return $head;
}

View File

@ -66,7 +66,7 @@ function stock_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'stock');
$head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id;
@ -74,7 +74,9 @@ function stock_prepare_head($object)
$head[$h][2] = 'info';
$h++;
return $head;
complete_head_from_modules($conf,$langs,$object,$head,$h,'stock','remove');
return $head;
}
?>

View File

@ -45,7 +45,7 @@ function tax_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'tax');
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id;
@ -58,6 +58,8 @@ function tax_prepare_head($object)
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'tax','remove');
return $head;
}

View File

@ -33,23 +33,25 @@ function trip_prepare_head($object)
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/fiche.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'trip');
$head[$h][0] = DOL_URL_ROOT . '/compta/deplacement/info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'trip','remove');
return $head;
}

View File

@ -81,8 +81,8 @@ function user_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:conditiontoshow:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:conditiontoshow:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
if (! empty($user->societe_id))
@ -98,6 +98,8 @@ function user_prepare_head($object)
$h++;
}
complete_head_from_modules($conf,$langs,$object,$head,$h,'user','remove');
return $head;
}
@ -140,12 +142,51 @@ function group_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'group');
complete_head_from_modules($conf,$langs,$object,$head,$h,'group','remove');
return $head;
}
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to shoc
*/
function user_admin_prepare_head()
{
global $langs, $conf, $user;
$langs->load("users");
$h=0;
$head[$h][0] = DOL_URL_ROOT.'/admin/user.php';
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin','remove');
return $head;
}
/**
* Prepare array with list of tabs
*

View File

@ -415,6 +415,9 @@ abstract class DolibarrModules
global $db,$conf;
$error=0;
$dirfound=0;
if (empty($reldir)) return 1;
include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php';
@ -426,11 +429,13 @@ abstract class DolibarrModules
$dir = $dirroot.$reldir;
$ok = 0;
// Run llx_mytable.sql files
$handle=@opendir($dir); // Dir may not exists
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
$dirfound++;
// Run llx_mytable.sql files
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@ -438,14 +443,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
closedir($handle);
}
rewinddir($handle);
// Run llx_mytable.key.sql files (Must be done after llx_mytable.sql)
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
// Run llx_mytable.key.sql files (Must be done after llx_mytable.sql)
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
{
@ -453,14 +455,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
closedir($handle);
}
// Run data_xxx.sql files (Must be done after llx_mytable.key.sql)
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
rewinddir($handle);
// Run data_xxx.sql files (Must be done after llx_mytable.key.sql)
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
{
@ -468,14 +467,11 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
closedir($handle);
}
// Run update_xxx.sql files
$handle=@opendir($dir); // Dir may not exist
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
rewinddir($handle);
// Run update_xxx.sql files
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
{
@ -483,6 +479,7 @@ abstract class DolibarrModules
if ($result <= 0) $error++;
}
}
closedir($handle);
}
@ -493,6 +490,7 @@ abstract class DolibarrModules
}
}
if (! $dirfound) dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
return $ok;
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
@ -117,8 +118,6 @@ class pdf_einstein extends ModelePDFCommandes
}
$this->tva=array();
$this->localtax1=array();
$this->localtax2=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
}
@ -137,7 +136,7 @@ class pdf_einstein extends ModelePDFCommandes
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$langs,$conf;
global $user,$langs,$conf,$mysoc,$db;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -150,8 +149,6 @@ class pdf_einstein extends ModelePDFCommandes
$outputlangs->load("products");
$outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->commande->dir_output)
{
$object->fetch_thirdparty();
@ -186,7 +183,8 @@ class pdf_einstein extends ModelePDFCommandes
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
@ -364,22 +362,49 @@ class pdf_einstein extends ModelePDFCommandes
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
$localtax2_rate=$object->lines[$i]->localtax2_tx;
$localtax1_type=$object->lines[$i]->localtax1_type;
$localtax2_type=$object->lines[$i]->localtax2_type;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx;
$localtax1rate=(string) $object->lines[$i]->localtax1_tx;
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
// TODO : store local taxes types into object lines and remove this
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
//end TODO
// retrieve global local tax
if ($localtax1_type == '7')
$localtax1_rate = $localtax1_array[1];
if ($localtax2_type == '7')
$localtax2_rate = $localtax2_array[1];
if ($localtax1ligne != 0 || $localtax1_type == '7')
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
$this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
@ -692,6 +717,84 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
//Local tax 1 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
//Local tax 2 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
// VAT
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey > 0) // On affiche pas taux 0
@ -715,48 +818,26 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
//Local tax 1 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
// Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
}
// Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
}
}
else
{
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//Local tax 1
foreach($this->localtax1 as $tvakey => $tvaval)
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -764,27 +845,43 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach($this->localtax2 as $tvakey => $tvaval)
}
//Local tax 2 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -792,12 +889,21 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}

View File

@ -84,7 +84,6 @@ class pdf_expedition_merou extends ModelePdfExpedition
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$conf,$langs,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
@ -147,6 +146,7 @@ class pdf_expedition_merou extends ModelePdfExpedition
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format,'mm','l');
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 0; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -243,6 +243,15 @@ class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetXY(170, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

View File

@ -87,7 +87,6 @@ class pdf_expedition_rouget extends ModelePdfExpedition
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
@ -133,7 +132,8 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 0; // Height reserved to output the info and total part
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 0; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
@ -262,6 +262,15 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetXY($this->posxqtytoship, $curY);
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
@ -138,7 +139,7 @@ class pdf_crabe extends ModelePDFFactures
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$langs,$conf;
global $user,$langs,$conf,$mysoc,$db;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -150,8 +151,6 @@ class pdf_crabe extends ModelePDFFactures
$outputlangs->load("bills");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->facture->dir_output)
{
$object->fetch_thirdparty();
@ -186,6 +185,7 @@ class pdf_crabe extends ModelePDFFactures
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -197,6 +197,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
@ -365,22 +366,49 @@ class pdf_crabe extends ModelePDFFactures
$tvaligne=$object->lines[$i]->total_tva;
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
$localtax2_rate=$object->lines[$i]->localtax2_tx;
$localtax1_type=$object->lines[$i]->localtax1_type;
$localtax2_type=$object->lines[$i]->localtax2_type;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx;
$localtax1rate=(string) $object->lines[$i]->localtax1_tx;
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
// TODO : store local taxes types into object lines and remove this
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
//end TODO
// retrieve global local tax
if ($localtax1_type == '7')
$localtax1_rate = $localtax1_array[1];
if ($localtax2_type == '7')
$localtax2_rate = $localtax2_array[1];
if ($localtax1ligne != 0 || $localtax1_type == '7')
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
$this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
@ -813,6 +841,84 @@ class pdf_crabe extends ModelePDFFactures
}
else
{
//Local tax 1 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
//Local tax 2 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
// VAT
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey > 0) // On affiche pas taux 0
@ -821,6 +927,7 @@ class pdf_crabe extends ModelePDFFactures
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
@ -830,52 +937,31 @@ class pdf_crabe extends ModelePDFFactures
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
//Local tax 1 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
// Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1);
}
// Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1);
}
}
else
{
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//Local tax 1
foreach($this->localtax1 as $tvakey => $tvaval)
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -883,27 +969,44 @@ class pdf_crabe extends ModelePDFFactures
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach($this->localtax2 as $tvakey => $tvaval)
}
//Local tax 2 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
// retrieve global local tax
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -911,12 +1014,21 @@ class pdf_crabe extends ModelePDFFactures
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
@ -927,11 +1039,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
$text=$outputlangs->transnoentities("TotalTTC");
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
}
}

View File

@ -117,8 +117,6 @@ class pdf_soleil extends ModelePDFFicheinter
$outputlangs->load("companies");
$outputlangs->load("interventions");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->ficheinter->dir_output)
{
$object->fetch_thirdparty();
@ -140,6 +138,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)

View File

@ -113,7 +113,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
function write_file($object,$outputlangs)
{
global $user,$langs,$conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -150,6 +149,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -305,6 +305,16 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
$this->tva[ (string) $object->lines[$i]->tva_tx ] += $tvaligne;
*/
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

View File

@ -61,9 +61,8 @@ class mailing_framboise extends MailingTargets
$cibles = array();
// CHANGE THIS
// Select the members from category
$sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, null as firstname,";
$sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, a.prenom as firstname,";
if ($_POST['filter']) $sql.= " c.label";
else $sql.=" null as label";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";

View File

@ -42,6 +42,8 @@ class modExpedition extends DolibarrModules
*/
function __construct($db)
{
global $conf;
$this->db = $db;
$this->numero = 80;
@ -71,6 +73,8 @@ class modExpedition extends DolibarrModules
// Dependances
$this->depends = array("modCommande");
$this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array('deliveries','sendings');
// Constantes
$this->const = array();
@ -141,6 +145,14 @@ class modExpedition extends DolibarrModules
$this->rights[$r][4] = 'shipping_advance';
$this->rights[$r][5] = 'send';
$r++;
$this->rights[$r][0] = 106;
$this->rights[$r][1] = 'Exporter les expeditions';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'shipment';
$this->rights[$r][5] = 'export';
$r++;
$this->rights[$r][0] = 109;
$this->rights[$r][1] = 'Supprimer les expeditions';
@ -180,6 +192,25 @@ class modExpedition extends DolibarrModules
$this->rights[$r][4] = 'livraison';
$this->rights[$r][5] = 'supprimer';
// Exports
//--------
$r=0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("expedition","shipment","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_customer'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_delivery'=>"DateSending",'c.tracking_number'=>"TrackingNumber",'c.height'=>"Height",'c.width'=>"Width",'c.size'=>"Depth",'c.size_units'=>'SizeUnits','c.weight'=>"Weight",'c.weight_units'=>"WeightUnits",'c.fk_statut'=>'Status','c.note'=>"Note",'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.libelle'=>'List:c_pays:libelle:rowid','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Number",'c.remise_percent'=>"Number",'c.total_ht'=>"Number",'c.total_ttc'=>"Number",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note'=>"Text",'c.date_livraison'=>'Date','ed.qty'=>"Text");
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','s.libelle'=>'List:c_pays:libelle:rowid','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_customer'=>"Text",'c.date_creation'=>"Date",'c.date_delivery'=>"Date",'c.tracking_number'=>"Number",'c.height'=>"Number",'c.width'=>"Number",'c.weight'=>"Number",'c.fk_statut'=>'Status','c.note'=>"Text",'ed.qty'=>"Number");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment",'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment",'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note'=>"shipment",'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'expedition as c, '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'expeditiondet as ed, '.MAIN_DB_PREFIX.'commandedet as cd)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
$this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity;
}

View File

@ -220,7 +220,7 @@ class modGravatar extends DolibarrModules
*/
function load_tables()
{
return $this->_load_tables('/mymodule/sql/');
return $this->_load_tables('');
}
}

View File

@ -65,6 +65,8 @@ class modProjet extends DolibarrModules
// Dependancies
$this->depends = array();
$this->requiredby = array();
$this->conflictwith = array();
$this->langfiles = array('projects');
// Constants
$this->const = array();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
@ -250,7 +250,7 @@ class modSociete extends DolibarrModules
$this->export_fields_array[$r]=array('s.rowid'=>"Id",'s.nom'=>"Name",'s.status'=>"Status",'s.client'=>"Customer",'s.fournisseur'=>"Supplier",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",'s.address'=>"Address",'s.cp'=>"Zip",'s.ville'=>"Town",'p.libelle'=>"Country",'p.code'=>"CountryCode",'s.tel'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.default_lang'=>"DefaultLang",'s.siren'=>"ProfId1",'s.siret'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.idprof5'=>"ProfId5",'s.idprof6'=>"ProfId6",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note'=>"Note",'t.libelle'=>"ThirdPartyType",'ce.code'=>"Staff","cfj.libelle"=>"JuridicalStatus",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus','d.nom'=>'State');
if (! empty($conf->global->SOCIETE_USEPREFIX)) $this->export_fields_array[$r]['s.prefix']='Prefix';
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid');
$this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'List:c_departements:nom:rowid');
$this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Text",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.address'=>"Text",'s.cp'=>"Text",'s.ville'=>"Text",'p.libelle'=>"List:c_pays:libelle:rowid",'p.code'=>"Text",'s.tel'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code','d.nom'=>'Text');
$this->export_entities_array[$r]=array(); // We define here only fields that use another picto
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'company'";

View File

@ -173,7 +173,7 @@ class modWorkflow extends DolibarrModules
*/
function load_tables()
{
return $this->_load_tables('/workflow/sql/');
return $this->_load_tables('');
}
}
?>

View File

@ -108,8 +108,6 @@ class pdf_baleine extends ModelePDFProjects
{
$nblignes = count($object->lines);
$default_font_size = pdf_getPDFFontsize($outputlangs);
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
@ -127,6 +125,7 @@ class pdf_baleine extends ModelePDFProjects
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -226,6 +225,15 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
@ -116,8 +117,6 @@ class pdf_azur extends ModelePDFPropales
}
$this->tva=array();
$this->localtax1=array();
$this->localtax2=array();
$this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
}
@ -136,7 +135,7 @@ class pdf_azur extends ModelePDFPropales
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$langs,$conf;
global $user,$langs,$conf,$mysoc,$db;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -149,8 +148,6 @@ class pdf_azur extends ModelePDFPropales
$outputlangs->load("propal");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->propal->dir_output)
{
$object->fetch_thirdparty();
@ -185,6 +182,7 @@ class pdf_azur extends ModelePDFPropales
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -362,22 +360,48 @@ class pdf_azur extends ModelePDFPropales
$tvaligne=$object->lines[$i]->total_tva;
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
$localtax2_rate=$object->lines[$i]->localtax2_tx;
$localtax1_type=$object->lines[$i]->localtax1_type;
$localtax2_type=$object->lines[$i]->localtax2_type;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx;
$localtax1rate=(string) $object->lines[$i]->localtax1_tx;
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
// TODO : store local taxes types into object lines and remove this
$localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc);
$localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc);
if (empty($localtax1_type))
$localtax1_type = $localtax1_array[0];
if (empty($localtax2_type))
$localtax2_type = $localtax2_array[0];
//end TODO
// retrieve global local tax
if ($localtax1_type == '7')
$localtax1_rate = $localtax1_array[1];
if ($localtax2_type == '7')
$localtax2_rate = $localtax2_array[1];
if ($localtax1ligne != 0 || $localtax1_type == '7')
$this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne;
if ($localtax2ligne != 0 || $localtax2_type == '7')
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
$this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
@ -726,6 +750,84 @@ class pdf_azur extends ModelePDFPropales
}
else
{
//Local tax 1 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
//Local tax 2 before VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
// VAT
foreach($this->tva as $tvakey => $tvaval)
{
if ($tvakey > 0) // On affiche pas taux 0
@ -750,48 +852,25 @@ class pdf_azur extends ModelePDFPropales
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
//Local tax 1 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
// Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
}
// Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
}
}
else
{
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//Local tax 1
foreach($this->localtax1 as $tvakey => $tvaval)
foreach( $this->localtax1 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -799,27 +878,43 @@ class pdf_azur extends ModelePDFPropales
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach($this->localtax2 as $tvakey => $tvaval)
}
//Local tax 2 after VAT
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) {
switch ($localtax_type) {
case '2':
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey!=0) // On affiche pas taux 0
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
@ -827,13 +922,21 @@ class pdf_azur extends ModelePDFPropales
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' ';
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
if ($localtax_type == '7') { // amount on order
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1);
}
else
{
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
}
}

View File

@ -146,8 +146,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$outputlangs->load("bills");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->fournisseur->dir_output.'/facture')
{
$object->fetch_thirdparty();
@ -184,6 +182,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -337,6 +336,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

View File

@ -156,8 +156,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->load("products");
$outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->fournisseur->dir_output.'/commande')
{
$object->fetch_thirdparty();
@ -196,6 +194,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
@ -354,6 +353,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages

Some files were not shown because too many files have changed in this diff Show More