Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
frederic34 2013-03-26 10:24:46 +01:00
commit 1cd39df82b
429 changed files with 20678 additions and 12588 deletions

View File

@ -19,6 +19,7 @@ GeoIP 2004 LGPL-2.1+ Yes Sample code to m
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
OdtPHP 1.0.1 GPL-2+ Yes Library to build/edit ODT files
PHPExcel 1.7.6 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
TCPDF 5.9.180 LGPL-3+ Yes PDF generation
JS libraries:
@ -26,7 +27,7 @@ jQuery 1.8.2 MIT Licence Yes JS library
jQuery UI 1.9.1 GPL and MIT Licence Yes JS library plugin UI
jQuery Timepicker 1.1.0 GPL and MIT Licence Yes JS library Timepicker addon for Datepicker
jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors
jQuery DataTables 1.9.1 BSD Yes JS library for tables output
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
jQuery Flot 0.7 MIT Licence Yes JS library to build graph
jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files
jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images)
@ -50,10 +51,12 @@ Copyright
Copyright (C) 2013
- Christophe Battarel <christophe.battarel@altairis.fr>
- Laurent Destailleur <eldy@users.sourceforge.net>
- Jean-François Ferry <jfefe@aternatik.fr>
- Marcos García <marcosgdf@gmail.com>
- Philippe Grand <philippe.grand@atoo-net.com>
- Florian Henry <florian.henry@open-concept.pro>
- Regis Houssin <regis.houssin@capnetworks.com>
- Maxime Kohlhaas <mko@atm-consulting.fr>
- Juanjo Menent <jmenent@2byte.es>
Copyright (C) 2012

View File

@ -4,6 +4,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.4 compared to 3.3 *****
For users:
- New: Support revenue stamp onto invoices.
- New: Add a tab "consumption" on thirdparties to list products bought/sells.
- New: Some performance enhancements.
- New: Can attach files onto trip and expenses modules.
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR.
@ -25,6 +27,7 @@ For users:
- New: [ task #748 ] Add a link "Dolibarr" into left menu
- New: Script email_unpaid_invoices_to_representative accepts now a parameter test
and a delay.
- First change to prepare feature click to print for PDF.
For translators:
- Update language files.
@ -43,12 +46,15 @@ For developers:
into conf->liste_limit).
- New: Add option dol_hide_topmenu and dol_hide_leftmenu onto login page.
- New: dol_syslog method accept a suffix to use different log files for log.
- New: Type of fields are received by export format handlers
- New: Type of fields are received by export format handlers.
- New: when adding an action, we can define a free code to tag it for a specific need.
- New: Enhance Dolibarr migration process to include migration script of external
modules.
WARNING: If you used external modules, some of them may need to be upgraded due to:
- fields of classes were renamed to be normalized (nom, prenom, cp, ville, adresse were
renamed into lastname, firstname, zip, town, address).
This may also be true for some fields into web services.
- if module use hook pdf_writelinedesc, module may have to add return 1 at end of
function to keep same behaviour.
@ -60,17 +66,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due
- Fix: Package for launchpad
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
- Fix: Localtax2 for Spain must be based into buyer
***** ChangeLog for 3.3.1 compared to 3.3 *****
- Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag
- Fix: Package for launchpad
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
- Fix: Localtax2 for Spain must be based into buyer
- Fix: [ bug #762 ] Bad profit calculation in Reporting
@ -80,6 +76,7 @@ WARNING: If you used external modules, some of them may need to be upgraded due
- Fix: Package for launchpad
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
- Fix: Localtax2 for Spain must be based into buyer
- Fix: [ bug #762 ] Bad profit calculation in Reporting

4
README
View File

@ -107,8 +107,8 @@ Other modules:
- ClickToDial phone numbers
- RSS
Miscellanous:
- Mutli-user, with several permissions levels for each feature.
Miscellaneous:
- Multi-user, with several permissions levels for each feature.
- Serveral menu managers (can be used by internal users, as a back-office,
with a particular menu, or by external users, as a front-office, with
another menu and permissions).

View File

@ -106,7 +106,7 @@ Autres modules:
- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
- De nombreuses autres fonctionnalités issues de modules officiels ou non (AWStats, Bittorrent, Gravatar, Google, Webcalendar...)
Miscellanous:
Divers:
- Application multi-utilisateurs avec différents niveaux de permissions par module.
- Plusieurs gestionnaires de menus (possibilité de différencier les menus pour les utilisateurs internes ou externes comme les clients ou fournisseurs).
- Application simple à utiliser.
@ -122,7 +122,7 @@ V - CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE)
Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
- Pas de compta analytique (uniquement gestion de trésorerie).
- Dolibarr ne gère qu'une seule monnaie à la fois (mono-devise).
- Dolibarr ne gère en standard qu'une société/institution/association (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MutliCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
- Dolibarr ne gère en standard qu'une société/institution/association (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
- Ne gère pas la double tva (Fédérale / provinciale) du canada.
- Dolibarr ne contient pas de module de Gestion de la paie.
- Les taches du module de gestion de projets n'ont pas de dépendance entre elle.

View File

@ -103,9 +103,9 @@ See ChangeLog file found into package.
- ClickToDial phone numbers
- RSS
### Miscellanous:
### Miscellaneous:
- Mutli-user, with several permissions levels for each feature.
- Multi-user, with several permissions levels for each feature.
- Serveral menu managers (can be used by internal users, as a back-office, with a particular menu, or by external users, as a front-office, with another menu and permissions).
- Very user friendly and easy to use.
- Optional WYSIWYG forms, optional Ajax forms.

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -27,12 +27,13 @@
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
// Change this following line to use the correct relative path (../, ../../, etc)
$res=0;

View File

@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* This program is free software; you can redistribute it and/or modify
@ -19,7 +19,7 @@
/**
* \file dev/skeletons/skeleton_script.php
* \ingroup mymodule othermodule1 othermodule2
* \ingroup mymodule
* \brief This file is an example for a command line script
* Put here some comments
*/
@ -34,19 +34,22 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit;
}
// Global variables
$version='1.29';
// Init global variables
$version='1.0';
$error=0;
// -------------------- START OF YOUR CODE HERE --------------------
// Include Dolibarr environment
@set_time_limit(0); // No timeout for this script
define('EVEN_IF_ONLY_LOGIN_ALLOWED',1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only".
// Include and load Dolibarr environment variables
require_once($path."../../htdocs/master.inc.php");
// After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file.
// After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file).
// $user is created but empty.
//$langs->setDefaultLang('en_US'); // To change default language of $langs
$langs->load("main"); // To load language file for default language
@set_time_limit(0); // No timeout for this script
// Load user and its permissions
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
@ -158,7 +161,7 @@ else
$db->rollback();
}
$db->close(); // Close database opened handler
$db->close(); // Close $db database opened handler
return $error;
?>

View File

@ -239,7 +239,7 @@ form_constantes($constantes);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
print '%YEAR%, %MONTH%, %DAY%';
print '<br>';
@ -257,7 +257,7 @@ form_constantes($constantes);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
print '%YEAR%, %MONTH%, %DAY%';
print '<br>';
@ -287,7 +287,7 @@ form_constantes($constantes);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
//print '%YEAR%, %MONTH%, %DAY%'; // Not supported
print '<br>';

View File

@ -660,6 +660,7 @@ if ($rowid)
{
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
$sql.= " c.rowid as crowid, c.cotisation,";
$sql.= " c.datec,";
$sql.= " c.dateadh,";
$sql.= " c.datef,";
$sql.= " c.fk_bank,";
@ -683,7 +684,8 @@ if ($rowid)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print '<td align="center">'.$langs->trans("DateSubscription").'</td>';
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
print '<td align="center">'.$langs->trans("DateStart").'</td>';
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
if (! empty($conf->banque->enabled))
@ -701,6 +703,7 @@ if ($rowid)
$cotisationstatic->ref=$objp->crowid;
$cotisationstatic->id=$objp->crowid;
print '<td>'.$cotisationstatic->getNomUrl(1).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->dateadh),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
print '<td align="right">'.price($objp->cotisation).'</td>';
@ -899,16 +902,18 @@ if ($rowid)
// Title payments
//print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
// Define a way to write payment
// No more action
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('MoreActions');
print '</td>';
print '<td>';
print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice)?' checked="checked"':'').'> '.$langs->trans("None").'<br>';
// Add entry into bank accoun
if (! empty($conf->banque->enabled))
{
print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(! empty($bankdirect)?' checked="checked"':'');
print '> '.$langs->trans("MoreActionBankDirect").'<br>';
}
// Add invoice with no payments
if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
{
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(! empty($invoiceonly)?' checked="checked"':'');
@ -916,14 +921,16 @@ if ($rowid)
print '> '.$langs->trans("MoreActionInvoiceOnly");
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
print '<br>';
}
// Add invoice with payments
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
{
print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(! empty($bankviainvoice)?' checked="checked"':'');
@ -931,12 +938,13 @@ if ($rowid)
print '> '.$langs->trans("MoreActionBankViaInvoice");
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else
{
{
print ' ('.$langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0).'.';
print '<br>';
}
print '</td></tr>';
@ -1029,4 +1037,4 @@ else
llxFooter();
$db->close();
?>
?>

View File

@ -62,7 +62,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// requete en prenant que les adherents a jour de cotisation
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql.= " d.address, d.zip, d.town, d.country, d.naiss, d.email, d.photo,";
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql.= " t.libelle as type,";
$sql.= " p.code as country_code, p.libelle as country";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
@ -101,7 +101,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
'%COUNTRY%'=>$objp->country,
'%COUNTRY_CODE%'=>$objp->country_code,
'%EMAIL%'=>$objp->email,
'%NAISS%'=>dol_print_date($objp->naiss,'day'),
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
'%TYPE%'=>$objp->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,

View File

@ -77,7 +77,7 @@ class Adherent extends CommonObject
var $datem;
var $datefin;
var $datevalid;
var $naiss;
var $birth;
var $typeid; // Id type adherent
var $type; // Libelle type adherent
@ -175,7 +175,7 @@ class Adherent extends CommonObject
{
global $conf,$langs;
$birthday = dol_print_date($this->naiss,'day');
$birthday = dol_print_date($this->birth,'day');
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
@ -214,7 +214,7 @@ class Adherent extends CommonObject
'%TOWN%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
'%COUNTRY%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
'%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
'%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
'%BIRTH%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
@ -433,7 +433,7 @@ class Adherent extends CommonObject
$sql.= ", statut=" .$this->statut;
$sql.= ", fk_adherent_type=".$this->typeid;
$sql.= ", morphy='".$this->morphy."'";
$sql.= ", naiss=" .($this->naiss?"'".$this->db->idate($this->naiss)."'":"null");
$sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null");
if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation
if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent
$sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
@ -1012,7 +1012,7 @@ class Adherent extends CommonObject
$sql.= " d.datec as datec,";
$sql.= " d.tms as datem,";
$sql.= " d.datefin as datefin,";
$sql.= " d.naiss as datenaiss,";
$sql.= " d.birth as birthday,";
$sql.= " d.datevalid as datev,";
$sql.= " d.country,";
$sql.= " d.state_id,";
@ -1079,7 +1079,7 @@ class Adherent extends CommonObject
$this->datem = $this->db->jdate($obj->datem);
$this->datefin = $this->db->jdate($obj->datefin);
$this->datevalid = $this->db->jdate($obj->datev);
$this->naiss = $this->db->jdate($obj->datenaiss);
$this->birth = $this->db->jdate($obj->birthday);
$this->note = $obj->note;
$this->morphy = $obj->morphy;
@ -1739,7 +1739,7 @@ class Adherent extends CommonObject
$this->phone_perso = '0999999998';
$this->phone_mobile = '0999999997';
$this->note='No comment';
$this->naiss=time();
$this->birth=time();
$this->photo='';
$this->public=1;
$this->statut=0;
@ -1811,7 +1811,7 @@ class Adherent extends CommonObject
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note;
if ($this->naiss && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->naiss,'dayhourldap');
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');

View File

@ -236,12 +236,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$datenaiss='';
if (isset($_POST["naissday"]) && $_POST["naissday"]
&& isset($_POST["naissmonth"]) && $_POST["naissmonth"]
&& isset($_POST["naissyear"]) && $_POST["naissyear"])
$birthdate='';
if (isset($_POST["birthday"]) && $_POST["birthday"]
&& isset($_POST["birthmonth"]) && $_POST["birthmonth"]
&& isset($_POST["birthyear"]) && $_POST["birthyear"])
{
$datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
$birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
}
// Create new object
@ -267,7 +267,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$object->phone_perso = trim($_POST["phone_perso"]);
$object->phone_mobile= trim($_POST["phone_mobile"]);
$object->email = trim($_POST["email"]);
$object->naiss = $datenaiss;
$object->birth = $birthdate;
$object->typeid = $_POST["typeid"];
//$object->note = trim($_POST["comment"]);
@ -388,12 +388,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
if ($action == 'add' && $user->rights->adherent->creer)
{
if ($canvas) $object->canvas=$canvas;
$datenaiss='';
if (isset($_POST["naissday"]) && $_POST["naissday"]
&& isset($_POST["naissmonth"]) && $_POST["naissmonth"]
&& isset($_POST["naissyear"]) && $_POST["naissyear"])
$birthdate='';
if (isset($_POST["birthday"]) && $_POST["birthday"]
&& isset($_POST["birthmonth"]) && $_POST["birthmonth"]
&& isset($_POST["birthyear"]) && $_POST["birthyear"])
{
$datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
$birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
}
$datecotisation='';
if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"]))
@ -442,7 +442,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$object->email = $email;
$object->login = $login;
$object->pass = $pass;
$object->naiss = $datenaiss;
$object->naiss = $birthdate;
$object->photo = $photo;
$object->typeid = $typeid;
//$object->note = $comment;
@ -1113,9 +1113,9 @@ else
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="email" size="40" value="'.(isset($_POST["email"])?$_POST["email"]:$object->email).'"></td></tr>';
// Date naissance
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc');
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";
// Profil public
@ -1444,8 +1444,8 @@ else
// EMail
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
// Date naissance
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->naiss,'day').'</td></tr>';
// Birthday
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';

View File

@ -47,7 +47,6 @@ $subscriptionstatic=new Cotisation($db);
print_fiche_titre($langs->trans("MembersArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
$var=True;
@ -122,7 +121,8 @@ if ($result)
}
print '<tr><td width="30%" class="notopnoleft" valign="top">';
//print '<tr><td width="30%" class="notopnoleft" valign="top">';
print '<div class="fichecenter"><div class="fichethirdleft">';
// Formulaire recherche adherent
@ -195,7 +195,9 @@ if ($conf->use_javascript_ajax)
print '</table>';
}
print '</td><td class="notopnoleftnoright" valign="top">';
//print '</td><td class="notopnoleftnoright" valign="top">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$var=true;
@ -416,8 +418,8 @@ print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td
print "</tr>\n";
print "</table><br>\n";
print '</td></tr>';
print '</table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -101,11 +102,15 @@ if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity = ".$conf->entity;
if ($sall)
{
$sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR ";
$sql.=" d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
$sql.=" OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.address LIKE '%".$sall."%'";
$sql.=" OR d.town LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')";
// For natural search
$scrit = explode(' ', $sall);
foreach ($scrit as $crit) {
$sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR ";
$sql.=" d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
$sql.=" OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.address LIKE '%".$sall."%'";
$sql.=" OR d.town LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')";
}
}
if ($type > 0)
{

View File

@ -134,13 +134,14 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print "<br>\n";
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
print "<br>\n";
$head=agenda_prepare_head();
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"));
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
print $langs->trans("OnlyActiveElementsAreShown").'<br>';
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -179,8 +180,6 @@ print '</table>';
print '<br><center>';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; ';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print "</center>";
print "</form>\n";
@ -226,12 +225,13 @@ else
}
print '</td></tr>'."\n";
print '</table>';
print "<br>";
dol_htmloutput_mesg($mesg);
$db->close();
llxFooter();
$db->close();
?>

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
*
@ -70,8 +70,6 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print "<br>\n";
print "<br>\n";
$head=agenda_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Agenda"));

View File

@ -54,8 +54,7 @@ if ($actionsave)
$db->begin();
$disableext=GETPOST('AGENDA_DISABLE_EXT','alpha');
if ($disableext) $disableext=0; else $disableext=1;
$res=dolibarr_set_const($db,'AGENDA_DISABLE_EXT',$disableext,'chaine',0);
$res=dolibarr_set_const($db,'AGENDA_DISABLE_EXT',$disableext,'chaine',0,'',$conf->entity);
$i=1; $errorsaved=0;
$error=0;
@ -67,7 +66,7 @@ if ($actionsave)
$src=trim(GETPOST('agenda_ext_src'.$i,'alpha'));
$color=trim(GETPOST('agenda_ext_color'.$i,'alpha'));
if ($color=='-1') $color='';
if (! empty($src) && ! preg_match('/^(http\s*|ftp\s*):/', $src))
{
setEventMessage($langs->trans("ErrorParamMustBeAnUrl"),'errors');
@ -75,26 +74,26 @@ if ($actionsave)
$errorsaved++;
break;
}
//print 'color='.$color;
$res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0);
$res=dolibarr_set_const($db,'AGENDA_EXT_NAME'.$i,$name,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0);
$res=dolibarr_set_const($db,'AGENDA_EXT_SRC'.$i,$src,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0);
$res=dolibarr_set_const($db,'AGENDA_EXT_COLOR'.$i,$color,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$i++;
}
// Save nb of agenda
if (! $error)
{
$res=dolibarr_set_const($db,'AGENDA_EXT_NB',trim(GETPOST('AGENDA_EXT_NB','alpha')),'chaine',0);
$res=dolibarr_set_const($db,'AGENDA_EXT_NB',trim(GETPOST('AGENDA_EXT_NB','alpha')),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB;
}
if (! $error)
{
$db->commit();
@ -124,34 +123,57 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print '<br>';
print $langs->trans("AgendaExtSitesDesc")."<br>\n";
print "<br>\n";
$head=agenda_prepare_head();
dol_fiche_head($head, 'extsites', $langs->trans("Agenda"));
print $langs->trans("AgendaExtSitesDesc")."<br>\n";
print "<br>\n";
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
$selectedvalue=(GETPOST('AGENDA_DISABLE_AGENDA','alpha'))?GETPOST('AGENDA_DISABLE_EXT','alpha'):$conf->global->AGENDA_DISABLE_EXT;
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
print $langs->trans("ExtSitesEnableThisTool").' '.$form->selectyesno("AGENDA_DISABLE_EXT",$selectedvalue,1).'<br><br>';
$var=false;
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<td width="180">'.$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print '<td>'.$langs->trans("Parameter")."</td>";
print '<td align="center">'.$langs->trans("Value")."</td>";
print "</tr>";
// Show external agenda
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("ExtSitesEnableThisTool")."</td>";
print '<td align="center">';
if ($conf->use_javascript_ajax)
{
print ajax_constantonoff('AGENDA_DISABLE_EXT',array('enabled'=>array(0=>'.hideifnotset')),null,1);
}
else
{
if($conf->global->AGENDA_DISABLE_EXT == 0)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=1">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=0">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
}
print "</td>";
print "</tr>";
// Nb of agenda
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("ExtSitesNbOfAgenda")."</td>";
print "<td>";
print '<input class="flat" type="text" size="2" name="AGENDA_EXT_NB" value="'.$conf->global->AGENDA_EXT_NB.'">';
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("ExtSitesNbOfAgenda")."</td>";
print '<td align="center">';
print '<input class="flat hideifnotset" type="text" size="2" id="AGENDA_EXT_NB" name="AGENDA_EXT_NB" value="'.$conf->global->AGENDA_EXT_NB.'">';
print "</td>";
print "</tr>";
print "</table>";
print "<br>";
@ -162,7 +184,7 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Name")."</td>";
print "<td>".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)</td>';
print '<td align="center">'.$langs->trans("Color").'</td>';
print '<td align="right">'.$langs->trans("Color").'</td>';
print "</tr>";
$i=1;
@ -173,19 +195,19 @@ while ($i <= $MAXAGENDA)
$name='AGENDA_EXT_NAME'.$key;
$src='AGENDA_EXT_SRC'.$key;
$color='AGENDA_EXT_COLOR'.$key;
$var=!$var;
print "<tr ".$bc[$var].">";
// Nb
print '<td width="180" nowrap="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";
// Name
print '<td><input type="text" class="flat" name="agenda_ext_name'.$key.'" value="'. (GETPOST('agenda_ext_name'.$key)?GETPOST('agenda_ext_name'.$key):$conf->global->$name) . '" size="28"></td>';
print '<td><input type="text" class="flat hideifnotset" name="agenda_ext_name'.$key.'" value="'. (GETPOST('agenda_ext_name'.$key)?GETPOST('agenda_ext_name'.$key):$conf->global->$name) . '" size="28"></td>';
// URL
print '<td><input type="url" class="flat" name="agenda_ext_src'.$key.'" value="'. (GETPOST('agenda_ext_src'.$key)?GETPOST('agenda_ext_src'.$key):$conf->global->$src) . '" size="60"></td>';
print '<td><input type="url" class="flat hideifnotset" name="agenda_ext_src'.$key.'" value="'. (GETPOST('agenda_ext_src'.$key)?GETPOST('agenda_ext_src'.$key):$conf->global->$src) . '" size="60"></td>';
// Color (Possible colors are limited by Google)
print '<td nowrap="nowrap" align="center">';
//print $formadmin->select_colors($conf->global->$color, "google_agenda_color".$key, $colorlist);
print $formother->select_color((GETPOST("agenda_ext_color".$key)?GETPOST("agenda_ext_color".$key):$conf->global->$color), "agenda_ext_color".$key, 'extsitesconfig', 1, '');
print '<td nowrap="nowrap" align="right">';
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
print $formother->selectColor((GETPOST("agenda_ext_color".$key)?GETPOST("agenda_ext_color".$key):$conf->global->$color), "agenda_ext_color".$key, 'extsitesconfig', 1, '', 'hideifnotset');
print '</td>';
print "</tr>";
$i++;

View File

@ -75,13 +75,13 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'setup');
print '<br>';
print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
print "<br>\n";
$head=agenda_prepare_head();
dol_fiche_head($head, 'xcal', $langs->trans("Agenda"));
print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
print "<br>\n";
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 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
@ -18,12 +19,12 @@
/**
* \file htdocs/compta/bank/admin/bank.php
* \file htdocs/admin/bank.php
* \ingroup bank
* \brief Page to setup the bank module
*/
require '../../../main.inc.php';
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -87,6 +88,16 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("BankSetupModule"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/bank.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>';

View File

@ -1,5 +1,7 @@
<?php
/*
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -17,7 +19,7 @@
/**
* \file htdocs/admin/carrier.php
* \ingroup expedition
* \brief Page d'administration des Transporteurs
* \brief Page to setup carriers. TODO Delete this page. We mut use dictionnary instead.
*/
require '../main.inc.php';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 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
@ -66,7 +66,7 @@ if ($action == 'updateMask')
}
}
if ($action == 'specimen')
else if ($action == 'specimen')
{
$modele=GETPOST('module','alpha');
@ -111,74 +111,36 @@ if ($action == 'specimen')
}
}
if ($action == 'set')
// Activate a model
else if ($action == 'set')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='order';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'del')
else if ($action == 'del')
{
$type='order';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$db->escape($value)."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF',$conf->entity);
}
}
if ($action == 'setdoc')
// Set default model
else if ($action == 'setdoc')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin();
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->COMMANDE_ADDON_PDF = $value;
}
// On active le modele
$type='order';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
dol_syslog("Delete from model table ".$sql_del);
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$value."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$scandir."'":"null");
$sql.= ")";
dol_syslog("Insert into model table ".$sql);
$result2=$db->query($sql);
if ($result1 && $result2)
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$db->commit();
}
else
{
dol_syslog("Error ".$db->lasterror(), LOG_ERR);
$db->rollback();
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
@ -240,10 +202,18 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/commande.php";
$head[$h][1] = $langs->trans("Orders");
$head[$h][2] = 'Order';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*
* Numbering module
* Orders Numbering model
*/
print_titre($langs->trans("OrdersNumberingModules"));
@ -276,22 +246,22 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering module
// Show example of numbering model
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
@ -508,11 +478,14 @@ foreach ($dirmodels as $reldir)
}
print '</table>';
//Autres Options
print "<br>";
print_titre($langs->trans("OtherOptions"));
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -547,7 +547,7 @@ if ($action == 'edit' || $action == 'updateedit')
/*
* Local Taxes
*/
if ($mysoc->hasLocalTax(1))
if ($mysoc->useLocalTax(1))
{
// Local Tax 1
print '<br>';
@ -579,7 +579,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</td></tr>\n";
print "</table>";
}
if ($mysoc->hasLocalTax(2))
if ($mysoc->useLocalTax(2))
{
// Local Tax 2
print '<br>';
@ -927,7 +927,7 @@ else
/*
* Local Taxes
*/
if ($mysoc->hasLocalTax(1))
if ($mysoc->useLocalTax(1))
{
// Local Tax 1
print '<br>';
@ -960,7 +960,7 @@ else
print "</table>";
}
if ($mysoc->hasLocalTax(2))
if ($mysoc->useLocalTax(2))
{
// Local Tax 2
print '<br>';

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 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
@ -35,6 +36,10 @@ accessforbidden();
$action = GETPOST('action','alpha');
/*
* Actions
*/
$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES';
if ($action == 'setcomptamode')
@ -87,7 +92,7 @@ if ($action == 'update' || $action == 'add')
}*/
/*
* Affichage page
* View
*/
llxHeader();
@ -97,9 +102,18 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans('ComptaSetup'),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/compta.php";
$head[$h][1] = $langs->trans("Compta");
$head[$h][2] = 'Compta';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<table class="noborder" width="100%">';
// Cas du parametre COMPTA_MODE

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 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
@ -27,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$langs->load("admin");
$langs->load("errors");
$langs->load("contracts");
if (!$user->admin) accessforbidden();
@ -88,6 +90,20 @@ print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/contract.php";
$head[$h][1] = $langs->trans("Contracts");
$head[$h][2] = 'Contract';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*
* Contracts Numbering model
*/
print_titre($langs->trans("ContractsNumberingModules"));
print '<table class="noborder" width="100%">';
@ -129,7 +145,7 @@ if (is_resource($handle))
print $module->info();
print '</td>';
// Show example of numbering module
// Show example of numbering model
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }

View File

@ -70,8 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionnaries properties
// Sort order to show dictionnary (0 is space). All other dictionnaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,23);
if (! empty($conf->global->MAIN_USE_REVENUESTAMP)) $taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,25,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,23);
$taborder=array(9,0,4,3,2,0,1,8,19,16,0,5,11,0,6,0,10,25,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,23);
// Name of SQL tables of dictionnaries
$tabname=array();
@ -325,7 +324,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy plan should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[24]= (! empty($conf->global->ACCOUNTING_USEDICTTOEDIT) && ! empty($conf->accounting->enabled)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[25]= (! empty($conf->global->MAIN_USE_REVENUESTAMP)); // The accountancy system should be edited with specific pages. You can set ACCOUNTING_USEDICTTOEDIT to 1 if you want to use dictionnary editor.
$tabcond[25]= true;
// List of help for fields
$tabhelp=array();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 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
@ -47,7 +48,7 @@ if ($action == 'specimen')
$don = new Don($db);
$don->initAsSpecimen();
// Charge le modele
// Search template files
$dir = DOL_DOCUMENT_ROOT . "/core/modules/dons/";
$file = $modele.".modules.php";
if (file_exists($dir.$file))
@ -75,67 +76,39 @@ if ($action == 'specimen')
}
}
if ($action == 'setdoc')
// Set default model
else if ($action == 'setdoc')
{
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin();
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->DON_ADDON_MODEL = $value;
}
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$value,'chaine',0,'',$conf->entity))
{
$conf->global->DON_ADDON_MODEL = $value;
}
// On active le modele
$type='donation';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$db->escape($value)."' AND type = '".$type."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit();
}
else
{
$db->rollback();
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
if ($action == 'set')
// Activate a model
else if ($action == 'set')
{
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='donation';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$resql=$db->query($sql);
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'del')
else if ($action == 'del')
{
$value = GETPOST('value','alpha');
$type='donation';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE nom = '".$value."' AND type = '".$type."'";
$resql=$db->query($sql);
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->DON_ADDON_MODEL == "$value") dolibarr_del_const($db, 'DON_ADDON_MODEL',$conf->entity);
}
}
/*
* View
*/
@ -147,6 +120,17 @@ llxHeader('',$langs->trans("DonationsSetup"),'DonConfiguration');
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/dons.php";
$head[$h][1] = $langs->trans("Donations");
$head[$h][2] = 'Donation';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
// Document templates

View File

@ -70,6 +70,17 @@ llxHeader('',$langs->trans("ECMSetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ECMSetup"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/ecm.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 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
@ -220,9 +220,8 @@ if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*
* Numbering module
*/
//print "<br>";
* Expedition numbering model
*/
print_titre($langs->trans("SendingsNumberingModules"));
@ -254,16 +253,16 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/expedition/".$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n";
print '<td>';
@ -273,7 +272,9 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
}
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
@ -328,7 +329,7 @@ print '</table><br>';
/*
* Modeles de documents
* Documents models for Sendings Receipt
*/
print_titre($langs->trans("SendingsReceiptModel"));

View File

@ -41,6 +41,8 @@ $modules = array(
'PRODUCTDESC' => 'FCKeditorForProduct',
'MAILING' => 'FCKeditorForMailing',
'DETAILS' => 'FCKeditorForProductDetails',
'USERSIGN' => 'FCKeditorForUserSignature',
'MAIL' => 'FCKeditorForMail'
);
// Conditions pour que l'option soit proposee
$conditions = array(
@ -48,6 +50,8 @@ $conditions = array(
'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)),
'MAILING' => ! empty($conf->mailing->enabled),
'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)),
'USERSIGN' => 1,
'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled))
);
// Picto
$picto = array(
@ -55,6 +59,8 @@ $picto = array(
'PRODUCTDESC' => 'product',
'MAILING' => 'email',
'DETAILS' => 'generic',
'USERSIGN' => 'user',
'MAIL' => 'email'
);

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 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
@ -67,42 +67,7 @@ if ($action == 'updateMask')
}
}
if ($action == 'set_FICHINTER_FREE_TEXT')
{
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen')
else if ($action == 'specimen') // For fiche inter
{
$modele= GETPOST('module','alpha');
@ -147,12 +112,13 @@ if ($action == 'specimen')
}
}
if ($action == 'set')
// Activate a model
else if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'del')
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
@ -161,7 +127,8 @@ if ($action == 'del')
}
}
if ($action == 'setdoc')
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
@ -178,7 +145,7 @@ if ($action == 'setdoc')
}
}
if ($action == 'setmod')
else if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
@ -186,6 +153,41 @@ if ($action == 'setmod')
dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity);
}
else if ($action == 'set_FICHINTER_FREE_TEXT')
{
$freetext= GETPOST('FICHINTER_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/*
* View
@ -202,6 +204,17 @@ print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php";
$head[$h][1] = $langs->trans("Interventions");
$head[$h][2] = 'Ficheinter';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
// Interventions numbering model
print_titre($langs->trans("FicheinterNumberingModules"));
@ -234,22 +247,22 @@ foreach ($dirmodels as $reldir)
$file = $reg[1];
$classname = substr($file,4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/fichinter/".$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering module
// Show example of numbering model
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
@ -295,6 +308,9 @@ foreach ($dirmodels as $reldir)
print '</table><br>';
/*
* Documents models for Interventions
*/
print_titre($langs->trans("TemplatePDFInterventions"));
@ -377,7 +393,7 @@ foreach ($dirmodels as $reldir)
print "</td>";
}
// Defaut
// Default
print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{
@ -413,11 +429,14 @@ foreach ($dirmodels as $reldir)
}
print '</table>';
//Autres Options
print "<br>";
print_titre($langs->trans("OtherOptions"));
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -303,7 +303,7 @@ print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
print '<td align="right">&nbsp;</td>';
print '</tr>';
// Date naissance
// Birthday
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';
print '<input size="25" type="text" name="fieldbirthdate" value="'.$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE.'">';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 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
@ -164,7 +164,7 @@ if ($action == 'setmod')
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "LIVRAISON_ADDON",$value,'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "LIVRAISON_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity);
}
@ -209,8 +209,9 @@ $h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*
* Module numerotation
* Livraison numbering model
*/
print_titre($langs->trans("DeliveryOrderNumberingModules"));
print '<table class="noborder" width="100%">';
@ -240,16 +241,16 @@ foreach ($dirmodels as $reldir)
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/livraison/".$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
@ -258,13 +259,15 @@ foreach ($dirmodels as $reldir)
// Show example of numbering module
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
}
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->LIVRAISON_ADDON == "$file")
if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"),'switch_on');
}
@ -311,12 +314,12 @@ print '</table>';
/*
* Modeles de documents
* Documents Models for delivery
*/
print '<br>';
print_titre($langs->trans("DeliveryOrderModel"));
// Defini tableau def de modele invoice
// Defini tableau def de modele
$type="delivery";
$def = array();
@ -397,7 +400,7 @@ foreach ($dirmodels as $reldir)
print "</td>";
}
// Defaut
// Default
print "<td align=\"center\">";
if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{

View File

@ -103,6 +103,16 @@ llxHeader('',$langs->trans("MailingSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("MailingSetup"),$linkback,'setup');
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mailing.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
dol_htmloutput_mesg($mesg);

View File

@ -434,7 +434,7 @@ if ($action == 'edit')
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">';
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '">';
}
else
{

View File

@ -149,7 +149,7 @@ $head[$h][2] = 'editor';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/menus/other.php";
$head[$h][1] = $langs->trans("Miscellanous");
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'misc';
$h++;

View File

@ -232,7 +232,7 @@ $head[$h][2] = 'editor';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/menus/other.php";
$head[$h][1] = $langs->trans("Miscellanous");
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'misc';
$h++;

View File

@ -87,7 +87,7 @@ $head[$h][2] = 'editor';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/menus/other.php";
$head[$h][1] = $langs->trans("Miscellanous");
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'misc';
$h++;

View File

@ -71,8 +71,6 @@ $_SESSION["mode"]=$mode;
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url);
print_fiche_titre($langs->trans("ModulesSetup"),'','setup');
// Search modules dirs
$modulesdir = array();
@ -194,19 +192,22 @@ asort($orders);
//var_dump($categ);
//var_dump($modules);
// Start to show page
if (empty($mode)) $mode='common';
if ($mode==='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."<br>\n";
if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."<br>\n";
if ($mode==='functional') print $langs->trans("ModulesJobDesc")."<br>\n";
if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>\n";
$nbofactivatedmodules=count($conf->modules);
print $langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1));
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1));
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'setup');
// Start to show page
if (empty($mode)) $mode='common';
if ($mode==='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode==='other') print $langs->trans("ModulesSpecialDesc")."<br>\n";
if ($mode==='interfaces') print $langs->trans("ModulesInterfaceDesc")."<br>\n";
if ($mode==='functional') print $langs->trans("ModulesJobDesc")."<br>\n";
if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>\n";
if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule"));
print '<br>'."\n";
//print '<br>'."\n";
$h = 0;
@ -499,7 +500,7 @@ dol_fiche_end();
// Show warning about external users
print showModulesExludedForExternal($modules).'<br>'."\n";
if ($mode != 'marketplace') print showModulesExludedForExternal($modules).'<br>'."\n";
llxFooter();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2103 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -57,17 +57,31 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
// {
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
}
// }
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
if ($action == 'activate_pdfsecurity')
{
dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
else if ($action == 'disable_pdfsecurity')
{
dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
/*
* View
@ -210,8 +224,8 @@ if ($action == 'edit') // Edit
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
// {
//Desc
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
@ -229,7 +243,7 @@ if ($action == 'edit') // Edit
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1);
print '</td></tr>';
}
// }
print '</table>';
@ -366,34 +380,64 @@ else // Show
print_fiche_titre($langs->trans("Other"),'','').'<br>';
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
// Hide any PDF informations
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
{
// Encrypt and protect PDF
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>';
$text = $langs->trans("ProtectAndEncryptPdfFiles");
$desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1);
print $desc;
print '</td>';
print '<td width="60">';
if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
{
print img_picto($langs->trans("Active"),'tick');
}
print '</td>';
print '<td align="center" width="140">';
if ($conf->global->PDF_SECURITY_ENCRYPTION == 0)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_pdfsecurity">'.$langs->trans("Activate").'</a>';
}
if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
}
print "</td>";
print "</td>";
print '</tr>';
// if ($conf->global->MAIN_FEATURES_LEVEL > 1)
// {
//Desc
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
print '</td></tr>';
//Ref
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
print '</td></tr>';
//Details
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
print '</td></tr>';
}
// }
print '</table>';

View File

@ -117,6 +117,17 @@ llxHeader('',$langs->trans("WithdrawalsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("WithdrawalsSetup"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/prelevement.php";
$head[$h][1] = $langs->trans("Withdrawals");
$head[$h][2] = 'Withdrawal';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<form method="post" action="prelevement.php?action=set">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,13 +17,13 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
/**
* \file htdocs/admin/project.php
* \ingroup project
* \brief Page to setup project module
*/
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@ -45,7 +46,7 @@ $type='project';
/*
* Actions
*/
*/
if ($action == 'updateMask')
{
@ -56,17 +57,17 @@ if ($action == 'updateMask')
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen')
else if ($action == 'specimen')
{
$modele=GETPOST('module','alpha');
@ -78,7 +79,7 @@ if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0);
$file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@ -95,8 +96,8 @@ if ($action == 'specimen')
if ($module->write_file($project,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project&file=SPECIMEN.pdf");
return;
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project&file=SPECIMEN.pdf");
return;
}
else
{
@ -111,21 +112,23 @@ if ($action == 'specimen')
}
}
if ($action == 'set')
// Activate a model
else if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'del')
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->PROJECT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROJECT_ADDON_PDF',$conf->entity);
if ($conf->global->PROJECT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROJECT_ADDON_PDF',$conf->entity);
}
}
if ($action == 'setdoc')
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
@ -142,7 +145,7 @@ if ($action == 'setdoc')
}
}
if ($action == 'setmod')
else if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
@ -152,11 +155,11 @@ if ($action == 'setmod')
/*
* View
*/
*/
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader();
llxHeader("",$langs->trans("ProjectsSetup"));
$form=new Form($db);
@ -165,8 +168,20 @@ print_fiche_titre($langs->trans("ProjectsSetup"),$linkback,'setup');
print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/project.php";
$head[$h][1] = $langs->trans("Projects");
$head[$h][2] = 'Project';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
/*
* Projects Numbering model
*/
// Project numbering module
print_titre($langs->trans("ProjectsNumberingModules"));
print '<table class="noborder" width="100%">';
@ -198,7 +213,7 @@ foreach ($dirmodels as $reldir)
$file = $reg[1];
$classname = substr($file,4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$file.'.php';
require_once $dir.$file.'.php';
$module = new $file;
@ -213,7 +228,7 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering module
// Show example of numbering model
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
@ -269,8 +284,8 @@ print '</table><br>';
/*
* Modeles documents for projects
*/
* Document templates generators
*/
print_titre($langs->trans("ProjectsModelModule"));
@ -323,59 +338,80 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle))!==false)
{
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";
print "</td>\n <td>\n";
require_once $dir.$file;
$module = new $classname($db);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
if (file_exists($dir.'/'.$file))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
// Defaut
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
require_once $dir.'/'.$file;
$module = new $classname($db);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'project').'</a>';
print $form->textwithpicto(' &nbsp; &nbsp; '.$link,$htmltooltip,-1,0);
print '</td>';
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
print "</tr>\n";
if ($modulequalified)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
print "<td align=\"center\">";
if ($conf->global->PROJECT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
closedir($handle);

View File

@ -154,19 +154,6 @@ else if ($action == 'disable_encryptdbpassconf')
}
}
if ($action == 'activate_pdfsecurity')
{
dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity);
header("Location: security.php");
exit;
}
else if ($action == 'disable_pdfsecurity')
{
dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity);
header("Location: security.php");
exit;
}
if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK')
{
dolibarr_set_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", '1','chaine',0,'',$conf->entity);
@ -364,37 +351,6 @@ print "</td>";
print "</td>";
print '</tr>';
// Encryption et protection des PDF
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="3">';
$text = $langs->trans("ProtectAndEncryptPdfFiles");
$desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1);
print $desc;
print '</td>';
print '<td align="center" width="60">';
if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
{
print img_picto($langs->trans("Active"),'tick');
}
print '</td>';
print '<td align="center" width="100">';
if ($conf->global->PDF_SECURITY_ENCRYPTION == 0)
{
print '<a href="security.php?action=activate_pdfsecurity">'.$langs->trans("Activate").'</a>';
}
if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
{
print '<a href="security.php?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
}
print "</td>";
print "</td>";
print '</tr>';
// Disable link "Forget password" on logon
$var=!$var;

View File

@ -123,11 +123,11 @@ else if ($action == 'delete')
$form = new Form($db);
llxHeader('',$langs->trans("Miscellanous"));
llxHeader('',$langs->trans("Miscellaneous"));
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
print $langs->trans("MiscellanousDesc")."<br>\n";
print $langs->trans("MiscellaneousDesc")."<br>\n";
print "<br>\n";
$head=security_prepare_head();

View File

@ -3,6 +3,7 @@
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 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
@ -97,6 +98,16 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/stock.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
$form=new Form($db);
$var=true;
print '<table class="noborder" width="100%">';
@ -124,9 +135,12 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print '</form>';
print "</td>\n";
print "</tr>\n";
print '<br>';
print '</table>';
print '<br>';
// Title rule for stock decrease
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
@ -174,9 +188,11 @@ if (! empty($conf->expedition->enabled))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</form>\n</td>\n</tr>\n";
}
print '</table>';
print '<br>';
// Title rule for stock increase
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";

View File

@ -0,0 +1,483 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/supplier_invoice.php
* \ingroup fournisseur
* \brief Setup to admin supplier invoices
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->load("admin");
$langs->load("other");
$langs->load("orders");
if (!$user->admin)
accessforbidden();
$type=GETPOST('type', 'alpha');
$value=GETPOST('value', 'alpha');
$action=GETPOST('action', 'alpha');
$specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen();
/*
* Actions
*/
if ($action == 'updateMask')
{
$maskconstinvoice=GETPOST('maskconstinvoice','alpha');
$maskvalue=GETPOST('maskvalue','alpha');
if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
if ($action == 'specimen') // For invoices
{
$modele=GETPOST('module','alpha');
$facture = new FactureFournisseur($db);
$facture->initAsSpecimen();
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db,$facture);
if ($module->write_file($facture,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
return;
}
else
{
$mesg='<font class="error">'.$module->error.'</font>';
dol_syslog($module->error, LOG_ERR);
}
}
else
{
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
else if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'INVOICE_SUPPLIER_ADDON_PDF',$conf->entity);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity);
}
if ($action == 'addcat')
{
$fourn = new Fournisseur($db);
$fourn->CreateCategory($user,$_POST["cat"]);
}
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
{
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
/*
* View
*/
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("","");
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');
print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_order.php";
$head[$h][1] = $langs->trans("SupplierOrder");
$head[$h][2] = 'Order';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php";
$head[$h][1] = $langs->trans("SuppliersInvoice");
$head[$h][2] = 'Invoice';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
// Supplier invoice numbering module
print_titre($langs->trans("SuppliersInvoiceNumberingModel"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once $dir.$file.'.php';
$module = new $file;
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td nowrap="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/',$tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
}
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"),'switch_on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
print '</td>';
$invoice=new FactureFournisseur($db);
$invoice->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$invoice);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval)
{
$htmltooltip.=$nextval.'<br>';
}
else
{
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
}
}
}
closedir($handle);
}
}
}
print '</table><br>';
/*
* Modeles documents for supplier invoices
*/
print_titre($langs->trans("BillsPDFModules"));
// Defini tableau def de modele
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'order_supplier'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
print '<td align="center" width="40" colspan="2">'.$langs->trans("Info").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n";
print "<td>".$name."</td>\n";
print "<td>\n";
require_once $dir.$file;
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'switch_on');
}
print "</td>";
}
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
}
print '</table><br/>';
print '<br>';
/*
* Other options
*
*/
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
dol_htmloutput_mesg($mesg);
$db->close();
llxFooter();
?>

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2013 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
@ -22,7 +22,7 @@
*/
/**
* \file htdocs/admin/fournisseur.php
* \file htdocs/admin/supplier_order.php
* \ingroup fournisseur
* \brief Page d'administration-configuration du module Fournisseur
*/
@ -31,10 +31,10 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->load("admin");
$langs->load('other');
$langs->load("other");
$langs->load("orders");
if (!$user->admin)
accessforbidden();
@ -54,9 +54,9 @@ $specimenthirdparty->initAsSpecimen();
if ($action == 'updateMask')
{
$maskconstorder=GETPOST('maskconstorder','alpha');
$maskorder=GETPOST('maskorder','alpha');
$maskvalue=GETPOST('maskvalue','alpha');
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -70,7 +70,7 @@ if ($action == 'updateMask')
}
}
if ($action == 'specimen') // For orders
else if ($action == 'specimen') // For orders
{
$modele=GETPOST('module','alpha');
@ -116,143 +116,58 @@ if ($action == 'specimen') // For orders
}
}
if ($action == 'specimenfacture') // For invoices
// Activate a model
else if ($action == 'set')
{
$modele=GETPOST('module','alpha');
$facture = new FactureFournisseur($db);
$facture->initAsSpecimen();
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db,$facture);
if ($module->write_file($facture,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
return;
}
else
{
$mesg='<font class="error">'.$module->error.'</font>';
dol_syslog($module->error, LOG_ERR);
}
}
else
{
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
$ret = addDocumentModel($value, $type, $label, $scandir);
}
if ($action == 'set')
else if ($action == 'del')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$res=$db->query($sql);
if ($res)
{
}
// else dol_print_error($db);
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_SUPPLIER_ADDON_PDF',$conf->entity);
}
}
if ($action == 'del')
// Set default model
else if ($action == 'setdoc')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom = '".$value."'";
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$db->query($sql);
if ($res)
{
if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value;
}
}
// else dol_print_error($db);
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
if ($action == 'setdoc')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$db->begin();
if ($type == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $value;
}
if ($type == 'invoice_supplier' && dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
}
// On active le modele
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
$result2=$db->query($sql);
if ($result1 && $result2)
{
$db->commit();
}
else
{
$db->rollback();
}
}
if ($action == 'setmod')
else if ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$value,'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity);
}
if ($action == 'addcat')
else if ($action == 'addcat')
{
$fourn = new Fournisseur($db);
$fourn->CreateCategory($user,$_POST["cat"]);
}
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
{
$freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT'); // No alpha here, we want exact string
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
$res = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -273,7 +188,7 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader();
llxHeader("","");
$form=new Form($db);
@ -282,6 +197,22 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');
print "<br>";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_order.php";
$head[$h][1] = $langs->trans("SupplierOrder");
$head[$h][2] = 'Order';
$hselected=$h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/supplier_invoice.php";
$head[$h][1] = $langs->trans("SuppliersInvoice");
$head[$h][2] = 'Invoice';
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
// Supplier order numbering module
@ -341,7 +272,7 @@ foreach ($dirmodels as $reldir)
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file")
if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file")
{
print img_picto($langs->trans("Activated"),'switch_on');
}
@ -387,10 +318,8 @@ foreach ($dirmodels as $reldir)
print '</table><br>';
/*
* Modeles documents for supplier orders
* Documents models for supplier orders
*/
print_titre($langs->trans("OrdersModelModule"));
@ -431,17 +360,14 @@ print '</tr>'."\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
@ -483,7 +409,7 @@ foreach ($dirmodels as $reldir)
print "</td>";
}
// Defaut
// Default
print '<td align="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
{
@ -520,138 +446,13 @@ foreach ($dirmodels as $reldir)
}
print '</table><br/>';
print '<br>';
/*
* Modeles documents for supplier invoices
* Other options
*
*/
print_titre($langs->trans("BillsPDFModules"));
// Defini tableau def de modele
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = 'invoice_supplier'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
print '<td align="center" width="40" colspan="2">'.$langs->trans("Info").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n";
print "<td>".$name."</td>\n";
print "<td>";
require_once $dir.$file;
$module = new $classname($db,$specimenthirdparty);
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'switch_on');
}
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Defaut
print "<td align=\"center\">";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimenfacture&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
}
print '</table><br/>';
print_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -662,10 +463,10 @@ print "</tr>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print '<textarea name="SUPPLIER_INVOICE_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_INVOICE_FREE_TEXT.'</textarea>';
print '<textarea name="SUPPLIER_ORDER_FREE_TEXT" class="flat" cols="120">'.$conf->global->SUPPLIER_ORDER_FREE_TEXT.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -44,7 +44,7 @@ print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png
print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':';
print '<ul>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL</a></li>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
print '</ul>';
//print "<br>\n";

View File

@ -132,27 +132,27 @@ $var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
$var=!$var;
$thousand=$langs->trans("SeparatorThousand");
$thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method
if ($thousand == 'None') $thousand='';
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->trans("Space"):$thousand).'</td></tr>'."\n";
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'</td></tr>'."\n";
// Decimals
$var=!$var;
$dec=$langs->trans("SeparatorDecimal");
$dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
// Show results of functions to see if everything works
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>';
print '<tr '.$bc[$var].'><td width="300">&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>'."\n";
$var=!$var;
print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td>";
print "<tr ".$bc[$var].'><td width="300">&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td></tr>\n";
if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
{
$var=!$var;
print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
print "<tr ".$bc[$var].'><td width="300">&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
print "</tr>\n";
}
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td>';
print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone
$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php

View File

@ -121,6 +121,17 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans('TaxSetup'),$linkback,'setup');
print '<br>';
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/taxes.php";
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$hselected=$h;
$h++;
dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
print '<br>';

View File

@ -195,7 +195,7 @@ print $langs->trans("BackupDescY").'<br><br>';
<div class="formelementrow"><input type="checkbox" name="disable_fk"
value="yes" id="checkbox_disable_fk" checked="checked" /> <label
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?></label>
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
</div>
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label>

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -111,7 +111,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
* View
*/
llxHeader();
llxHeader('',$langs->trans("Audit"));
$form=new Form($db);
@ -124,11 +124,11 @@ $sql.= " u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
$sql.= " WHERE e.entity = ".$conf->entity;
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$search_code."%'"; }
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$search_ip."%'"; }
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$search_user."%'"; }
if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$search_desc."%'"; }
if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$search_ua."%'"; }
if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; }
if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; }
if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; }
if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$db->escape($search_desc)."%'"; }
if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$db->escape($search_ua)."%'"; }
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql;
@ -138,7 +138,14 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
$param='';
if ($search_code) $param.='&search_code='.$search_code;
if ($search_ip) $param.='&search_ip='.$search_ip;
if ($search_user) $param.='&search_user='.$search_user;
if ($search_desc) $param.='&search_desc='.$search_desc;
if ($search_ua) $param.='&search_ua='.$search_ua;
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup');
if ($action == 'purge')
{
@ -178,7 +185,7 @@ if ($result)
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
//print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
print '</td>';
print '<td align="right" class="liste_titre">';

View File

@ -77,7 +77,7 @@ if ( $retour >= 0 )
{
$return=array();
$sql = "SELECT rowid, name, firstname";
$sql = "SELECT rowid, lastname, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE login = '".$username."'";
$sql.= " AND entity IN (0,".$conf->entity.")";

View File

@ -60,9 +60,9 @@ llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
print_fiche_titre($title);
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
@ -89,7 +89,9 @@ print '<td><input type="submit" class="button" value="'.$langs->trans ("Search")
print '</table></form>';
print '</td><td valign="top" width="70%">';
//print '</td><td valign="top" width="70%">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
@ -121,7 +123,8 @@ if ($catname || $id > 0)
}
print '</td></tr></table>';
//print '</td></tr></table>';
print '<div></div></div>';
print '<br>';

View File

@ -575,7 +575,7 @@ if ($action == 'create')
$numproject=select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
if ($numproject==0)
{
print ' &nbsp; <a href="'.DOL_DOCUMENT_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
}
print '</td></tr>';
}

View File

@ -87,8 +87,9 @@ llxHeader();
print_fiche_titre($langs->trans("CustomerArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr>';
if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
(! empty($conf->contrat->enabled) && $user->rights->contrat->lire) ||
@ -96,6 +97,7 @@ if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
{
print '<td valign="top" width="30%" class="notopnoleft">';
}
*/
// Recherche Propal
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
@ -256,7 +258,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
}
}
if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
/*if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
(! empty($conf->contrat->enabled) && $user->rights->contrat->lire) ||
(! empty($conf->commande->enabled) && $user->rights->commande->lire))
{
@ -266,8 +269,8 @@ if ((! empty($conf->propal->enabled) && $user->rights->propale->lire) ||
else
{
print '<td valign="top" width="100%" class="notopnoleftnoright">';
}
}*/
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$NBMAX=3;
@ -542,11 +545,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
}
print '</td></tr>';
print '</table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -23,6 +23,8 @@
* \brief Fiche mailing, onglet general
*/
if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -61,8 +63,8 @@ $object->substitutionarray=array(
'__OTHER3__' => 'Other3',
'__OTHER4__' => 'Other4',
'__OTHER5__' => 'Other5',
'__SIGNATURE__' => 'TagSignature',
//'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet
'__SIGNATURE__' => 'TagSignature'
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet
);
if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
@ -86,8 +88,8 @@ $object->substitutionarrayfortest=array(
'__OTHER3__' => 'TESTOther3',
'__OTHER4__' => 'TESTOther4',
'__OTHER5__' => 'TESTOther5',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''),
//'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'')
//,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet
);
if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE))
{
@ -676,7 +678,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value="'.$_POST['sujet'].'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
$htmlother->select_color($_POST['bgcolor'],'bgcolor','new_mailing',0);
print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0);
print '</td></tr>';
print '<tr><td width="25%" class="fieldrequired" valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
@ -768,7 +770,7 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/liste.php">'.$langs->trans("BackToList").'</a>';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object,'id', $linkback);
print '</td></tr>';
@ -789,10 +791,10 @@ else
print '</td></tr>';
// Status
print '<tr><td width="15%">'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
// Nb of distinct emails
print '<tr><td width="15%">';
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
@ -979,7 +981,7 @@ else
print '<table class="border" width="100%">';
// Subject
print '<tr><td width="15%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3">'.$object->sujet.'</td></tr>';
// Joined files
print '<tr><td>'.$langs->trans("MailFile").'</td><td colspan="3">';
@ -1001,13 +1003,26 @@ else
// Background color
/*print '<tr><td width="15%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
$htmlother->select_color($object->bgcolor,'bgcolor','edit_mailing',0);
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
print '</td></tr>';*/
// Message
print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>';
print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
foreach($object->substitutionarray as $key => $val)
{
print $key.' = '.$langs->trans($val).'<br>';
}
print '</i></td>';
print '<td colspan="3" bgcolor="'.($object->bgcolor?(preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor:'white').'">';
print dol_htmlentitiesbr($object->body);
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff')
{
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70);
$doleditor->Create();
}
else print dol_htmlentitiesbr($object->body);
print '</td>';
print '</tr>';
@ -1040,7 +1055,7 @@ else
print '<tr><td width="25%">';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>');
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
{
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
@ -1124,7 +1139,7 @@ else
// Background color
print '<tr><td width="25%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
$htmlother->select_color($object->bgcolor,'bgcolor','edit_mailing',0);
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
print '</td></tr>';
// Message
@ -1142,13 +1157,13 @@ else
$doleditor->Create();
print '</td></tr>';
print '<tr><td colspan="4" align="center">';
print '</table>';
print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
print ' &nbsp; ';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</td></tr>';
print '</table>';
print '</center>';
print '</form>';
print '<br>';

View File

@ -44,9 +44,9 @@ llxHeader('','EMailing',$help_url);
print_fiche_titre($langs->trans("MailingArea"));
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
//print '<table class="notopnoleftnoright" width="100%">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
// Recherche emails
@ -141,7 +141,9 @@ if (is_resource($handle))
print "</table><br>";
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
@ -198,11 +200,8 @@ else
}
print '</td></tr>';
print '</table>';
$db->close();
//print '</td></tr></table>';
print '<div></div></div>';
if ($langs->file_exists("html/spam.html",0)) {
@ -217,4 +216,5 @@ if ($langs->file_exists("html/spam.html",0)) {
llxFooter();
$db->close();
?>

File diff suppressed because it is too large Load Diff

View File

@ -456,7 +456,7 @@ class Propal extends CommonObject
* @param double $txlocaltax2 Local tax 2 rate
* @param string $desc Description
* @param double $price_base_type HT ou TTC
* @param int $info_bits Miscellanous informations
* @param int $info_bits Miscellaneous informations
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)

View File

@ -54,9 +54,10 @@ llxHeader("",$langs->trans("ProspectionArea"),$help_url);
print_fiche_titre($langs->trans("ProspectionArea"));
print '<table width="100%" class="notopnoleftnoright">';
//print '<table width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Search form
@ -199,7 +200,9 @@ if (! empty($conf->propal->enabled))
}
}
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=5;
@ -509,10 +512,11 @@ if (! empty($conf->propal->enabled))
}
*/
print '</td></tr></table>';
//print '</td></tr></table>';
print '<div></div></div>';
$db->close();
llxFooter();
$db->close();
?>

View File

@ -46,9 +46,10 @@ llxHeader();
print_fiche_titre($langs->trans("ProspectionArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
if (! empty($conf->propal->enabled))
{
@ -158,17 +159,18 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
}
}
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Actions commerciales a faire
*
*/
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
if (! empty($conf->agenda->enabled)) show_array_actions_to_do(10);
/*
* Dernieres propales ouvertes
*
*/
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
{
@ -276,11 +278,10 @@ if ($resql)
}
print '</td></tr>';
print '</table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -912,6 +912,12 @@ class Commande extends CommonOrder
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$this->lines[$i] = $line;
}

View File

@ -1214,7 +1214,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
// Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
if ($mailfile->error)
{
$mesg='<div class="error">'.$mailfile->error.'</div>';
@ -1489,7 +1489,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1);
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>';
}
print '</tr>'."\n";
@ -2444,6 +2444,26 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$formmail->substit['__ORDERREF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
$custcontact='';
$contactarr=array();
$contactarr=$object->liste_contact(-1,'external');
if (is_array($contactarr) && count($contactarr)>0) {
foreach($contactarr as $contact) {
if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) {
$contactstatic=new Contact($db);
$contactstatic->fetch($contact['id']);
$custcontact=$contactstatic->getFullName($langs,1);
}
}
if (!empty($custcontact)) {
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
}
}
// Tableau des parametres complementaires
$formmail->param['action']='send';
$formmail->param['models']='order_send';

View File

@ -55,9 +55,10 @@ llxHeader("",$langs->trans("Orders"),$help_url);
print_fiche_titre($langs->trans("OrdersArea"));
print '<table width="100%" class="notopnoleftnoright">';
//print '<table width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Search form
@ -204,7 +205,9 @@ if (! empty($conf->commande->enabled))
}
}
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=5;
@ -421,10 +424,11 @@ if (! empty($conf->commande->enabled))
}
print '</td></tr></table>';
//print '</td></tr></table>';
print '<div></div></div>';
$db->close();
llxFooter();
$db->close();
?>

View File

@ -130,7 +130,8 @@ if ($viewstatut <> '')
{
if ($viewstatut < 4 && $viewstatut > -3)
{
$sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee
if ($viewstatut == 1 && empty($conf->expedition->enabled)) $sql.= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
else $sql.= ' AND c.fk_statut = '.$viewstatut; // brouillon, validee, en cours, annulee
if ($viewstatut == 3)
{
$sql.= ' AND c.facture = 0'; // need to create invoice
@ -223,7 +224,7 @@ if ($resql)
if ($viewstatut == -2)
$title.=' - '.$langs->trans('StatusOrderToProcessShort');
if ($viewstatut == -3)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.$langs->trans("StatusOrderSent").', '.$langs->trans('StatusOrderToBill');
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
if ($ordermonth) $param.='&ordermonth='.$ordermonth;

View File

@ -1,192 +0,0 @@
<?php
/* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file /htdocs/admin/commissions.php
* \ingroup commissions
* \brief Page to setup advanced commissions module
*/
include '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/commissions/lib/commissions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
$langs->load("admin");
$langs->load("bills");
$langs->load("commissions");
if (! $user->admin) accessforbidden();
/*
* Action
*/
if (GETPOST('commissionBase'))
{
if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0)
{
$conf->global->COMMISSION_BASE = GETPOST('commissionBase');
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
}
else
{
dol_print_error($db);
}
}
if (GETPOST('productCommissionRate'))
{
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', GETPOST('productCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
{
}
else
{
dol_print_error($db);
}
}
if (GETPOST('serviceCommissionRate'))
{
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', GETPOST('serviceCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
{
}
else
{
dol_print_error($db);
}
}
if (GETPOST('AGENT_CONTACT_TYPE'))
{
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0)
{
$conf->global->AGENT_CONTACT_TYPE = GETPOST('AGENT_CONTACT_TYPE');
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
llxHeader('',$langs->trans("CommissionsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
$head = commissions_admin_prepare_head();
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
print "<br>";
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="left">'.$langs->trans("Value").'</td>'."\n";
print '<td align="left">'.$langs->trans("Details").'</td>'."\n";
print '</tr>';
$var=true;
$form = new Form($db);
print '<form method="post">';
// COMMISSION BASE (TURNOVER / MARGIN)
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("CommissionBase").'</td>';
print '<td align="left">';
print '<input type="radio" name="commissionBase" value="TURNOVER" ';
if (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "TURNOVER")
print 'checked';
print ' />';
print $langs->trans("CommissionBasedOnTurnover");
print '<br/>';
print '<input type="radio" name="commissionBase" value="MARGIN" ';
if (empty($conf->margin->enabled))
print 'disabled';
elseif (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "MARGIN")
print 'checked';
print ' />';
print $langs->trans("CommissionBasedOnMargins");
print '</td>';
print '<td>'.$langs->trans('CommissionBaseDetails');
print '<br/>';
print $langs->trans('CommissionBasedOnMarginsDetails');
print '</td>';
print '</tr>';
// PRODUCT COMMISSION RATE
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ProductCommissionRate").'</td>';
print '<td align="left">';
print '<input type="text" name="productCommissionRate" value="'.(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:'').'" size=6 />&nbsp; %';
print '</td>';
print '<td>'.$langs->trans('ProductCommissionRateDetails').'</td>';
print '</tr>';
// SERVICE COMMISSION RATE
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ServiceCommissionRate").'</td>';
print '<td align="left">';
print '<input type="text" name="serviceCommissionRate" value="'.(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:'').'" size=6 />&nbsp; %';
print '</td>';
print '<td>'.$langs->trans('ServiceCommissionRateDetails').'</td>';
print '</tr>';
// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("AgentContactType").'</td>';
print '<td align="left">';
$formcompany = new FormCompany($db);
$facture = new Facture($db);
print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE","internal","code",1);
print '</td>';
print '<td>'.$langs->trans('AgentContactTypeDetails').'</td>';
print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td align="center" colspan="3">';
print '<input type="submit" class="button" />';
print '</td>';
print '</tr>';
print '</table>';
print '</form>';
dol_fiche_end();
print '<br>';
llxFooter();
$db->close();
?>

View File

@ -1,329 +0,0 @@
<?php
/* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/commissions/index.php
* \ingroup commissions
* \brief Page des commissions par agent commercial
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (! empty($conf->margin->enabled))
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
$langs->load("companies");
$langs->load("bills");
$langs->load("products");
$langs->load("commissions");
if (! empty($conf->margin->enabled))
$langs->load("margins");
// Security check
$agentid = GETPOST('agentid','int');
$mesg = '';
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$startdate=$enddate='';
if (!empty($_POST['startdatemonth']))
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
if (!empty($_POST['enddatemonth']))
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
/*
* View
*/
$userstatic = new User($db);
$companystatic = new Societe($db);
$invoicestatic=new Facture($db);
$form = new Form($db);
llxHeader('',$langs->trans("Commissions"));
$text=$langs->trans("Commissions");
print_fiche_titre($text);
print '<form method="post" name="sel">';
print '<table class="border" width="100%">';
if ($agentid > 0) {
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
print '<td colspan="4">';
print $form->select_dolusers($agentid,'agentid',1,'',0,'','');
print '</td></tr>';
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
}
else {
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
print '<td colspan="4">';
print $form->select_dolusers('','agentid',1,'',0,'','');
print '</td></tr>';
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="u.login";
}
// Start date
print '<td>'.$langs->trans('StartDate').'</td>';
print '<td width="20%">';
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
print '</td>';
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
print '<td width="20%">';
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
print '</td>';
print '<td style="text-align: center;">';
print '<input type="submit" value="'.$langs->trans('Launch').'" />';
print '</td></tr>';
// Include unpayed invoices
print '<tr><td>'.$langs->trans("IncludeUnpayedInvoices").'</td><td colspan="4">';
print '<input id="selIncluded" type="checkbox" name="unpayed" ';
if (GETPOST('unpayed') == 'on')
print 'checked ';
print '/>';
print '</td></tr>';
// Total Margin
if ($conf->global->COMMISSION_BASE == "MARGIN") {
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
print '<span id="totalBase"></span>'; // set by jquery (see below)
print '</td></tr>';
}
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
print '<tr style="font-weight: bold"><td>'.$langs->trans("TurnoverTotal").'</td><td colspan="4">';
print '<span id="totalBase"></span>'; // set by jquery (see below)
print '</td></tr>';
}
// Total Commission
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalCommission").'</td><td colspan="4">';
print '<span id="totalCommission"></span>'; // set by jquery (see below)
print '</td></tr>';
print "</table>";
print '</form>';
$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
$sql.= " u.login,";
if ($conf->global->COMMISSION_BASE == "MARGIN") {
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ;
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase" ;
}
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ;
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase" ;
}
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND sc.fk_soc = f.fk_soc";
if (! empty($conf->global->AGENT_CONTACT_TYPE))
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
else
$sql .= " AND sc.fk_user = u.rowid";
if (GETPOST('unpayed') == 'on')
$sql.= " AND f.fk_statut > 0";
else
$sql.= " AND f.fk_statut > 1";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND d.fk_facture = f.rowid";
if ($agentid > 0) {
if (! empty($conf->global->AGENT_CONTACT_TYPE))
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))";
else
$sql .= " AND sc.fk_user = ".$agentid;
}
if (!empty($startdate))
$sql.= " AND f.datef >= '".$startdate."'";
if (!empty($enddate))
$sql.= " AND f.datef <= '".$enddate."'";
if ($conf->global->COMMISSION_BASE == "MARGIN")
$sql .= " AND d.buy_price_ht IS NOT NULL";
if (($conf->global->COMMISSION_BASE == "MARGIN") && isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql .= " AND d.buy_price_ht <> 0";
if ($agentid > 0)
$sql.= " GROUP BY s.rowid";
else
$sql.= " GROUP BY u.rowid";
$sql.= " ORDER BY $sortfield $sortorder ";
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
print '<br>';
print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
if ($agentid > 0)
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&amp;agentid=".$agentid,'align="center"',$sortfield,$sortorder);
else
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&amp;agentid=".$agentid,'align="center"',$sortfield,$sortorder);
// product commission
if ($conf->global->COMMISSION_BASE == "MARGIN")
print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
print_liste_field_titre($langs->trans("ProductTurnover"),$_SERVER["PHP_SELF"],"productBase","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
// service commission
if ($conf->global->COMMISSION_BASE == "MARGIN")
print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
print_liste_field_titre($langs->trans("ServiceTurnover"),$_SERVER["PHP_SELF"],"serviceBase","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
// total commission
print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&amp;agentid=".$agentid,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$cumul_base_produit = 0;
$cumul_base_service = 0;
$cumul_commission_produit = 0;
$cumul_commission_service = 0;
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
if ($num > 0)
{
$var=True;
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
if ($agentid > 0) {
$companystatic->id=$objp->socid;
$companystatic->nom=$objp->nom;
$companystatic->client=$objp->client;
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
}
else {
$userstatic->id=$objp->agent;
$userstatic->login=$objp->login;
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
}
// product commission
$productCommissionRate=(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0);
$productBase=(! empty($objp->productBase)?$objp->productBase:0);
$productCommission = (! empty($productBase)?($productCommissionRate * $productBase / 100):0);
print "<td align=\"right\">".price($productBase)."</td>\n";
print "<td align=\"right\">".price($productCommissionRate)."</td>\n";
print "<td align=\"right\">".price($productCommission)."</td>\n";
// service commission
$serviceCommissionRate=(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0);
$serviceBase=(! empty($objp->serviceBase)?$objp->serviceBase:0);
$serviceCommission = (! empty($serviceBase)?($serviceCommissionRate * $serviceBase / 100):0);
print "<td align=\"right\">".price($serviceBase)."</td>\n";
print "<td align=\"right\">".price($serviceCommissionRate)."</td>\n";
print "<td align=\"right\">".price($serviceCommission)."</td>\n";
// total commission
print "<td align=\"right\">".price($productCommission + $serviceCommission)."</td>\n";
print "</tr>\n";
$i++;
$cumul_base_produit += round($productBase, $rounding);
$cumul_base_service += round($serviceBase, $rounding);
$cumul_commission_produit += round($productCommission, $rounding);
$cumul_commission_service += round($serviceCommission, $rounding);
}
}
// affichage totaux commission
$var=!$var;
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
print '<td>';
print $langs->trans('Total');
print "</td>";
// product commission
print "<td align=\"right\">".price($cumul_base_produit)."</td>\n";
print "<td align=\"right\">".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."</td>\n";
print "<td align=\"right\">".price($cumul_commission_produit)."</td>\n";
// service commission
print "<td align=\"right\">".price($cumul_base_service)."</td>\n";
print "<td align=\"right\">".price((! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0))."</td>\n";
print "<td align=\"right\">".price($cumul_commission_service)."</td>\n";
// total commission
print "<td align=\"right\">".price($cumul_commission_produit + $cumul_commission_service)."</td>\n";
print "</tr>\n";
print "</td>";
print "</table>";
}
else
{
dol_print_error($db);
}
$db->free($result);
llxFooter();
$db->close();
?>
<script type="text/javascript">
$(document).ready(function() {
$("#agentid").change(function() {
$("div.fiche form").submit();
});
$("#selIncluded").change(function() {
$("div.fiche form").submit();
});
$("#totalBase").html("<?php echo price($cumul_base_produit + $cumul_base_service); ?>");
$("#totalCommission").html("<?php echo price($cumul_commission_produit + $cumul_commission_service); ?>");
});
</script>

View File

@ -1,52 +0,0 @@
<?php
/* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file /htdocs/commissions/lib/commissions.lib.php
* \ingroup commissions
* \brief Library for common commissions functions
*/
/**
* Define head array for tabs of marges tools setup pages
*
* @return Array of head
*/
function commissions_admin_prepare_head()
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/commissions/admin/commissions.php';
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'parameters';
$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,'',$head,$h,'commissionsadmin');
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin','remove');
return $head;
}
?>

View File

@ -84,7 +84,7 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
if (! $error)
{
header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro?account='.$id); // To avoid to submit twice and allow back
header('Location: '.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$id); // To avoid to submit twice and allow back
exit;
}
}

View File

@ -30,31 +30,25 @@
*/
require '../main.inc.php';
require DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
require DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
require DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
require DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->commande->enabled)) {
require DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
}
if (! empty($conf->projet->enabled)) {
require DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
}
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
$langs->load('bills');
$langs->load('companies');
$langs->load('products');
$langs->load('main');
if (! empty($conf->margin->enabled))
$langs->load('margins');
if (! empty($conf->margin->enabled)) $langs->load('margins');
$sall=trim(GETPOST('sall'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
@ -302,6 +296,14 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
$result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setrevenuestamp' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->revenuestamp=GETPOST('revenuestamp');
$result=$object->update($user);
$object->update_price(1);
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setremisepercent' && $user->rights->facture->creer)
{
$object->fetch($id);
@ -369,22 +371,22 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
$object->fetch_thirdparty();
// Check parameters
// Check for mandatory prof id
for ($i = 1; $i < 5; $i++)
{
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_INVOICE_MANDATORY';
$idprof='idprof'.$i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
{
if (! $error) $langs->load("errors");
$error++;
setEventMessage($langs->trans('ErrorProdIdIsMandatory',$langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)),'errors');
}
}
}
//Check for warehouse
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
{
@ -395,7 +397,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
$action='';
}
}
if (! $error)
{
$result = $object->validate($user,'',$idwarehouse);
@ -617,7 +619,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$db->begin();
$error=0;
// Get extra fields
foreach($_POST as $key => $value)
{
@ -1630,7 +1632,7 @@ else if ($action == 'builddoc') // En get ou en post
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model'));
if (GETPOST('fk_bank')) $object->fk_bank=GETPOST('fk_bank');
// Define output language
$outputlangs = $langs;
$newlang='';
@ -1777,14 +1779,15 @@ if ($action == 'update_extras')
* View
*/
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
$form = new Form($db);
$htmlother = new FormOther($db);
$formother=new FormOther($db);
$formfile = new FormFile($db);
$bankaccountstatic=new Account($db);
$now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
/*********************************************************************
*
@ -1924,7 +1927,7 @@ if ($action == 'create')
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1);
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>';
}
print '</tr>'."\n";
@ -2109,11 +2112,19 @@ if ($action == 'create')
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
// Show separator only
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
}
@ -2272,10 +2283,10 @@ else if ($id > 0 || ! empty($ref))
*/
$result=$object->fetch($id,$ref);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture');
if ($result > 0)
{
if ($user->societe_id>0 && $user->societe_id!=$object->socid) accessforbidden('',0);
@ -2284,11 +2295,12 @@ else if ($id > 0 || ! empty($ref))
$soc = new Societe($db);
$soc->fetch($object->socid);
$selleruserevenustamp=$mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits." selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
@ -2752,10 +2764,9 @@ else if ($id > 0 || ! empty($ref))
$nbrows=8; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++;
//Local taxes
if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++;
if ($selleruserevenustamp) $nbrows++;
print '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
@ -3026,29 +3037,51 @@ else if ($id > 0 || ! empty($ref))
// Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="3" nowrap>'.price($object->total_tva,1,'',1,-1,-1,$conf->currency).'</td></tr>';
print '</tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
if ($mysoc->localtax1_assuj=="1" && $mysoc->useLocalTax(1)) //Localtax1 (example RE)
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax1,1,'',1,-1,-1,$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
if ($mysoc->localtax2_assuj=="1" && $mysoc->useLocalTax(2)) //Localtax2 (example IRPF)
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).'</td></tr>';
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Revenue stamp
if ($selleruserevenustamp) // Test company use revenue stamp
{
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('RevenueStamp');
print '</td>';
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&amp;facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3" align="right">';
if ($action == 'editrevenuestamp')
{
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setrevenuestamp">';
print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code);
//print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
else
{
print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency);
}
print '</td></tr>';
}
// Total with tax
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="3" nowrap>'.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).'</td></tr>';
// Statut
print '<tr><td>'.$langs->trans('Status').'</td>';
@ -3084,14 +3117,14 @@ else if ($id > 0 || ! empty($ref))
print '</td>';
print '</tr>';
}
// Other attributes
$res=$object->fetch_optionals($object->id,$extralabels);
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
if ($action == 'edit_extras')
{
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
@ -3099,38 +3132,44 @@ else if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
}
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="5">';
if ($action == 'edit_extras' && $user->rights->propal->creer)
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showInputField($key,$value);
print $extrafields->showSeparator($key);
}
else
{
print $extrafields->showOutputField($key,$value);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="5">';
if ($action == 'edit_extras' && $user->rights->facture->creer)
{
print $extrafields->showInputField($key,$value);
}
else
{
print $extrafields->showOutputField($key,$value);
}
print '</td></tr>'."\n";
}
print '</td></tr>'."\n";
}
if(count($extrafields->attribute_label) > 0) {
if ($action == 'edit_extras' && $user->rights->propal->creer)
if ($action == 'edit_extras' && $user->rights->facture->creer)
{
print '<tr><td></td><td colspan="5">';
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
print '</td></tr>';
}
else {
if ($object->statut == 0 && $user->rights->propal->creer)
if ($object->statut == 0 && $user->rights->facture->creer)
{
print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
}
@ -3533,6 +3572,31 @@ else if ($id > 0 || ! empty($ref))
$formmail->substit['__FACREF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
//Find the good contact adress
$custcontact='';
$contactarr=array();
$contactarr=$object->liste_contact(-1,'external');
if (is_array($contactarr) && count($contactarr)>0) {
foreach($contactarr as $contact) {
if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic=new Contact($db);
$contactstatic->fetch($contact['id']);
$custcontact=$contactstatic->getFullName($langs,1);
}
}
if (!empty($custcontact)) {
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
}
}
// Tableau des parametres complementaires du post
$formmail->param['action']=$action;
$formmail->param['models']=$modelmail;

View File

@ -336,7 +336,6 @@ class FactureRec extends Facture
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
$line->export_compta = $objp->fk_export_compta;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->rang = $objp->rang;
$line->special_code = $objp->special_code;

View File

@ -75,6 +75,7 @@ class Facture extends CommonInvoice
var $total_ht=0;
var $total_tva=0;
var $total_ttc=0;
var $revenuestamp;
var $note; // deprecated
var $note_private;
var $note_public;
@ -455,7 +456,7 @@ class Facture extends CommonInvoice
}
}
else if ($reshook < 0) $error++;
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
@ -795,7 +796,8 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df';
$sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.datec as datec';
@ -841,6 +843,7 @@ class Facture extends CommonInvoice
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc;
$this->revenuestamp = $obj->revenuestamp;
$this->paye = $obj->paye;
$this->close_code = $obj->close_code;
$this->close_note = $obj->close_note;
@ -866,7 +869,7 @@ class Facture extends CommonInvoice
$this->extraparams = (array) json_decode($obj->extraparams, true);
if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
@ -925,7 +928,7 @@ class Facture extends CommonInvoice
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
@ -970,7 +973,6 @@ class Facture extends CommonInvoice
$line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
$line->export_compta = $objp->fk_export_compta;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
@ -1051,6 +1053,7 @@ class Facture extends CommonInvoice
$sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").",";
$sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").",";
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
$sql.= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '')?$this->revenuestamp:"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
@ -1860,7 +1863,7 @@ class Facture extends CommonInvoice
}
}
}
if ($error == 0)
{
$old_statut=$this->statut;
@ -1870,8 +1873,8 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_UNVALIDATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++;
if ($result < 0) {
$error++;
$this->errors=$interface->errors;
$this->statut=$old_statut;
$this->brouillon=0;
@ -1881,7 +1884,7 @@ class Facture extends CommonInvoice
$this->db->rollback();
return -1;
}
if ($error == 0)
{
$this->db->commit();
@ -2083,7 +2086,7 @@ class Facture extends CommonInvoice
* @param double $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate
* @param string $price_base_type HT or TTC
* @param int $info_bits Miscellanous informations
* @param int $info_bits Miscellaneous informations
* @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
@ -3196,7 +3199,6 @@ class FactureLigne
var $total_ttc;
var $fk_code_ventilation = 0;
var $fk_export_compta = 0;
var $date_start;
var $date_end;
@ -3237,7 +3239,7 @@ class FactureLigne
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
$sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,';
$sql.= ' fd.fk_code_ventilation,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
@ -3271,7 +3273,6 @@ class FactureLigne
$this->total_localtax2 = $objp->total_localtax2;
$this->total_ttc = $objp->total_ttc;
$this->fk_code_ventilation = $objp->fk_code_ventilation;
$this->fk_export_compta = $objp->fk_export_compta;
$this->rang = $objp->rang;
$this->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
@ -3338,7 +3339,7 @@ class FactureLigne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql.= ' date_start, date_end, fk_code_ventilation, fk_export_compta, ';
$sql.= ' date_start, date_end, fk_code_ventilation, ';
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2)';
$sql.= " VALUES (".$this->fk_facture.",";
@ -3357,7 +3358,6 @@ class FactureLigne
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").",";
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").",";
$sql.= ' '.$this->fk_code_ventilation.',';
$sql.= ' '.$this->fk_export_compta.',';
$sql.= ' '.$this->rang.',';
$sql.= ' '.$this->special_code.',';
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';

View File

@ -197,9 +197,9 @@ if (! $sortorder) $sortorder="ASC";
$limit = $conf->liste_limit;
$sql = "SELECT s.nom, s.rowid as socid";
$sql.= ", f.facnumber, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc";
$sql.= ", f.rowid as facid, f.facnumber, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp";
$sql.= ", f.datef as df, f.date_lim_reglement as datelimite";
$sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut, f.type";
$sql.= ", f.paye as paye, f.fk_statut, f.type";
$sql.= ", sum(pf.amount) as am";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -226,7 +226,7 @@ if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$search_ref."%'";
if ($search_societe) $sql .= " AND s.nom LIKE '%".$search_societe."%'";
if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_ref') . "%'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
$sql.= " GROUP BY f.facnumber,f.increment,f.total,f.total_ttc,f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut, f.type,s.nom, s.rowid";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " ORDER BY ";
@ -280,10 +280,10 @@ if ($resql)
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Remain"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Merge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print "</tr>\n";
@ -296,11 +296,11 @@ if ($resql)
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="10" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="8" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
print '<td class="liste_titre" colspan="3" align="right">';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="8" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
print '<td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '<td class="liste_titre" align="center">';
@ -341,7 +341,7 @@ if ($resql)
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Ref
print '<td width="100" class="nobordernopadding" nowrap="nowrap">';
print '<td class="nobordernopadding" nowrap="nowrap">';
print $facturestatic->getNomUrl(1);
print '</td>';
@ -366,13 +366,25 @@ if ($resql)
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,28).'</a></td>';
print '<td align="right">'.price($objp->total_ht).' '.$langs->getCurrencySymbol($conf->currency).'</td>';
print '<td align="right">'.price($objp->total_tva).' '.$langs->getCurrencySymbol($conf->currency).'</td>';
print '<td align="right">'.price($objp->total_ttc).' '.$langs->getCurrencySymbol($conf->currency).'</td>';
print '<td align="right">'.(! empty($objp->am)?price($objp->am).' '.$langs->getCurrencySymbol($conf->currency):'&nbsp;').'</td>';
print '<td align="right">'.(! empty($objp->am)?price($objp->total_ttc-$objp->am).' '.$langs->getCurrencySymbol($conf->currency):'&nbsp;').'</td>';
print '<td align="right">'.price($objp->total_ht).'</td>';
print '<td align="right">'.price($objp->total_tva);
$tx1=price2num($objp->localtax1);
$tx2=price2num($objp->localtax2);
$revenuestamp=price2num($objp->revenuestamp);
if (! empty($tx1) || ! empty($tx2) || ! empty($revenuestamp)) print '+'.price($tx1 + $tx2 + $revenuestamp);
print '</td>';
print '<td align="right">'.price($objp->total_ttc).'</td>';
print '<td align="right">';
$cn=$facturestatic->getSumCreditNotesUsed();
if (! empty($objp->am)) print price($objp->am);
if (! empty($objp->am) && ! empty($cn)) print '+';
if (! empty($cn)) print price($cn);
print '</td>';
// Remain to receive
//print '<td align="right">'.((! empty($objp->am) || ! empty($cn))?price($objp->total_ttc-$objp->am-$cn):'&nbsp;').'</td>';
// Affiche statut de la facture
// Status of invoice
print '<td align="right" nowrap="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
print '</td>';
@ -387,19 +399,19 @@ if ($resql)
print "</tr>\n";
$total_ht+=$objp->total_ht;
$total_tva+=$objp->total_tva;
$total_tva+=($objp->total_tva + $tx1 + $tx2 + $revenuestamp);
$total_ttc+=$objp->total_ttc;
$total_paid+=$objp->am;
$total_paid+=$objp->am + $cn;
$i++;
}
print '<tr class="liste_total">';
print '<td colspan="4" align="left">'.$langs->trans("Total").'</td>';
print '<td align="right"><b>'.price($total_ht).' '.$langs->getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_tva).' '.$langs->getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_ttc).' '.$langs->getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_paid).' '.$langs->getCurrencySymbol($conf->currency).'</b></td>';
print '<td align="right"><b>'.price($total_ht).'</b></td>';
print '<td align="right"><b>'.price($total_tva).'</b></td>';
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
print '<td align="right"><b>'.price($total_paid).'</b></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';

View File

@ -104,10 +104,9 @@ llxHeader("",$langs->trans("AccountancyTreasuryArea"));
print_fiche_titre($langs->trans("AccountancyTreasuryArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr>';
print '<td valign="top" width="30%" class="notopnoleft">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
$max=3;
@ -323,8 +322,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
}
}
print '</td>';
print '<td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Last modified customer invoices
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
@ -1031,12 +1032,10 @@ if ($resql)
print "</table><br>";
}
print '</td></tr>';
print '</table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -46,9 +46,9 @@ llxHeader('',$langs->trans("ChequesArea"));
print_fiche_titre($langs->trans("ChequesArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -86,7 +86,8 @@ else
}
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref";
@ -143,10 +144,11 @@ else
dol_print_error($db);
}
print "</td></tr>\n";
print "</table>\n";
$db->close();
//print "</td></tr></table>\n";
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -61,9 +61,10 @@ if (prelevement_check_config() < 0)
print_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
$thirdpartystatic=new Societe($db);
$invoicestatic=new Facture($db);
@ -85,8 +86,9 @@ print '<td align="right">';
print price($bprev->SommeAPrelever());
print '</td></tr></table><br>';
print '</td><td valign="top" width="70%">';
//print '</td><td valign="top" width="70%">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
@ -218,7 +220,10 @@ else
}
print '</td></tr></table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -43,6 +43,8 @@ if ($user->societe_id > 0)
* View
*/
$userstatic=new User($db);
llxHeader();
if ($socid > 0)
@ -135,7 +137,7 @@ if ($socid > 0)
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td align=\"center\">".dol_print_date($fac->date)."</td>\n";
print "<td align=\"center\">".dol_print_date($fac->date,'day')."</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id.'">'.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref."</a></td>\n";
print '<td aling="left">'.$fac->getLibStatut(2,$totalpaye).'</td>';
@ -146,8 +148,12 @@ if ($socid > 0)
print '<td align="right">&nbsp;</td>';
print '<td align="right">'.price($solde)."</td>\n";
// Auteur
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objf->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objf->login.'</a></td>';
// Author
$userstatic->id=$objf->userid;
$userstatic->login=$objf->login;
print '<td nowrap="nowrap" align="right">';
print $userstatic->getLoginUrl(1);
print '</td>';
print "</tr>\n";
@ -172,7 +178,7 @@ if ($socid > 0)
$objp = $db->fetch_object($resqlp);
//$var=!$var;
print "<tr $bc[$var]>";
print '<td align="center">'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print '<td>';
print '&nbsp; &nbsp; &nbsp; '; // Decalage
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
@ -182,8 +188,12 @@ if ($socid > 0)
$solde = $solde - $objp->amount;
print '<td align="right">'.price($solde)."</td>\n";
// Auteur
print '<td nowrap="nowrap" width="50"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.'</a></td>';
// Author
$userstatic->id=$objp->userid;
$userstatic->login=$objp->login;
print '<td nowrap="nowrap" align="right">';
print $userstatic->getLoginUrl(1);
print '</td>';
print '</tr>';
@ -214,5 +224,4 @@ else
llxFooter();
$db->close();
?>

View File

@ -555,7 +555,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
if (isset($totentrees[$annee]) || isset($totsorties[$annee]))
{
$in=(isset($totentrees[$annee])?price2num($totentrees[$annee], 'MT'):0);
$out=(isset($totsorties[$annee])?price2num($totsorties[$annee],' MT'):0);
$out=(isset($totsorties[$annee])?price2num($totsorties[$annee],'MT'):0);
print price($in-$out).'</td>';
// print '<td>&nbsp;</td>';
}

View File

@ -39,7 +39,7 @@ print '<tr><td valign="top" width="30%">';
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
{
@ -50,7 +50,7 @@ if ($result)
}
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiement";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
@ -62,7 +62,7 @@ if ($result)
}
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
{
@ -73,7 +73,7 @@ if ($result)
}
/*$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)

View File

@ -32,14 +32,14 @@ llxHeader('','Compta - Ventilation');
print_fiche_titre("Ventilation Comptable");
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE fd.fk_code_ventilation = 0";
$sql.= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;";
$sql.= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1";
$result = $db->query($sql);
if ($result)
@ -56,14 +56,17 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Lines").'</tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td><td align="right">'.$langs->trans("Nb").'</td></tr>';
$var=!$var;
print "<tr $bc[$var]>".'<td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
print "<tr ".$bc[$var].">".'<td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
$var=!$var;
print "</table>\n";
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>Type</td><td align="center">'.$langs->trans("NbOfLines").'</td><td align="center">'.$langs->trans("AccountNumber").'</td><td align="center">'.$langs->trans("TransID").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td><td align="center">'.$langs->trans("NbOfLines").'</td><td align="center">'.$langs->trans("AccountNumber").'</td><td align="center">'.$langs->trans("TransID").'</td></tr>';
$sql = "SELECT count(*), ccg.intitule, ccg.rowid,ccg.numero FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " ,".MAIN_DB_PREFIX."compta_compte_generaux as ccg";
@ -90,8 +93,11 @@ if ($resql)
}
print "</table>\n";
print '</td></tr></table>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();
$db->close();
?>

View File

@ -48,7 +48,7 @@ if ($page < 0) $page = 0;
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total_ttc as price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
@ -72,7 +72,7 @@ if ($result)
$num_lignes = $db->num_rows($result);
$i = 0;
print_barre_liste("Lignes de facture ventil<69>es",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
print_barre_liste($langs->trans("InvoiceDispatched"),$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
print '<form method="GET" action="lignes.php">';
print '<table class="noborder" width="100%">';
@ -136,7 +136,7 @@ else
print "</table></form>";
$db->close();
llxFooter();
$db->close();
?>

View File

@ -54,7 +54,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.rowid, l.fk_code_ventilation,";
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."facturedet as l";

View File

@ -521,11 +521,18 @@ else
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:''));
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
}
@ -736,11 +743,18 @@ else
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
}
}
}
@ -948,9 +962,16 @@ else
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
}
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -80,10 +81,6 @@ else if ($type == "o")
$titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')';
$urlfiche="";
}
if ($view == 'phone') { $text=" (Vue Telephones)"; }
if ($view == 'mail') { $text=" (Vue EMail)"; }
if ($view == 'recent') { $text=" (Recents)"; }
if (! empty($text)) $titre.= " $text";
if (GETPOST('button_removefilter'))
{
@ -200,7 +197,11 @@ else if ($type == "p") // filtre sur type
}
if ($sall)
{
$sql .= " AND (p.lastname LIKE '%".$db->escape($sall)."%' OR p.firstname LIKE '%".$db->escape($sall)."%' OR p.email LIKE '%".$db->escape($sall)."%')";
// For natural search
$scrit = explode(' ', $sall);
foreach ($scrit as $crit) {
$sql .= " AND (p.lastname LIKE '%".$db->escape($crit)."%' OR p.firstname LIKE '%".$db->escape($crit)."%' OR p.email LIKE '%".$db->escape($crit)."%')";
}
}
if (! empty($socid))
{
@ -260,17 +261,10 @@ if ($result)
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
if ($view == 'phone')
{
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Mobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
}
else
{
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Mobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
print '<td class="liste_titre">&nbsp;</td>';
@ -293,27 +287,18 @@ if ($result)
print '<input class="flat" type="text" name="search_societe" size="9" value="'.$search_societe.'">';
print '</td>';
}
if ($view == 'phone')
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonepro" size="9" value="'.$search_phonepro.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonemob" size="9" value="'.$search_phonemob.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_fax" size="9" value="'.$search_fax.'">';
print '</td>';
}
else
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phone" size="9" value="'.$search_phone.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_email" size="9" value="'.$search_email.'">';
print '</td>';
}
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.$search_phonepro.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.$search_phonemob.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_fax" size="8" value="'.$search_fax.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_email" size="8" value="'.$search_email.'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
@ -365,22 +350,14 @@ if ($result)
print '</td>';
}
if ($view == 'phone')
{
// Phone
print '<td>'.dol_print_phone($obj->phone,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// Phone mobile
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// Fax
print '<td>'.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
}
else
{
// Phone
print '<td>'.dol_print_phone($obj->phone,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// EMail
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
}
// Phone
print '<td>'.dol_print_phone($obj->phone,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// Phone mobile
print '<td>'.dol_print_phone($obj->phone_mobile,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// Fax
print '<td>'.dol_print_phone($obj->fax,$obj->country_code,$obj->cidp,$obj->socid,'AC_TEL').'</td>';
// EMail
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
// Date
print '<td align="center">'.dol_print_date($db->jdate($obj->tms),"day").'</td>';

View File

@ -649,14 +649,16 @@ class Contrat extends CommonObject
// Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
$sql.= " ref, entity)";
$sql.= " ref, entity, note, note_public)";
$sql.= " VALUES (".$this->db->idate($now).",".$this->socid.",".$user->id;
$sql.= ",".$this->db->idate($this->date_contrat);
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
$sql.= ",".($this->fk_projet>0?$this->fk_projet:"NULL");
$sql.= ",".($this->fk_project>0?$this->fk_project:"NULL");
$sql.= ", ".(dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
$sql.= ", ".$conf->entity;
$sql.= ", ".(!empty($this->note)?("'".$this->db->escape($this->note)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ")";
$resql=$this->db->query($sql);
if ($resql)
@ -694,6 +696,12 @@ class Contrat extends CommonObject
if (! $error)
{
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
$this->db->commit();
return $this->id;
}

View File

@ -176,27 +176,158 @@ if ($action == 'add' && $user->rights->contrat->creer)
if (! $error)
{
$object->socid = $socid;
$object->socid = $socid;
$object->date_contrat = $datecontrat;
$object->commercial_suivi_id = GETPOST('commercial_suivi_id','int');
$object->commercial_signature_id = GETPOST('commercial_signature_id','int');
$object->note = GETPOST('note','alpha');
$object->note_public = GETPOST('note_public','alpha');
$object->fk_project = GETPOST('projectid','int');
$object->remise_percent = GETPOST('remise_percent','alpha');
$object->ref = GETPOST('ref','alpha');
$result = $object->create($user,$langs,$conf);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else {
$mesg='<div class="error">'.$object->error.'</div>';
}
$action='create';
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}
// For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; }
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
$object->origin = $_POST['origin'];
$object->origin_id = $_POST['originid'];
// Possibility to add external linked objects with hooks
$object->linked_objects[$object->origin] = $object->origin_id;
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects']))
{
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
}
$id = $object->create($user);
if ($id < 0) {
$mesg='<div class="error">'.$object->error.'</div>';
}
if ($id > 0)
{
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
$result=$srcobject->fetch($object->origin_id);
if ($result > 0)
{
$srcobject->fetch_thirdparty();
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
if ($product_type == 1) { //only services
// service prédéfini
if ($lines[$i]->fk_product > 0)
{
$product_static = new Product($db);
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$prod = new Product($db, $lines[$i]->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$srcobject->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
}
else
{
$label = $lines[$i]->product_label;
}
if ($conf->global->PRODUIT_DESC_IN_FORM)
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
}
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start =0,
$date_end =0,
'HT',
0,
$lines[$i]->info_bits,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht
);
if ($result < 0)
{
$error++;
break;
}
}
}
}
else
{
$mesg=$srcobject->error;
$error++;
}
}
else
{
$mesg=$object->error;
$error++;
}
}
else
{
$result = $object->create($user,$langs,$conf);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
else {
$mesg='<div class="error">'.$object->error.'</div>';
}
$action='create';
}
}
}
@ -622,6 +753,51 @@ if ($action == 'create')
$soc = new Societe($db);
if ($socid>0) $soc->fetch($socid);
if (GETPOST('origin') && GETPOST('originid'))
{
// Parse element/subelement (ex: project_task)
$element = $subelement = GETPOST('origin');
if (preg_match('/^([^_]+)_([^_]+)/i',GETPOST('origin'),$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}
if ($element == 'project')
{
$projectid=GETPOST('originid');
}
else
{
// For compatibility
if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; }
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
$soc = $objectsrc->client;
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
}
}
else {
$projectid = GETPOST('projectid','int');
$note_private = GETPOST("note");
$note_public = GETPOST("note_public");
}
$object->date_contrat = dol_now();
$numct = $object->getNextNumRef($soc);
@ -651,7 +827,7 @@ if ($action == 'create')
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1',1);
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print '</td>';
}
print '</tr>'."\n";
@ -687,18 +863,18 @@ if ($action == 'create')
if (! empty($conf->projet->enabled))
{
print '<tr><td>'.$langs->trans("Project").'</td><td>';
select_projects($soc->id,GETPOST("projectid"),"projectid");
select_projects($soc->id,$projectid,"projectid");
print "</td></tr>";
}
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note_public', GETPOST('note_public'), '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
$doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
print $doleditor->Create(1);
/*
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print GETPOST("note_public");
print $note_public;
print '</textarea></td></tr>';
*/
@ -706,11 +882,11 @@ if ($action == 'create')
{
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td valign="top">';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note', GETPOST('note'), '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
$doleditor=new DolEditor('note', $note_private, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70);
print $doleditor->Create(1);
/*
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print GETPOST("note");
print $note_private;
print '</textarea>';*/
print '</td></tr>';
}
@ -721,6 +897,12 @@ if ($action == 'create')
print "</table>\n";
if (is_object($objectsrc))
{
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
}
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
print "</form>\n";

View File

@ -66,9 +66,10 @@ llxHeader();
print_fiche_titre($langs->trans("ContractsArea"));
print '<table class="notopnoleftnoright" width="100%">';
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td width="30%" valign="top" class="notopnoleft">';
// Search contract
if (! empty($conf->contrat->enabled))
@ -284,7 +285,9 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
}
}
print '</td><td width="70%" valign="top" class="notopnoleftnoright">';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Last modified contracts
@ -599,9 +602,9 @@ else
dol_print_error($db);
}
print '</td></tr></table>';
print '<br>';
//print '</td></tr></table>';
print '<div></div></div>';
llxFooter();

View File

@ -241,6 +241,16 @@ if ($type == 'directory')
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
}
else if ($module == 'project') // Auto area for projects
{
$upload_dir = $conf->projet->dir_output;
$filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$param.='&module='.$module;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
}
else // Manual area
{
$relativepath=$ecmdir->getRelativePath();

View File

@ -62,7 +62,7 @@ class CMailFile
var $css;
//! Defined css style for body background
var $styleCSS;
//! Defined bacckground directly in body tag
//! Defined background directly in body tag
var $bodyCSS;
// Image
@ -106,9 +106,9 @@ class CMailFile
// We define end of line (RFC 821).
$this->eol="\r\n";
// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
$this->eol2="\r\n";
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
$this->eol="\n";
$this->eol2="\n";
@ -256,7 +256,7 @@ class CMailFile
if (!empty($css))
{
$this->css = $css;
$this->styleCSS = $this->buildCSS();
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
@ -308,7 +308,7 @@ class CMailFile
if (!empty($css))
{
$this->css = $css;
$this->styleCSS = $this->buildCSS();
$this->buildCSS();
}
$msg = $this->html;
$msg = $this->checkIfHTML($msg);
@ -551,7 +551,7 @@ class CMailFile
/**
* Write content of a SMTP request into a dump file (mode = all)
* Used for debugging.
* Note that to see full SMTP protocol, you can use tcpdump -w /tmp/smtp -s 2000 port 25"
* Note that to see full SMTP protocol, you can use tcpdump -w /tmp/smtp -s 2000 port 25"
*
* @return void
*/
@ -572,7 +572,7 @@ class CMailFile
}
elseif ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
{
fputs($fp, $this->smtps->log);
fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on
}
fclose($fp);
@ -624,7 +624,7 @@ class CMailFile
if ($this->css['bgcolor'])
{
$this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS.= ' BGCOLOR="'.$this->css['bgcolor'].'"';
$this->bodyCSS.= ' bgcolor="'.$this->css['bgcolor'].'"';
}
if ($this->css['bgimage'])
{
@ -751,7 +751,7 @@ class CMailFile
{
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
}
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
$strContent = rtrim(wordwrap($strContent));

View File

@ -185,11 +185,11 @@ abstract class CommonDocGenerator
}
$array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key]));
}
}
}
return $array_thirdparty;
}
/**
* Define array with couple substitution key => substitution value
*
@ -201,7 +201,7 @@ abstract class CommonDocGenerator
function get_substitutionarray_propal($object,$outputlangs,$array_key='object')
{
global $conf;
$array_propal=array(
$array_key.'_id'=>$object->id,
$array_key.'_ref'=>$object->ref,
@ -224,14 +224,14 @@ abstract class CommonDocGenerator
$array_key.'_note_private'=>$object->note,
$array_key.'_note'=>$object->note_public,
);
// Add vat by rates
foreach ($object->lines as $line)
{
if (empty($array_propal[$array_key.'_total_vat_'.$line->tva_tx])) $array_propal[$array_key.'_total_vat_'.$line->tva_tx]=0;
$array_propal[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
}
// Retrieve extrafields
if(is_array($object->array_options) && count($object->array_options))
{
@ -240,12 +240,12 @@ abstract class CommonDocGenerator
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('propal',true);
$object->fetch_optionals($object->id,$extralabels);
$array_propal = $this->fill_substitutionarray_with_extrafields($object,$array_propal,$extrafields,$array_key,$outputlangs);
}
return $array_propal;
}
/**
* Define array with couple substitution key => substitution value
@ -257,7 +257,7 @@ abstract class CommonDocGenerator
function get_substitutionarray_propal_lines($line,$outputlangs)
{
global $conf;
return array(
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
'line_product_ref'=>$line->product_ref,
@ -274,7 +274,7 @@ abstract class CommonDocGenerator
'line_date_end'=>$line->date_end
);
}
/**
* Fill array with couple extrafield key => extrafield value
*
@ -309,14 +309,14 @@ abstract class CommonDocGenerator
{
$object->array_options['options_'.$key] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):'');
}
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
}
return $array_to_fill;
}
/**
* Rect pdf
*

View File

@ -1012,13 +1012,13 @@ abstract class CommonObject
/**
* Save a new position (field rang) for details lines.
* You can choose to set position for lines with already a position or lines without any position defined.
* Call this function only for table that contains a field fk_parent_line.
*
* @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
* @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines.
* @param string $rowidorder ASC or DESC
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_order($renum=false, $rowidorder='ASC')
function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true)
{
if (! $this->table_element_line)
{
@ -1055,7 +1055,8 @@ abstract class CommonObject
// We first search all lines that are parent lines (for multilevel details lines)
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND fk_parent_line IS NULL';
if ($fk_parent_line)
$sql.= ' AND fk_parent_line IS NULL';
$sql.= ' ORDER BY rang ASC, rowid '.$rowidorder;
dol_syslog(get_class($this)."::line_order search all parent lines sql=".$sql, LOG_DEBUG);
@ -1130,12 +1131,13 @@ abstract class CommonObject
/**
* Update a line to have a lower rank
*
* @param int $rowid Id of line
* @param int $rowid Id of line
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_up($rowid)
function line_up($rowid, $fk_parent_line=true)
{
$this->line_order();
$this->line_order(false, 'ASC', $fk_parent_line);
// Get rang of line
$rang = $this->getRangOfLine($rowid);
@ -1147,12 +1149,13 @@ abstract class CommonObject
/**
* Update a line to have a higher rank
*
* @param int $rowid Id of line
* @param int $rowid Id of line
* @param boolean $fk_parent_line Table with fk_parent_line field or not
* @return void
*/
function line_down($rowid)
function line_down($rowid, $fk_parent_line=true)
{
$this->line_order();
$this->line_order(false, 'ASC', $fk_parent_line);
// Get rang of line
$rang = $this->getRangOfLine($rowid);
@ -1553,6 +1556,9 @@ abstract class CommonObject
$i++;
}
// Add revenue stamp to total
$this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
$this->db->free($resql);
// Now update global field total_ht, total_ttc and tva
@ -2138,21 +2144,27 @@ abstract class CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field of attribut
$sql.=",".substr($key,8); // Remove 'options_' prefix
if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
$sql.=",".$attributeKey;
}
$sql .= ") VALUES (".$this->id;
foreach($this->array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
// Add field o fattribut
if ($this->array_options[$key] != '')
{
$sql.=",'".$this->array_options[$key]."'";
}
else
{
$sql.=",null";
}
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
{
if ($this->array_options[$key] != '')
{
$sql.=",'".$this->array_options[$key]."'";
}
else
{
$sql.=",null";
}
}
}
$sql.=")";
@ -2689,7 +2701,8 @@ abstract class CommonObject
global $form,$bc,$bcdd;
$element=$this->element;
$text='';
$text=''; $description=''; $type=0;
// Show product and description
$type=(! empty($line->product_type)?$line->product_type:$line->fk_product_type);
@ -2697,27 +2710,25 @@ abstract class CommonObject
if (! empty($line->date_start)) $type=1; // deprecated
if (! empty($line->date_end)) $type=1; // deprecated
if ($line->fk_product > 0)
{
$product_static = new Product($this->db);
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
$product_static->ref=$line->ref;
$text=$product_static->getNomUrl(1);
}
// Ligne en mode visu
if ($action != 'editline' || $selected != $line->id)
{
// Produit
// Product
if ($line->fk_product > 0)
{
// Define output language
$product_static = new Product($this->db);
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
$product_static->ref=$line->ref;
$text=$product_static->getNomUrl(1);
// Define output language (TODO Does this works ?)
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$this->fetch_thirdparty();
$prod = new Product($this->db);
$prod->fetch($line->fk_product);
$outputlangs = $langs;
$newlang='';

View File

@ -51,7 +51,7 @@ class DolEditor
* @param string $content Content of WYSIWIG field
* @param int $width Width in pixel of edit area (auto by default)
* @param int $height Height in pixel of edit area (200px by default)
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes', 'dolibarr_details', 'dolibarr_mailings')
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]', 'dolibarr_mailings[_encoded]', ')
* @param string $toolbarlocation Where bar is stored :
* 'In' each window has its own toolbar
* 'Out:name' share toolbar into the div called 'name'
@ -69,6 +69,7 @@ class DolEditor
if (! $rows) $rows=round($height/20);
if (! $cols) $cols=($width?round($width/6):80);
$shorttoolbarname=preg_replace('/_encoded$/','',$toolbarname);
// Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
$defaulteditor='ckeditor';
@ -97,7 +98,7 @@ class DolEditor
$this->editor->Value = $content;
$this->editor->Height = $height;
if (! empty($width)) $this->editor->Width = $width;
$this->editor->ToolbarSet = $toolbarname;
$this->editor->ToolbarSet = $shorttoolbarname;
$this->editor->Config['AutoDetectLanguage'] = 'true';
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
@ -124,7 +125,7 @@ class DolEditor
{
$this->content = $content;
$this->htmlname = $htmlname;
$this->toolbarname = $toolbarname;
$this->toolbarname = $shorttoolbarname;
$this->toolbarstartexpanded = $toolbarstartexpanded;
$this->rows = max(ROWS_3,$rows);
$this->cols = max(40,$cols);
@ -169,9 +170,8 @@ class DolEditor
//$skin='office2003';
//$skin='v2';
$skin='kama';
if ($this->toolbarname=='dolibarr_mailings') {$htmlencode_force='true';}
else {$htmlencode_force='false';}
$htmlencode_force=preg_match('/_encoded$/',$this->toolbarname)?'true':'false';
$out.= '<script type="text/javascript">
$(document).ready(function () {

View File

@ -63,7 +63,8 @@ class ExtraFields
'price'=>'ExtrafieldPrice',
'phone'=>'ExtrafieldPhone',
'mail'=>'ExtrafieldMail',
'select' => 'ExtrafieldSelect'
'select' => 'ExtrafieldSelect',
'separate' => 'ExtrafieldSeparator'
);
/**
@ -102,11 +103,13 @@ class ExtraFields
if (empty($attrname)) return -1;
if (empty($label)) return -1;
// Create field into database
$result=$this->create($attrname,$type,$size,$elementtype, $unique, $required, $default_value,$param);
// Create field into database except for separator type which is not stored in database
if ($type != 'separate')
{
$result=$this->create($attrname,$type,$size,$elementtype, $unique, $required, $default_value,$param);
}
$err1=$this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS')
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param);
@ -354,7 +357,6 @@ class ExtraFields
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='')
{
$table=$elementtype.'_extrafields';
// Special case for not normalized table names
if ($elementtype == 'member') $table='adherent_extrafields';
elseif ($elementtype == 'company') $table='societe_extrafields';
@ -382,8 +384,12 @@ class ExtraFields
$lengthdb=$length;
}
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'));
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
if ($result > 0)
if ($type != 'separate') // No table update when separate type
{
$result=$this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
}
if ($result > 0 || $type == 'separate')
{
if ($label)
{
@ -546,8 +552,13 @@ class ExtraFields
{
while ($tab = $this->db->fetch_object($resql))
{
// we can add this attribute to adherent object
$array_name_label[$tab->name]=$tab->label;
if ($tab->type != 'separate')
{
$array_name_label[$tab->name]=$tab->label;
}
$this->attribute_type[$tab->name]=$tab->type;
$this->attribute_label[$tab->name]=$tab->label;
$this->attribute_size[$tab->name]=$tab->size;
@ -730,5 +741,16 @@ class ExtraFields
return $out;
}
/**
* Return HTML string to print separator extrafield
*
* @param string $key Key of attribute
* @return string
*/
function showSeparator($key)
{
$out = '<tr class="liste_titre"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
return $out;
}
}
?>

View File

@ -13,6 +13,7 @@
* Copyright (C) 2010 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -677,7 +678,7 @@ class Form
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
if ($filter) $sql.= " AND ".$filter;
if ($filter) $sql.= " AND (".$filter.")";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY nom ASC";
@ -1223,9 +1224,13 @@ class Form
}
else
{
$sql.=" AND (p.ref LIKE '%".$filterkey."%' OR p.label LIKE '%".$filterkey."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '%".$filterkey."%'";
$sql.=")";
// For natural search
$scrit = explode(' ', $filterkey);
foreach ($scrit as $crit) {
$sql.=" AND (p.ref LIKE '%".$crit."%' OR p.label LIKE '%".$crit."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '%".$crit."%'";
$sql.=")";
}
}
if (! empty($conf->barcode->enabled))

View File

@ -188,10 +188,15 @@ class FormActions
print '<td>'.$ref.'</td>';
print '<td>'.$label.'</td>';
print '<td>'.dol_print_date($action->datep,'day').'</td>';
$userstatic->id = $action->author->id;
$userstatic->firstname = $action->author->firstname;
$userstatic->lastname = $action->author->lastname;
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td>';
if (! empty($action->author->id))
{
$userstatic->id = $action->author->id;
$userstatic->firstname = $action->author->firstname;
$userstatic->lastname = $action->author->lastname;
print $userstatic->getNomUrl(1);
}
print '</td>';
print '</tr>';
}
print '</table>';

View File

@ -0,0 +1,93 @@
<?php
/*
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 cron/class/html.formcron.class.php
* \brief Fichier de la classe des fonctions predefinie de composants html cron
*/
/**
* Class to manage building of HTML components
*/
class FormCron extends Form
{
var $db;
var $error;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
return 1;
}
/**
* Display On Off selector
*
* @param string $htmlname Html control name
* @param string $selected selected value
* @param string $readonly Select is read only or not
* @return string HTML select field
*/
function select_typejob($htmlname,$selected=0,$readonly=0)
{
global $langs;
$langs->load('cron@cron');
if (!empty($readonly)) {
if ($selected=='command') {
$out= $langs->trans('CronType_command');
$out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
$out.= '<OPTION value="command" selected=\"selected\">'.$langs->trans('CronType_command').'</OPTION>';
$out.='</SELECT>';
} elseif ($selected=='method') {
$out= $langs->trans('CronType_method');
$out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
$out.= '<OPTION value="method" selected=\"selected\">'.$langs->trans('CronType_method').'</OPTION>';
$out.='</SELECT>';
}
}else {
$out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
if ($selected=='command') {
$selected_attr=' selected=\"selected\" ';
} else {
$selected_attr='';
}
$out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
if ($selected=='method') {
$selected_attr=' selected=\"selected\" ';
} else {
$selected_attr='';
}
$out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
$out.='</SELECT>';
}
return $out;
}
}

View File

@ -795,6 +795,11 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
$object_instance=new ChargeSociales($this->db);
}
else if ($modulepart == 'project')
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object_instance=new Project($this->db);
}
$var=true;
foreach($filearray as $key => $file)
@ -821,6 +826,7 @@ class FormFile
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');}
if (! $id && ! $ref) continue;

View File

@ -76,7 +76,7 @@ class FormMail
* @param DoliDB $db Database handler
*/
function __construct($db)
{
{
$this->db = $db;
$this->withform=1;
@ -593,7 +593,10 @@ class FormMail
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72);
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$this->withfckeditor=1;
}
$doleditor=new DolEditor('message',nl2br($defaultmessage),'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72);
$out.= $doleditor->Create(1);
}
$out.= "</td></tr>\n";

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