Merge branch 'develop' into units
Conflicts: htdocs/commande/class/commande.class.php htdocs/compta/facture.php htdocs/install/mysql/migration/3.7.0-3.8.0.sql htdocs/product/admin/product.php htdocs/product/card.php
This commit is contained in:
commit
87f97ed545
@ -8,14 +8,10 @@ charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
[*.php]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
[*.js]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
[*.css]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
indent_style = tab
|
||||
[*.xml]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
@ -3,7 +3,10 @@ How to contribute to Dolibarr
|
||||
|
||||
Bug reports and feature requests
|
||||
--------------------------------
|
||||
** NEW **
|
||||
|
||||
*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum).
|
||||
|
||||
**NEW**
|
||||
|
||||
Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues).
|
||||
|
||||
@ -44,11 +47,11 @@ Use clear commit messages with the following structure:
|
||||
<pre>
|
||||
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
CLOSE|Close #456 Short description (where #456 is number feature request, if it exists. In upper case to appear into ChangeLog)
|
||||
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
NEW|New Short description (In upper case to appear into ChangeLog)
|
||||
NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
|
||||
or
|
||||
Short description (when the commit is not introducing feature or closing a bug)
|
||||
Short description (when the commit is not introducing feature nor closing a bug)
|
||||
|
||||
Long description (Can span accross multiple lines).
|
||||
</pre>
|
||||
|
||||
@ -18,6 +18,7 @@ CKEditor 4.3.3 LGPL-2.1+ Yes
|
||||
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
|
||||
@ -243,6 +243,12 @@ Dolibarr better:
|
||||
- Fix: Bad SEPA xml file creation
|
||||
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
|
||||
- Fix: Showing system error if not enough stock of product into orders creation with lines
|
||||
- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract
|
||||
- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line
|
||||
- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project
|
||||
- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
|
||||
- Fix: [ bug #2542 ] Contracts store localtax preferences
|
||||
- Fix: Bad permission assignments for stock movements actions
|
||||
|
||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||
|
||||
@ -3,4 +3,4 @@ dolibarr (3.8.0-3) UNRELEASED; urgency=low
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 3 Mar 2015 12:00:00 +0100
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Sun, 21 March 2015 12:00:00 +0100
|
||||
|
||||
@ -270,28 +270,20 @@ class Skeleton_Class extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
@ -344,11 +336,6 @@ class Skeleton_Class extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
|
||||
222
dev/translation/sanity_check_en_langfiles.php
Normal file
222
dev/translation/sanity_check_en_langfiles.php
Normal file
@ -0,0 +1,222 @@
|
||||
<?php
|
||||
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
echo "<html>";
|
||||
echo "<head>";
|
||||
|
||||
echo "<STYLE type=\"text/css\">
|
||||
body {
|
||||
color: #444;
|
||||
font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
table {
|
||||
background: #f5f5f5;
|
||||
border-collapse: separate;
|
||||
box-shadow: inset 0 1px 0 #fff;
|
||||
font-size: 12px;
|
||||
line-height: 24px;
|
||||
margin: 30px auto;
|
||||
text-align: left;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #777;
|
||||
border-left: 1px solid #555;
|
||||
border-right: 1px solid #777;
|
||||
border-top: 1px solid #555;
|
||||
border-bottom: 1px solid #333;
|
||||
box-shadow: inset 0 1px 0 #999;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
}
|
||||
|
||||
th:after {
|
||||
background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08));
|
||||
content: '';
|
||||
display: block;
|
||||
height: 25%;
|
||||
left: 0;
|
||||
margin: 1px 0 0 0;
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th:first-child {
|
||||
border-left: 1px solid #777;
|
||||
box-shadow: inset 1px 1px 0 #999;
|
||||
}
|
||||
|
||||
th:last-child {
|
||||
box-shadow: inset -1px 1px 0 #999;
|
||||
}
|
||||
|
||||
td {
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #e8e8e8;
|
||||
border-top: 1px solid #fff;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
transition: all 300ms;
|
||||
}
|
||||
|
||||
td:first-child {
|
||||
box-shadow: inset 1px 0 0 #fff;
|
||||
}
|
||||
|
||||
td:last-child {
|
||||
border-right: 1px solid #e8e8e8;
|
||||
box-shadow: inset -1px 0 0 #fff;
|
||||
}
|
||||
|
||||
tr {
|
||||
background-color: #f1f1f1;
|
||||
|
||||
}
|
||||
|
||||
tr:nth-child(odd) td {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
tr:last-of-type td {
|
||||
box-shadow: inset 0 -1px 0 #fff;
|
||||
}
|
||||
|
||||
tr:last-of-type td:first-child {
|
||||
box-shadow: inset 1px -1px 0 #fff;
|
||||
}
|
||||
|
||||
tr:last-of-type td:last-child {
|
||||
box-shadow: inset -1px -1px 0 #fff;
|
||||
}
|
||||
|
||||
tbody:hover td {
|
||||
color: transparent;
|
||||
text-shadow: 0 0 3px #aaa;
|
||||
}
|
||||
|
||||
tbody:hover tr:hover td {
|
||||
color: #444;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
} </STYLE>";
|
||||
|
||||
echo "<body>";
|
||||
echo "<h3>If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used</h3>";
|
||||
echo "<h2>IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly</h2>";
|
||||
echo "<h3>Happy translating :)</h3>";
|
||||
|
||||
// directory containing the php and lang files
|
||||
$htdocs = "../../htdocs/";
|
||||
// directory containing the english lang files
|
||||
$workdir = $htdocs."langs/en_US/";
|
||||
|
||||
$files = scandir($workdir);
|
||||
$exludefiles = array('.','..','README');
|
||||
$files = array_diff($files,$exludefiles);
|
||||
$langstrings_3d = array();
|
||||
$langstrings_full = array();
|
||||
foreach ($files AS $file) {
|
||||
$path_file = pathinfo($file);
|
||||
// we're only interested in .lang files
|
||||
if ($path_file['extension']=='lang') {
|
||||
$content = file($workdir.$file);
|
||||
foreach ($content AS $line => $row) {
|
||||
// don't want comment lines
|
||||
if (substr($row,0,1) !== '#') {
|
||||
// don't want lines without the separator (why should those even be here, anyway...)
|
||||
if (strpos($row,'=')!==false) {
|
||||
$row_array = explode('=',$row);
|
||||
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
|
||||
$langstrings_full[]=$row_array[0];
|
||||
$langstrings_dist[$row_array[0]]=$row_array[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($langstrings_3d AS $filename => $file) {
|
||||
foreach ($file AS $linenum => $value) {
|
||||
$keys = array_keys($langstrings_full, $value);
|
||||
if (count($keys)>1) {
|
||||
foreach ($keys AS $key) {
|
||||
$dups[$value][$filename][$linenum] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "<h2>Duplicate strings in lang files in $workdir - ".count($dups)." found</h2>";
|
||||
echo "<pre>";
|
||||
|
||||
echo "<table border_bottom=1> ";
|
||||
echo "<thead><tr><th align=\"center\">#</th><th>String</th><th>File and lines</th></thead>";
|
||||
echo "<tbody>";
|
||||
$count = 0;
|
||||
foreach ($dups as $string => $pages) {
|
||||
$count++;
|
||||
echo "<tr>";
|
||||
echo "<td align=\"center\">$count</td>";
|
||||
echo "<td>$string</td>";
|
||||
echo "<td>";
|
||||
foreach ($pages AS $page => $lines ) {
|
||||
echo "$page ";
|
||||
foreach ($lines as $line => $nothing) {
|
||||
echo "($line) ";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
if ($_REQUEST['unused'] == 'true') {
|
||||
|
||||
foreach ($langstrings_dist AS $value){
|
||||
$search = '\'trans("'.$value.'")\'';
|
||||
$string = 'grep -R -m 1 -F --include=*.php '.$search.' '.$htdocs.'*';
|
||||
exec($string,$output);
|
||||
if (empty($output)) {
|
||||
$unused[$value] = true;
|
||||
echo $value.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "<h2>Strings in en_US that are never used</h2>";
|
||||
echo "<pre>";
|
||||
print_r($unused);
|
||||
}
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
?>
|
||||
@ -178,7 +178,7 @@ if ($result) {
|
||||
|
||||
/*
|
||||
* Action
|
||||
* FIXME Action must be set before any view part
|
||||
* FIXME Action must be set before any view part to respect MVC
|
||||
*/
|
||||
|
||||
// Bookkeeping Write
|
||||
|
||||
@ -164,7 +164,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr '.$bc[$var].' id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';;
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
@ -197,7 +197,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
|
||||
print '<tr '.$bc[$var].' id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';;
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ if (empty($reshook))
|
||||
}
|
||||
$lastname=$_POST["lastname"];
|
||||
$firstname=$_POST["firstname"];
|
||||
$morphy=$morphy=$_POST["morphy"];;
|
||||
$morphy=$morphy=$_POST["morphy"];
|
||||
if ($morphy != 'mor' && empty($lastname)) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
|
||||
@ -5,8 +5,9 @@
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.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
|
||||
@ -77,7 +78,8 @@ class Adherent extends CommonObject
|
||||
|
||||
var $morphy;
|
||||
var $public;
|
||||
var $note; // Private note
|
||||
var $note_private; // Private note
|
||||
var $note_public; // Public note
|
||||
var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
|
||||
var $photo;
|
||||
|
||||
@ -310,7 +312,7 @@ class Adherent extends CommonObject
|
||||
$sql.= " VALUES (";
|
||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script
|
||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
||||
$sql.= ", null, null, '".$this->morphy."'";
|
||||
$sql.= ", '".$this->typeid."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
@ -445,9 +447,10 @@ class Adherent extends CommonObject
|
||||
$sql.= ", email='".$this->email."'";
|
||||
$sql.= ", skype='".$this->skype."'";
|
||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql.= ", note=" .($this->note?"'".$this->db->escape($this->note)."'":"null");
|
||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql.= ", public='".$this->public."'";
|
||||
$sql.= ", statut=" .$this->statut;
|
||||
@ -473,7 +476,7 @@ class Adherent extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('memberdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$action='';
|
||||
@ -1053,7 +1056,8 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,";
|
||||
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
|
||||
$sql.= " d.note_public,";
|
||||
$sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,";
|
||||
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
|
||||
$sql.= " d.datec as datec,";
|
||||
@ -1134,7 +1138,8 @@ class Adherent extends CommonObject
|
||||
$this->datevalid = $this->db->jdate($obj->datev);
|
||||
$this->birth = $this->db->jdate($obj->birthday);
|
||||
|
||||
$this->note = $obj->note;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->morphy = $obj->morphy;
|
||||
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
@ -1561,7 +1566,8 @@ class Adherent extends CommonObject
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowMember") . '</u>';
|
||||
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->ref))
|
||||
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->firstname) || ! empty($this->lastname))
|
||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
@ -1801,7 +1807,7 @@ class Adherent extends CommonObject
|
||||
$this->phone = '0999999999';
|
||||
$this->phone_perso = '0999999998';
|
||||
$this->phone_mobile = '0999999997';
|
||||
$this->note='No comment';
|
||||
$this->note_private='No comment';
|
||||
$this->birth=time();
|
||||
$this->photo='';
|
||||
$this->public=1;
|
||||
@ -1874,7 +1880,8 @@ class Adherent extends CommonObject
|
||||
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
|
||||
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->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
|
||||
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
|
||||
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');
|
||||
@ -1947,4 +1954,21 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty($db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'adherent'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->statut=trim($this->statut);
|
||||
$this->statut=(int) $this->statut;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||
$sql.= "libelle";
|
||||
|
||||
@ -110,7 +110,7 @@ if ($sall)
|
||||
if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR ";
|
||||
$sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'";
|
||||
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note LIKE '%".$db->escape($sall)."%')";
|
||||
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
}
|
||||
if ($type > 0)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.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
|
||||
@ -19,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/adherents/note.php
|
||||
* \ingroup member
|
||||
* \brief Tabe for note of a member
|
||||
* \brief Tab for note of a member
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -45,26 +46,13 @@ if ($result > 0)
|
||||
$result=$adht->fetch($object->typeid);
|
||||
}
|
||||
|
||||
$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
setEventMessage($object->error, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
|
||||
@ -82,7 +70,7 @@ if ($id)
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
|
||||
|
||||
print "<form method=\"post\" action=\"note.php\">";
|
||||
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -129,49 +117,16 @@ if ($id)
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($action == 'edit' && $user->rights->adherent->creer)
|
||||
{
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print nl2br($object->note);
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td colspan="4" align="center">';
|
||||
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</form>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print '</div>';
|
||||
print '<div class="tabsAction">';
|
||||
$colwidth='20';
|
||||
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
if ($user->rights->adherent->creer && $action != 'edit')
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="note.php?id='.$object->id.'&action=edit">'.$langs->trans('Modify')."</a></div>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -386,7 +386,7 @@ if ($rowid > 0)
|
||||
{
|
||||
$sql.= " AND (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."%')";
|
||||
$sql.= " OR d.town LIKE '%".$sall."%' OR d.note_public LIKE '%".$sall."%' OR d.note_private LIKE '%".$sall."%')";
|
||||
}
|
||||
if ($status != '')
|
||||
{
|
||||
|
||||
@ -319,7 +319,6 @@ foreach ($dirmodels as $reldir)
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$askpricesupplier->type=0;
|
||||
$nextval=$module->getNextValue($mysoc,$askpricesupplier);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
|
||||
@ -369,7 +369,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
// Logo
|
||||
$var=!$var;
|
||||
print '<tr'.dol_bc($var,'hideonsmartphone').'><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
||||
print '<table width="100%" class="nocellnopadd"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat" name="logo" id="logo" size="50">';
|
||||
print '</td><td valign="middle" align="right">';
|
||||
if (! empty($mysoc->logo_mini))
|
||||
@ -605,8 +605,9 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$opcions=array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"),$langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"),$langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
|
||||
|
||||
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
@ -649,7 +650,6 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '<tr><td align="left"><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||
print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
@ -754,7 +754,7 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("Logo").'</td><td>';
|
||||
|
||||
print '<table width="100%" class="nocellnopadd"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print $mysoc->logo;
|
||||
print '</td><td valign="center" align="right">';
|
||||
|
||||
@ -1061,15 +1061,15 @@ else
|
||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax1",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc");
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax2",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc");
|
||||
}
|
||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2)
|
||||
{
|
||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||
print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@ -923,7 +923,7 @@ if ($id)
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+2;
|
||||
if ($id == 4) $colspan++;;
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
if (! empty($alabelisused)) // Si un des champs est un libelle
|
||||
{
|
||||
|
||||
@ -323,8 +323,6 @@ else // Show
|
||||
$var=true;
|
||||
|
||||
// Language
|
||||
print_fiche_titre($langs->trans("Language"),'','');
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td><td> </td></tr>';
|
||||
|
||||
|
||||
@ -100,6 +100,7 @@ print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Add hook to add information
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
|
||||
@ -65,13 +65,14 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC',GETPOST("fieldnotepublic"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE',GETPOST("fieldbirthdate"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS',GETPOST("fieldstatus"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"),'chaine',0,'',$conf->entity)) $error++;
|
||||
@ -312,6 +313,14 @@ print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Public Note
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldNotePublic").'</td><td>';
|
||||
print '<input size="25" type="text" name="fieldnotepublic" value="'.$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC.'">';
|
||||
print '</td><td>'.$langs->trans("LDAPFieldNotePublicExample").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Birthday
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>';
|
||||
|
||||
@ -174,8 +174,8 @@ if ($conf->societe->enabled)
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="right">';
|
||||
$nb = $notify->countDefinedNotifications($notifiedevent['code'], 0);
|
||||
print $nb;
|
||||
$tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0);
|
||||
print count($tmparray);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
||||
$langs->load("mails");
|
||||
print_titre($langs->trans("Notifications"));
|
||||
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_societe, u.email";
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_soc, u.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
|
||||
@ -194,7 +194,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
if (!$obj->fk_societe)
|
||||
if (!$obj->fk_soc)
|
||||
{
|
||||
$username=dolGetFirstLastname($obj->firstname,$obj->lastname);
|
||||
$internalusers[$obj->rowid] = $username;
|
||||
|
||||
@ -182,43 +182,27 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
$res3=1;
|
||||
}*/
|
||||
|
||||
// TODO We add/delete permission until permission can have a condition on a global var
|
||||
$r_id = 1190;
|
||||
$entity = $conf->entity;
|
||||
$r_desc=$langs->trans("Permission1190");
|
||||
$r_modul='fournisseur';
|
||||
$r_type='w';
|
||||
$r_perms='commande';
|
||||
$r_subperms='approve2';
|
||||
$r_def=0;
|
||||
// TODO We add/delete permission here until permission can have a condition on a global var
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
|
||||
$newmodule=new modFournisseur($db);
|
||||
// clear default rights array
|
||||
$newmodule->rights=array();
|
||||
// add new right
|
||||
$r=0;
|
||||
$newmodule->rights[$r][0] = 1190;
|
||||
$newmodule->rights[$r][1] = $langs->trans("Permission1190");
|
||||
$newmodule->rights[$r][2] = 'w';
|
||||
$newmodule->rights[$r][3] = 0;
|
||||
$newmodule->rights[$r][4] = 'commande';
|
||||
$newmodule->rights[$r][5] = 'approve2';
|
||||
|
||||
if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)";
|
||||
$sql.= " VALUES ";
|
||||
$sql.= "(".$r_id.",".$entity.",'".$db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')";
|
||||
|
||||
$resqlinsert=$db->query($sql,1);
|
||||
if (! $resqlinsert)
|
||||
{
|
||||
if ($db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
|
||||
{
|
||||
setEventMessage($db->lasterror(),'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
$newmodule->insert_permissions(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE id = ".$r_id;
|
||||
$resqldelete=$db->query($sql,1);
|
||||
if (! $resqldelete)
|
||||
{
|
||||
setEventMessage($db->lasterror(),'errors');
|
||||
$error++;
|
||||
}
|
||||
$newmodule->delete_permissions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -111,11 +111,6 @@ jQuery(document).ready(function() {
|
||||
print_fiche_titre($langs->trans("Backup"),'','setup');
|
||||
|
||||
print $langs->trans("BackupDesc",DOL_DATA_ROOT).'<br><br>';
|
||||
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
|
||||
print $langs->trans("BackupDescX").'<br><br>';
|
||||
print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'<br>';
|
||||
print $langs->trans("BackupDescY").'<br><br>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -124,9 +119,29 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
|
||||
type="hidden" name="export_type" value="server" />
|
||||
|
||||
<fieldset id="fieldsetexport">
|
||||
<?php print '<legend>'.$langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b></legend>'; ?>
|
||||
<table>
|
||||
<fieldset id="fieldsetexport"><legend style="font-size: 3em">1</legend>
|
||||
|
||||
<?php
|
||||
print $langs->trans("BackupDesc3",$dolibarr_main_db_name).'<br>';
|
||||
//print $langs->trans("BackupDescY").'<br>';
|
||||
print '<br>';
|
||||
?>
|
||||
|
||||
<div id="backupdatabaseleft" class="fichehalfleft" >
|
||||
|
||||
<?php
|
||||
|
||||
print_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
|
||||
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr '.$bc[false].'><td style="padding-left: 8px">';
|
||||
?>
|
||||
<table class="centpercent">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
|
||||
@ -182,7 +197,7 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
?><br>
|
||||
<input type="text" name="mysqldump" size="80"
|
||||
<input type="text" name="mysqldump" style="width: 80%"
|
||||
value="<?php echo $fullpathofmysqldump; ?>" /></div>
|
||||
|
||||
<br>
|
||||
@ -317,7 +332,7 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
?><br>
|
||||
<input type="text" name="postgresqldump" size="80"
|
||||
<input type="text" name="postgresqldump" style="width: 80%"
|
||||
value="<?php echo $fullpathofpgdump; ?>" /></div>
|
||||
|
||||
|
||||
@ -357,12 +372,12 @@ print $langs->trans("BackupDescY").'<br><br>';
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><?php echo $langs->trans("Destination"); ?></legend>
|
||||
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label>:
|
||||
<input type="text" name="filename_template" size="60"
|
||||
<!--<fieldset>
|
||||
<legend><?php echo $langs->trans("Destination"); ?></legend> -->
|
||||
<br>
|
||||
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
|
||||
<input type="text" name="filename_template" style="width: 90%"
|
||||
id="filename_template"
|
||||
value="<?php
|
||||
$prefix='dump';
|
||||
@ -417,7 +432,8 @@ foreach($compression as $key => $val)
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
?></fieldset>
|
||||
?><!--</fieldset>--> <!-- End destination -->
|
||||
|
||||
|
||||
<br>
|
||||
<div align="center"><input type="submit" class="button"
|
||||
@ -425,15 +441,38 @@ print "\n";
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
print '</td></tr></table>';
|
||||
?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div id="backupdatabaseright" class="fichehalfright" style="height:400px; overflow: auto;">
|
||||
<div class="ficheaddleft">
|
||||
|
||||
<?php
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,$langs->trans("NoBackupFileAvailable"),0,$langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
|
||||
<fieldset><legend style="font-size: 3em">2</legend>
|
||||
<?php
|
||||
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
|
||||
print $langs->trans("BackupDescX").'<br><br>';
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
<?php
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -66,13 +66,24 @@ jQuery(document).ready(function() {
|
||||
print_fiche_titre($langs->trans("Restore"),'','setup');
|
||||
|
||||
print $langs->trans("RestoreDesc",DOL_DATA_ROOT).'<br><br>';
|
||||
?>
|
||||
<fieldset>
|
||||
<legend style="font-size: 3em">1</legend>
|
||||
<?php
|
||||
print $langs->trans("RestoreDesc2",DOL_DATA_ROOT).'<br><br>';
|
||||
print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
|
||||
<fieldset>
|
||||
<legend style="font-size: 3em">2</legend>
|
||||
<?php
|
||||
print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
|
||||
?>
|
||||
|
||||
<fieldset id="fieldsetexport">
|
||||
<?php print '<legend>'.$langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b></legend>'; ?>
|
||||
<?php print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b>'; ?><br><br>
|
||||
|
||||
<table><tr><td valign="top">
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
|
||||
@ -88,10 +88,10 @@ if (!empty($MemoryLimit))
|
||||
$form=new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
llxHeader('','',$help_url);
|
||||
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
//llxHeader('','',$help_url);
|
||||
|
||||
print_fiche_titre($langs->trans("Backup"),'','setup');
|
||||
//print_fiche_titre($langs->trans("Backup"),'','setup');
|
||||
|
||||
|
||||
// Start with empty buffer
|
||||
@ -165,13 +165,18 @@ if ($what == 'mysql')
|
||||
$paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"';
|
||||
}
|
||||
|
||||
$_SESSION["commandbackuplastdone"]=$command." ".$paramcrypted;
|
||||
$_SESSION["commandbackuptorun"]="";
|
||||
/*
|
||||
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
// Now run command and show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
*/
|
||||
|
||||
$errormsg='';
|
||||
|
||||
@ -264,6 +269,9 @@ if ($what == 'mysqlnobin')
|
||||
{
|
||||
backup_tables($outputfile);
|
||||
}
|
||||
|
||||
$_SESSION["commandbackuplastdone"]="";
|
||||
$_SESSION["commandbackuptorun"]="";
|
||||
}
|
||||
|
||||
// POSTGRESQL
|
||||
@ -320,7 +328,9 @@ if ($what == 'postgresql')
|
||||
$paramcrypted.=" -w ".$dolibarr_main_db_name;
|
||||
$paramclear.=" -w ".$dolibarr_main_db_name;
|
||||
|
||||
print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
|
||||
$_SESSION["commandbackuplastdone"]="";
|
||||
$_SESSION["commandbackuptorun"]=$command." ".$paramcrypted;
|
||||
/*print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
|
||||
print '<textarea rows="'.ROWS_3.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
|
||||
|
||||
print '<br>';
|
||||
@ -330,7 +340,7 @@ if ($what == 'postgresql')
|
||||
print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user);
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';*/
|
||||
|
||||
$what='';
|
||||
}
|
||||
@ -339,34 +349,46 @@ if ($what == 'postgresql')
|
||||
|
||||
|
||||
// Si on a demande une generation
|
||||
if ($what)
|
||||
{
|
||||
//if ($what)
|
||||
//{
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors');
|
||||
/*
|
||||
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||
// print '<a href="'.DOL_URL_ROOT.$relativepatherr.'">'.$langs->trans("DownloadErrorFile").'</a><br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';*/
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="ok">';
|
||||
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
print $langs->trans("YouCanDownloadBackupFile");
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
{
|
||||
if ($what)
|
||||
{
|
||||
setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"));
|
||||
/*print '<div class="ok">';
|
||||
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
print $langs->trans("YouCanDownloadBackupFile");
|
||||
print '</div>';
|
||||
print '<br>';*/
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user));
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
/*
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'<br>'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles"));
|
||||
|
||||
print '<br>';
|
||||
*/
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
|
||||
$time_end = time();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,8 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
if (GETPOST('msg','alpha')) {
|
||||
@ -43,14 +45,18 @@ $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
|
||||
$dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
|
||||
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
|
||||
|
||||
$dirins=DOL_DOCUMENT_ROOT.'/custom';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('action','alpha')=='install')
|
||||
if ($action=='install')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
// $original_file should match format module_modulename-x.y[.z].zip
|
||||
$original_file=basename($_FILES["fileinstall"]["name"]);
|
||||
$newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
|
||||
|
||||
@ -72,33 +78,87 @@ if (GETPOST('action','alpha')=='install')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
|
||||
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
|
||||
if ($original_file)
|
||||
{
|
||||
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
|
||||
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
|
||||
}
|
||||
|
||||
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
|
||||
if ($tmpdir)
|
||||
{
|
||||
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
|
||||
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
|
||||
}
|
||||
|
||||
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$documentrootalt=DOL_DOCUMENT_ROOT.'/extensions';
|
||||
$result=dol_uncompress($newfile,$documentrootalt);
|
||||
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
|
||||
|
||||
if (! empty($result['error']))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($result['error'],$original_file), 'errors');
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("SetupIsReadyForUse"));
|
||||
// Now we move the dir of the module
|
||||
$modulename=preg_replace('/module_/', '', $original_file);
|
||||
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
|
||||
// Search dir $modulename
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
//var_dump($dirins);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulename);
|
||||
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFailedToCopy"), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessage($langs->trans("SetupIsReadyForUse"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirins=DOL_DOCUMENT_ROOT.'/extensions';
|
||||
$dirins_ok=(is_dir($dirins));
|
||||
|
||||
|
||||
// Set dir where external modules are installed
|
||||
if (! dol_is_dir($dirins))
|
||||
{
|
||||
dol_mkdir($dirins);
|
||||
}
|
||||
$dirins_ok=(dol_is_dir($dirins));
|
||||
|
||||
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
|
||||
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
|
||||
@ -143,6 +203,8 @@ else
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Upgrade
|
||||
print $langs->trans("Upgrade").'<br>';
|
||||
print '<hr>';
|
||||
print $langs->trans("ThisIsProcessToFollow").'<br>';
|
||||
@ -162,20 +224,76 @@ print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Install external module
|
||||
|
||||
$allowonlineinstall=true;
|
||||
$allowfromweb=1;
|
||||
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
|
||||
|
||||
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
|
||||
$message='';
|
||||
if (! empty($allowonlineinstall))
|
||||
{
|
||||
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
|
||||
{
|
||||
$message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
|
||||
$allowfromweb=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($dirins_ok)
|
||||
{
|
||||
if (! is_writable(dol_osencode($dirins)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
|
||||
$allowfromweb=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
|
||||
print '<hr>';
|
||||
print $langs->trans("ThisIsProcessToFollow").'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
|
||||
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
|
||||
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
|
||||
if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
|
||||
if ($allowfromweb < 1)
|
||||
{
|
||||
if ($dirins_ok)
|
||||
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
|
||||
print $message;
|
||||
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
if ($allowfromweb >= 0)
|
||||
{
|
||||
if ($allowfromweb == 1) print $langs->trans("ThisIsProcessToFollow").'<br>';
|
||||
else print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
|
||||
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
|
||||
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
|
||||
|
||||
if ($allowfromweb == 1)
|
||||
{
|
||||
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
|
||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||
print '<input type="hidden" name="action" value="install">';
|
||||
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
|
||||
@ -184,16 +302,12 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
|
||||
}
|
||||
else
|
||||
{
|
||||
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
||||
setEventMessage($message, 'warnings');
|
||||
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print $langs->trans("SetupIsReadyForUse").'<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
|
||||
print $langs->trans("SetupIsReadyForUse").'<br>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
|
||||
if (! empty($result['return']))
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -210,4 +211,21 @@ class Bookmark
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'bookmark'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ if (! empty($conf->service->enabled))
|
||||
$var=! $var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("CashdeskShowServices");
|
||||
print '<td colspan="2">';;
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ else if ($id || $ref)
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
|
||||
|
||||
$head=product_prepare_head($product, $user);
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'category', $titre,0,$picto);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -201,7 +202,7 @@ class Categorie extends CommonObject
|
||||
$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('HookModuleNamedao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -294,7 +295,7 @@ class Categorie extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('HookCategorydao'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -1164,10 +1165,10 @@ class Categorie extends CommonObject
|
||||
{
|
||||
$cats = array();
|
||||
|
||||
$typeid=-1; $table='';;
|
||||
$typeid=-1; $table='';
|
||||
if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; }
|
||||
else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; }
|
||||
else if ($type == '2' || $type == 'customer') { $typeid=2; $table='societe'; $type='societe'; }
|
||||
else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='soc'; $type='fournisseur'; }
|
||||
else if ($type == '2' || $type == 'customer') { $typeid=2; $table='soc'; $type='societe'; }
|
||||
else if ($type == '3' || $type == 'member') { $typeid=3; $table='member'; $type='member'; }
|
||||
else if ($type == '4' || $type == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; }
|
||||
|
||||
@ -1551,4 +1552,21 @@ class Categorie extends CommonObject
|
||||
$this->socid = 1;
|
||||
$this->type = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'categorie_societe'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ class ActionComm extends CommonObject
|
||||
$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -657,7 +657,7 @@ class ActionComm extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('actioncommdao'));
|
||||
$parameters=array('actcomm'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -1263,5 +1263,22 @@ class ActionComm extends CommonObject
|
||||
$this->userassigned[$user->id]=array('id'=>$user->id, 'transparency'=> 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'actioncomm'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -220,8 +220,8 @@ class ICal
|
||||
}
|
||||
|
||||
if (($key == "DTSTAMP") or ($key == "LAST-MODIFIED") or ($key == "CREATED")) $value = $this->ical_date_to_unix($value);
|
||||
if ($key == "RRULE" ) $value = $this->ical_rrule($value);
|
||||
|
||||
//if ($key == "RRULE" ) $value = $this->ical_rrule($value);
|
||||
|
||||
if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
|
||||
{
|
||||
if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE"))
|
||||
|
||||
@ -1730,6 +1730,9 @@ if ($action == 'create')
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
@ -1802,6 +1805,7 @@ if ($action == 'create')
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'askpricesupplier_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
// Init list of files
|
||||
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
if ($action == 'setoutstanding_limit')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('setoutstanding_limit');
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
@ -406,9 +406,15 @@ if ($id > 0)
|
||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
// display amount and link to unpaid bill
|
||||
$outstandigBills = $object->get_OutstandingBill();
|
||||
if ($outstandigBills != 0)
|
||||
print " (".$langs->trans("CurrentOutstandingBill")." <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).'</a>)';
|
||||
$outstandingBills = $object->get_OutstandingBill();
|
||||
if ($outstandingBills != 0) {
|
||||
print ' ('.$langs->trans("CurrentOutstandingBill");
|
||||
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'&search_status=1">';
|
||||
print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency);
|
||||
print '</a>';
|
||||
if ($outstandingBills > $object->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ')';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -627,7 +633,7 @@ if ($id > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
//if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
||||
//else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
||||
@ -854,7 +860,7 @@ if ($id > 0)
|
||||
$facturestatic = new Facture($db);
|
||||
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
|
||||
$sql.= ', f.total';
|
||||
$sql.= ', f.total as total_ht';
|
||||
$sql.= ', f.tva as total_tva';
|
||||
$sql.= ', f.total_ttc';
|
||||
$sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
|
||||
@ -896,7 +902,7 @@ if ($id > 0)
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->facnumber;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
print $facturestatic->getNomUrl(1);
|
||||
@ -909,7 +915,7 @@ if ($id > 0)
|
||||
{
|
||||
print '<td align="right"><b>!!!</b></td>';
|
||||
}
|
||||
print '<td align="right" width="120">'.price($objp->total_ttc).'</td>';
|
||||
print '<td align="right" width="120">'.price($objp->total_ht).'</td>';
|
||||
|
||||
print '<td align="right" class="nowrap" width="100" >'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 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
|
||||
@ -67,7 +67,7 @@ if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("CustomerArea"));
|
||||
print_fiche_titre($langs->trans("CommercialArea"));
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
@ -579,6 +579,103 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Opened Order
|
||||
*/
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("order");
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total as total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 1";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY c.rowid DESC";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></td></tr>';
|
||||
|
||||
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||
while ($i < $nbofloop)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" width="140">';
|
||||
|
||||
$orderstatic->id=$obj->commandeid;
|
||||
$orderstatic->ref=$obj->ref;
|
||||
$orderstatic->ref_client=$obj->ref_client;
|
||||
$orderstatic->total_ht = $obj->total_ht;
|
||||
$orderstatic->total_tva = $obj->total_tva;
|
||||
$orderstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $orderstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td width="18" class="nobordernopadding nowrap">';
|
||||
//if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="center" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print $companystatic->getNomUrl(1, 'company', 44);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($num > $nbofloop)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
|
||||
}
|
||||
else if ($total>0)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ $sql = "SELECT s.rowid, s.nom as name, s.client, s.zip, s.town, st.libelle as st
|
||||
$sql.= " s.datec, s.canvas";
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
|
||||
@ -303,7 +303,7 @@ if (empty($reshook))
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->statut = 0;
|
||||
$object->statut = Propal::STATUS_DRAFT;
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
@ -543,52 +543,80 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Classify billed
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||
$object->cloture($user, 4, '');
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
|
||||
{
|
||||
$result=$object->cloture($user, 4, '');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen proposal
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
||||
{
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
|
||||
$object->reopen($user, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
||||
{
|
||||
if (! GETPOST('statut')) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
||||
$action = 'statut';
|
||||
} else {
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($object->statut == 1) {
|
||||
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||
if ($object->statut == Propal::STATUS_VALIDATED)
|
||||
{
|
||||
$result=$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Classify billed
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
|
||||
$object->cloture($user, 4, '');
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
|
||||
{
|
||||
$result=$object->cloture($user, 4, '');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen proposal
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
||||
{
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
|
||||
$object->reopen($user, 1);
|
||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
||||
{
|
||||
$result=$object->reopen($user, 1);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
||||
{
|
||||
if (! GETPOST('statut')) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
|
||||
$action = 'statut';
|
||||
} else {
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($object->statut == 1) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED) {
|
||||
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
||||
}
|
||||
}
|
||||
@ -1154,7 +1182,7 @@ if (empty($reshook))
|
||||
if (! $error)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('propaldao'));
|
||||
$parameters = array('id' => $object->id);
|
||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
@ -1745,7 +1773,7 @@ if ($action == 'create')
|
||||
$absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
if ($absolute_discount) {
|
||||
if ($object->statut > 0) {
|
||||
if ($object->statut > Propal::STATUS_DRAFT) {
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency));
|
||||
} else {
|
||||
// Remise dispo de type non avoir
|
||||
@ -1807,7 +1835,7 @@ if ($action == 'create')
|
||||
} else {
|
||||
if (! empty($object->fin_validite)) {
|
||||
print dol_print_date($object->fin_validite, 'daytext');
|
||||
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
|
||||
print img_warning($langs->trans("Late"));
|
||||
} else {
|
||||
print ' ';
|
||||
@ -2091,7 +2119,7 @@ if ($action == 'create')
|
||||
<input type="hidden" name="id" value="' . $object->id . '">
|
||||
';
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && $object->statut == 0) {
|
||||
if (! empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) {
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
|
||||
@ -2101,7 +2129,7 @@ if ($action == 'create')
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
|
||||
// Form to add new line
|
||||
if ($object->statut == 0 && $user->rights->propal->creer)
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
@ -2164,7 +2192,7 @@ if ($action == 'create')
|
||||
if ($action != 'statut' && $action != 'editline')
|
||||
{
|
||||
// Validate
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 &&
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
) {
|
||||
@ -2178,18 +2206,18 @@ if ($action == 'create')
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||
}
|
||||
// Edit
|
||||
if ($object->statut == 1 && $user->rights->propal->creer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
|
||||
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
|
||||
print '>' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut == 1 || $object->statut == 2) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
} else
|
||||
@ -2197,14 +2225,14 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == 2) {
|
||||
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||
if ($user->rights->commande->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && $object->statut == 2) {
|
||||
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
@ -2213,7 +2241,8 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == 2) {
|
||||
if ($object->statut == Propal::STATUS_SIGNED)
|
||||
{
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
|
||||
@ -2227,7 +2256,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($object->statut == 1 && $user->rights->propal->cloturer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
||||
print '>' . $langs->trans('Close') . '</a></div>';
|
||||
}
|
||||
@ -2288,6 +2317,10 @@ if ($action == 'create')
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
@ -2382,6 +2415,7 @@ if ($action == 'create')
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'propal_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
// Init list of files
|
||||
|
||||
@ -56,19 +56,56 @@ class Propal extends CommonObject
|
||||
|
||||
var $id;
|
||||
|
||||
var $socid; // Id client
|
||||
var $client; // Objet societe client (a charger par fetch_client)
|
||||
/**
|
||||
* ID of the client
|
||||
* @var int
|
||||
*/
|
||||
var $socid;
|
||||
/**
|
||||
* Client (loaded by fetch_client)
|
||||
* @var Societe
|
||||
*/
|
||||
var $client;
|
||||
|
||||
var $contactid;
|
||||
var $fk_project;
|
||||
var $author;
|
||||
var $ref;
|
||||
var $ref_client;
|
||||
var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
|
||||
var $datec; // Date of creation
|
||||
var $datev; // Date of validation
|
||||
var $date; // Date of proposal
|
||||
var $datep; // Same than date
|
||||
|
||||
/**
|
||||
* Status of the quote
|
||||
* Check the following constants:
|
||||
* - STATUS_DRAFT
|
||||
* - STATUS_VALIDATED
|
||||
* - STATUS_SIGNED
|
||||
* - STATUS_NOTSIGNED
|
||||
* - STATUS_BILLED
|
||||
* @var int
|
||||
*/
|
||||
var $statut;
|
||||
|
||||
/**
|
||||
* Date of creation
|
||||
* @var
|
||||
*/
|
||||
var $datec;
|
||||
/**
|
||||
* Date of validation
|
||||
* @var
|
||||
*/
|
||||
var $datev;
|
||||
/**
|
||||
* Date of the quote
|
||||
* @var
|
||||
*/
|
||||
var $date;
|
||||
|
||||
/**
|
||||
* Same than date ¿?
|
||||
* @var
|
||||
*/
|
||||
var $datep;
|
||||
var $date_livraison;
|
||||
var $fin_validite;
|
||||
|
||||
@ -81,9 +118,19 @@ class Propal extends CommonObject
|
||||
var $total_localtax1; // Total Local Taxes 1
|
||||
var $total_localtax2; // Total Local Taxes 2
|
||||
var $total_ttc; // Total with tax
|
||||
var $price; // deprecated (for compatibility)
|
||||
var $tva; // deprecated (for compatibility)
|
||||
var $total; // deprecated (for compatibility)
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $price;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $tva;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $total;
|
||||
|
||||
var $cond_reglement_id;
|
||||
var $cond_reglement_code;
|
||||
@ -93,10 +140,16 @@ class Propal extends CommonObject
|
||||
var $remise;
|
||||
var $remise_percent;
|
||||
var $remise_absolue;
|
||||
var $note; // deprecated (for compatibility)
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $note;
|
||||
var $note_private;
|
||||
var $note_public;
|
||||
var $fk_delivery_address; // deprecated (for compatibility)
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $fk_delivery_address;
|
||||
var $fk_address;
|
||||
var $address_type;
|
||||
var $address;
|
||||
@ -122,12 +175,32 @@ class Propal extends CommonObject
|
||||
var $labelstatut_short=array();
|
||||
|
||||
var $specimen;
|
||||
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
/**
|
||||
* Validated status
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Signed quote
|
||||
*/
|
||||
const STATUS_SIGNED = 2;
|
||||
/**
|
||||
* Not signed quote
|
||||
*/
|
||||
const STATUS_NOTSIGNED = 3;
|
||||
/**
|
||||
* Billed quote
|
||||
*/
|
||||
const STATUS_BILLED = 4;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -365,7 +438,7 @@ class Propal extends CommonObject
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($this->statut == 0)
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -531,7 +604,7 @@ class Propal extends CommonObject
|
||||
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||
|
||||
if ($this->statut == 0)
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -657,7 +730,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function deleteline($lineid)
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
$line=new PropaleLigne($this->db);
|
||||
|
||||
@ -893,7 +966,7 @@ class Propal extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('propaldao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -1015,7 +1088,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
$this->id=0;
|
||||
$this->statut=0;
|
||||
$this->statut=self::STATUS_DRAFT;
|
||||
|
||||
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
|
||||
{
|
||||
@ -1197,10 +1270,10 @@ class Propal extends CommonObject
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($obj->fk_statut == 0)
|
||||
|
||||
if ($obj->fk_statut == self::STATUS_DRAFT)
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
}
|
||||
@ -1236,7 +1309,7 @@ class Propal extends CommonObject
|
||||
$extrafieldsline=new ExtraFields($this->db);
|
||||
$line = new PropaleLigne($this->db);
|
||||
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
|
||||
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@ -1290,7 +1363,7 @@ class Propal extends CommonObject
|
||||
$line->date_end = $objp->date_end;
|
||||
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
//dol_syslog("1 ".$line->fk_product);
|
||||
//print "xx $i ".$this->lines[$i]->fk_product;
|
||||
@ -1329,7 +1402,7 @@ class Propal extends CommonObject
|
||||
$action='update';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('propaldao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -1395,8 +1468,8 @@ class Propal extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET ref = '".$num."',";
|
||||
$sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(get_class($this)."::valid", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1451,7 +1524,7 @@ class Propal extends CommonObject
|
||||
|
||||
$this->ref=$num;
|
||||
$this->brouillon=0;
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
$this->user_valid_id=$user->id;
|
||||
$this->datev=$now;
|
||||
|
||||
@ -1486,7 +1559,7 @@ class Propal extends CommonObject
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
dol_syslog(get_class($this)."::set_date", LOG_DEBUG);
|
||||
if ($this->db->query($sql) )
|
||||
@ -1515,7 +1588,7 @@ class Propal extends CommonObject
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$this->fin_validite = $date_fin_validite;
|
||||
@ -1665,7 +1738,7 @@ class Propal extends CommonObject
|
||||
$remise = price2num($remise);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
@ -1699,7 +1772,7 @@ class Propal extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||
$sql.= " SET remise_absolue = ".$remise;
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
@ -1791,7 +1864,6 @@ class Propal extends CommonObject
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->statut = $statut;
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
@ -1807,7 +1879,7 @@ class Propal extends CommonObject
|
||||
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
|
||||
$trigger_name='PROPAL_CLOSE_REFUSED';
|
||||
|
||||
if ($statut == 2)
|
||||
if ($statut == self::STATUS_SIGNED)
|
||||
{
|
||||
$trigger_name='PROPAL_CLOSE_SIGNED';
|
||||
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
|
||||
@ -1819,12 +1891,12 @@ class Propal extends CommonObject
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
if ($statut == 4)
|
||||
if ($statut == self::STATUS_BILLED)
|
||||
{
|
||||
$trigger_name='PROPAL_CLASSIFY_BILLED';
|
||||
}
|
||||
@ -1850,7 +1922,9 @@ class Propal extends CommonObject
|
||||
|
||||
if ( ! $error )
|
||||
{
|
||||
$this->db->commit();
|
||||
$this->statut = $statut;
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -1861,7 +1935,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1874,11 +1948,11 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function classifyBilled()
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = 4';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$this->statut=4;
|
||||
$this->statut=self::STATUS_BILLED;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -1906,12 +1980,12 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_draft($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->statut = 0;
|
||||
$this->statut = self::STATUS_DRAFT;
|
||||
$this->brouillon = 1;
|
||||
return 1;
|
||||
}
|
||||
@ -1955,7 +2029,7 @@ class Propal extends CommonObject
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
if ($draft) $sql.= " AND p.fk_statut = 0";
|
||||
if ($draft) $sql.= " AND p.fk_statut = ".self::STATUS_DRAFT;
|
||||
if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id;
|
||||
$sql.= $this->db->order($sortfield,$sortorder);
|
||||
$sql.= $this->db->plimit($limit,$offset);
|
||||
@ -2225,7 +2299,7 @@ class Propal extends CommonObject
|
||||
function availability($availability_id)
|
||||
{
|
||||
dol_syslog('Propale::availability('.$availability_id.')');
|
||||
if ($this->statut >= 0)
|
||||
if ($this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
||||
$sql .= ' SET fk_availability = '.$availability_id;
|
||||
@ -2259,7 +2333,7 @@ class Propal extends CommonObject
|
||||
function demand_reason($demand_reason_id)
|
||||
{
|
||||
dol_syslog('Propale::demand_reason('.$demand_reason_id.')');
|
||||
if ($this->statut >= 0)
|
||||
if ($this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
|
||||
$sql .= ' SET fk_input_reason = '.$demand_reason_id;
|
||||
@ -2366,11 +2440,11 @@ class Propal extends CommonObject
|
||||
global $langs;
|
||||
$langs->load("propal");
|
||||
|
||||
if ($statut==0) $statuttrans='statut0';
|
||||
if ($statut==1) $statuttrans='statut1';
|
||||
if ($statut==2) $statuttrans='statut3';
|
||||
if ($statut==3) $statuttrans='statut5';
|
||||
if ($statut==4) $statuttrans='statut6';
|
||||
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
|
||||
if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
|
||||
if ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
|
||||
if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5';
|
||||
if ($statut==self::STATUS_BILLED) $statuttrans='statut6';
|
||||
|
||||
if ($mode == 0) return $this->labelstatut[$statut];
|
||||
if ($mode == 1) return $this->labelstatut_short[$statut];
|
||||
@ -2403,8 +2477,8 @@ class Propal extends CommonObject
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql.= $clause." p.entity = ".$conf->entity;
|
||||
if ($mode == 'opened') $sql.= " AND p.fk_statut = 1";
|
||||
if ($mode == 'signed') $sql.= " AND p.fk_statut = 2";
|
||||
if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED;
|
||||
if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED;
|
||||
if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -2415,12 +2489,12 @@ class Propal extends CommonObject
|
||||
|
||||
if ($mode == 'opened') {
|
||||
$delay_warning=$conf->propal->cloture->warning_delay;
|
||||
$statut = 1;
|
||||
$statut = self::STATUS_VALIDATED;
|
||||
$label = $langs->trans("PropalsToClose");
|
||||
}
|
||||
if ($mode == 'signed') {
|
||||
$delay_warning=$conf->propal->facturation->warning_delay;
|
||||
$statut = 2;
|
||||
$statut = self::STATUS_SIGNED;
|
||||
$label = $langs->trans("PropalsToBill");
|
||||
}
|
||||
|
||||
@ -2806,7 +2880,22 @@ class Propal extends CommonObject
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'propal'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2827,7 +2916,14 @@ class PropaleLigne extends CommonObjectLine
|
||||
var $fk_parent_line;
|
||||
var $desc; // Description ligne
|
||||
var $fk_product; // Id produit predefini
|
||||
var $product_type = 0; // Type 0 = product, 1 = Service
|
||||
/**
|
||||
* Product type.
|
||||
* Use the following constants:
|
||||
* - Product::TYPE_PRODUCT
|
||||
* - Product::TYPE_SERVICE
|
||||
* @var int
|
||||
*/
|
||||
var $product_type = Product::TYPE_PRODUCT;
|
||||
|
||||
var $qty;
|
||||
var $tva_tx;
|
||||
|
||||
@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($object->fin_validite)
|
||||
{
|
||||
print dol_print_date($object->fin_validite,'daytext');
|
||||
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -201,7 +201,7 @@ if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
$sql.= " AND s.client IN (2, 3)";
|
||||
|
||||
@ -1125,7 +1125,7 @@ if (empty($reshook))
|
||||
if (! $error)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
$parameters = array('id' => $object->id);
|
||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -2404,6 +2404,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'order_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['orderid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
|
||||
@ -53,8 +53,17 @@ class Commande extends CommonOrder
|
||||
|
||||
var $id;
|
||||
|
||||
var $socid; // Id client
|
||||
var $client; // Objet societe client (a charger par fetch_client)
|
||||
/**
|
||||
* Client ID
|
||||
* @var int
|
||||
*/
|
||||
var $socid;
|
||||
|
||||
/**
|
||||
* Client (loaded by fetch_client)
|
||||
* @var Societe
|
||||
*/
|
||||
var $client;
|
||||
|
||||
var $ref;
|
||||
var $ref_client;
|
||||
@ -71,31 +80,13 @@ class Commande extends CommonOrder
|
||||
* - STATUS_CLOSED
|
||||
* @var int
|
||||
*/
|
||||
var $statut; // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Delivered=Sent/Received, billed or not)
|
||||
var $statut;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
var $facturee; // deprecated
|
||||
var $billed; // billed or not
|
||||
|
||||
/**
|
||||
* Canceled status
|
||||
*/
|
||||
const STATUS_CANCELED = -1;
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
/**
|
||||
* Validated status
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Accepted/On process not managed for customer orders
|
||||
*/
|
||||
const STATUS_ACCEPTED = 2;
|
||||
/**
|
||||
* Closed (Sent/Received, billed or not)
|
||||
*/
|
||||
const STATUS_CLOSED = 3;
|
||||
|
||||
var $brouillon;
|
||||
var $cond_reglement_id;
|
||||
var $cond_reglement_code;
|
||||
@ -155,6 +146,27 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
|
||||
|
||||
/**
|
||||
* Canceled status
|
||||
*/
|
||||
const STATUS_CANCELED = -1;
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
/**
|
||||
* Validated status
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Accepted/On process not managed for customer orders
|
||||
*/
|
||||
const STATUS_ACCEPTED = 2;
|
||||
/**
|
||||
* Closed (Sent/Received, billed or not)
|
||||
*/
|
||||
const STATUS_CLOSED = 3;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -792,7 +804,7 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->fk_unit
|
||||
);
|
||||
if ($result < 0)
|
||||
@ -865,28 +877,25 @@ class Commande extends CommonOrder
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$action='create';
|
||||
//$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
/*$hookmanager->initHooks(array('orderdao'));
|
||||
$parameters=array('socid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
{*/
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($result < 0) $error++;
|
||||
/* }
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
else if ($reshook < 0) $error++;*/
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_CREATE',$user);
|
||||
@ -894,29 +903,27 @@ class Commande extends CommonOrder
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
@ -2668,7 +2675,7 @@ class Commande extends CommonOrder
|
||||
$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -3299,6 +3306,23 @@ class Commande extends CommonOrder
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'commande'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -403,7 +403,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||
if ($nbcategories)
|
||||
{
|
||||
print '<br>'.$langs->trans("Category").': <select class="flat" name="cat1">'.$options.'</select>';
|
||||
print '<br>'.$langs->trans("Rubrique").': <select class="flat" name="cat1">'.$options.'</select>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align=right><input name="debit" class="flat" type="text" size="4" value="'.GETPOST("debit").'"></td>';
|
||||
|
||||
@ -781,8 +781,8 @@ class Account extends CommonObject
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
return -1;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -186,7 +186,7 @@ if (! $found)
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -253,7 +253,7 @@ if (! $found)
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -379,7 +379,7 @@ else
|
||||
elseif ($links[$key]['type']=='payment_supplier')
|
||||
{
|
||||
$paymentsupplierstatic->id=$links[$key]['url_id'];
|
||||
$paymentsupplierstatic->ref=$langs->trans("Payment");;
|
||||
$paymentsupplierstatic->ref=$langs->trans("Payment");
|
||||
print ' '.$paymentsupplierstatic->getNomUrl(1);
|
||||
$newline=0;
|
||||
}
|
||||
|
||||
@ -178,9 +178,10 @@ if ($resql)
|
||||
print '<form method="post" action="search.php" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
|
||||
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
|
||||
$moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
|
||||
|
||||
if ($moreforfilter) {
|
||||
|
||||
@ -329,8 +329,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
// Solde actuel
|
||||
$var=!$var;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").'</td>';
|
||||
print '<td align="right" nowrap>'.price($solde).'</td>';
|
||||
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')</td>';
|
||||
print '<td align="right" nowrap>'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -79,7 +79,7 @@ if ($action == 'add')
|
||||
$accountto=new Account($db);
|
||||
$accountto->fetch(GETPOST('account_to','int'));
|
||||
|
||||
if ($accountto->id != $accountfrom->id)
|
||||
if (($accountto->id != $accountfrom->id) && ($accountto->currency_code == $accountfrom->currency_code))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
@ -5,13 +5,15 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -1077,7 +1079,11 @@ if (empty($reshook))
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$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, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
|
||||
// View third's localtaxes for now
|
||||
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client);
|
||||
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client);
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$lineid = $result;
|
||||
@ -1817,7 +1823,7 @@ if (empty($reshook))
|
||||
|
||||
if (! $error) {
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('invoicedao'));
|
||||
$parameters = array('id' => $object->id);
|
||||
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -1972,12 +1978,12 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
$outstandingBills = $soc->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
print ')';
|
||||
@ -2366,15 +2372,25 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
|
||||
$newclassname = $classname;
|
||||
if ($newclassname == 'Propal')
|
||||
$newclassname = 'CommercialProposal';
|
||||
elseif ($newclassname == 'Commande')
|
||||
$newclassname = 'Order';
|
||||
elseif ($newclassname == 'Expedition')
|
||||
$newclassname = 'Sending';
|
||||
elseif ($newclassname == 'Fichinter')
|
||||
$newclassname = 'Intervention';
|
||||
switch ($classname) {
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
break;
|
||||
case 'Commande':
|
||||
$newclassname = 'Order';
|
||||
break;
|
||||
case 'Expedition':
|
||||
$newclassname = 'Sending';
|
||||
break;
|
||||
case 'Contrat':
|
||||
$newclassname = 'Contract';
|
||||
break;
|
||||
case 'Fichinter':
|
||||
$newclassname = 'Intervention';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
|
||||
//We check if Origin document has already an invoice attached to it
|
||||
@ -2828,11 +2844,11 @@ if ($action == 'create')
|
||||
print ' ';
|
||||
print '(<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?socid=' . $object->socid . '">' . $langs->trans('OtherBills') . '</a>';
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
$outstandingBills = $soc->get_OutstandingBill();
|
||||
print ' - ' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '') {
|
||||
if ($outstandigBills > $soc->outstanding_limit)
|
||||
if ($outstandingBills > $soc->outstanding_limit)
|
||||
print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit);
|
||||
}
|
||||
@ -3729,6 +3745,10 @@ if ($action == 'create')
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action != 'prerelance' && $action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
@ -3949,6 +3969,7 @@ if ($action == 'create')
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -599,5 +600,21 @@ class FactureRec extends Facture
|
||||
|
||||
$this->usenewprice = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'facture_rec'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ class Facture extends CommonInvoice
|
||||
var $specimen;
|
||||
|
||||
var $fac_rec;
|
||||
|
||||
|
||||
//Incoterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
@ -563,7 +563,7 @@ class Facture extends CommonInvoice
|
||||
$action='create';
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('invoicedao'));
|
||||
$parameters=array('invoiceid'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -1045,9 +1045,9 @@ class Facture extends CommonInvoice
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
@ -3618,7 +3618,7 @@ class Facture extends CommonInvoice
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::update Error setFinal " . $sql, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
@ -3641,12 +3641,29 @@ class Facture extends CommonInvoice
|
||||
$last = $res['max(situation_counter)'];
|
||||
return ($last == $this->situation_counter);
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'facture'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -24,17 +24,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/facture/impayees.php
|
||||
* \file htdocs/compta/facture/mergepdftool.php
|
||||
* \ingroup facture
|
||||
* \brief Page to list and build liste of unpaid invoices
|
||||
* \brief Page to list and build doc of selected invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.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.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("mails");
|
||||
$langs->load("bills");
|
||||
@ -44,6 +46,18 @@ $action = GETPOST('action','alpha');
|
||||
$option = GETPOST('option');
|
||||
$mode=GETPOST('mode');
|
||||
$builddoc_generatebutton=GETPOST('builddoc_generatebutton');
|
||||
$month = GETPOST("month","int");
|
||||
$year = GETPOST("year","int");
|
||||
$filter = GETPOST("filtre");
|
||||
if (GETPOST('button_search'))
|
||||
{
|
||||
$filter=GETPOST('filtre',2);
|
||||
if ($filter != 'payed:0') $option='';
|
||||
}
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
if ($option == 'unpaidall') $filter = 'paye:0';
|
||||
if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0';
|
||||
if ($filter == '') $filter = 'paye:0';
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
@ -54,6 +68,20 @@ if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'
|
||||
|
||||
$resultmasssend='';
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_ref_supplier="";
|
||||
$search_label="";
|
||||
$search_company="";
|
||||
$search_amount_no_tax="";
|
||||
$search_amount_all_tax="";
|
||||
$year="";
|
||||
$month="";
|
||||
$filter="";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -297,8 +325,14 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
|
||||
dol_mkdir($diroutputpdf);
|
||||
|
||||
// Save merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
|
||||
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
if ($pagecount)
|
||||
{
|
||||
$now=dol_now();
|
||||
@ -306,6 +340,9 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessage($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -340,9 +377,9 @@ if ($action == 'remove_file')
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
$title=$langs->trans("BillsCustomersUnpaid");
|
||||
if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
|
||||
$title=$langs->trans("MergingPDFTool");
|
||||
|
||||
llxHeader('',$title);
|
||||
|
||||
@ -410,14 +447,15 @@ $sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.type IN (0,1,3,5) AND f.fk_statut = 1";
|
||||
$sql.= " AND f.paye = 0";
|
||||
$sql.= " AND f.type IN (0,1,3,5)";
|
||||
if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1";
|
||||
//$sql.= " AND f.paye = 0";
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
|
||||
if (GETPOST('filtre'))
|
||||
if ($filter && $filter != -1) // GETPOST('filtre') may be a string
|
||||
{
|
||||
$filtrearr = explode(",", GETPOST('filtre'));
|
||||
$filtrearr = explode(",", $filter);
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = explode(":", $fil);
|
||||
@ -427,10 +465,21 @@ if (GETPOST('filtre'))
|
||||
if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$db->escape($search_ref)."%'";
|
||||
if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'";
|
||||
if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
|
||||
if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
||||
if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
|
||||
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0)
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '$month'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,";
|
||||
$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
@ -438,7 +487,7 @@ $sql.= " ORDER BY ";
|
||||
$listfield=explode(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
$sql.= " f.facnumber DESC";
|
||||
|
||||
//print $sql;
|
||||
//$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -454,30 +503,36 @@ if ($resql)
|
||||
|
||||
$param="";
|
||||
$param.=(! empty($socid)?"&socid=".$socid:"");
|
||||
$param.=(! empty($option)?"&option=".$option:"");
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer);
|
||||
if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer);
|
||||
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($late) $param.='&late='.urlencode($late);
|
||||
|
||||
if ($mode) $param.='&mode='.urlencode($mode);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid"));
|
||||
//$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid"));
|
||||
$titre=(! empty($socid)?$langs->trans("BillsCustomersForCompany",$soc->name):$langs->trans("BillsCustomers"));
|
||||
if ($option == 'late') $titre.=' ('.$langs->trans("Late").')';
|
||||
else $titre.=' ('.$langs->trans("All").')';
|
||||
//else $titre.=' ('.$langs->trans("All").')';
|
||||
|
||||
$link='';
|
||||
if (empty($option)) $link='<a href="'.$_SERVER["PHP_SELF"].'?option=late">'.$langs->trans("ShowUnpaidLateOnly").'</a>';
|
||||
elseif ($option == 'late') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("ShowUnpaidAll").'</a>';
|
||||
if (empty($option) || $option == 'late') $link.=($link?' - ':'').'<a href="'.$_SERVER["PHP_SELF"].'?option=unpaidall'.$param.'">'.$langs->trans("ShowUnpaidAll").'</a>';
|
||||
if (empty($option) || $option == 'unpaidall') $link.=($link?' - ':'').'<a href="'.$_SERVER["PHP_SELF"].'?option=late'.$param.'">'.$langs->trans("ShowUnpaidLateOnly").'</a>';
|
||||
|
||||
$param.=(! empty($option)?"&option=".$option:"");
|
||||
|
||||
print_fiche_titre($titre,$link);
|
||||
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
|
||||
|
||||
print '<form id="form_unpaid" method="POST" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $sortfield .'&sortorder='. $sortorder .'">';
|
||||
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if (! empty($mode) && $action == 'presend')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
@ -520,6 +575,7 @@ if ($resql)
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
@ -574,7 +630,11 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear?$syear:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
@ -586,21 +646,22 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid"));
|
||||
print $form->selectarray('filtre', $liststatus, $filter, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '<br>';
|
||||
if (empty($mode))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkallsend">'.$langs->trans("All").'</a> / <a href="#" id="checknonesend">'.$langs->trans("None").'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 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
|
||||
@ -321,7 +322,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
|
||||
$sql.= " ORDER BY f.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -426,7 +427,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid, s.code_fournisseur";
|
||||
$sql.= " ORDER BY ff.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -658,7 +659,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
$sql.= " AND c.fk_statut = 3";
|
||||
$sql.= " AND c.facture = 0";
|
||||
$sql.= " GROUP BY s.nom, s.rowid, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc";
|
||||
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
@ -762,7 +763,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
|
||||
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -876,8 +877,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -109,13 +109,21 @@ class Localtax extends CommonObject
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
//FIXME: Add rollback if trigger fail
|
||||
|
||||
return $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -141,7 +149,9 @@ class Localtax extends CommonObject
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Update request
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
|
||||
$sql.= " localtaxtype=".$this->ltt.",";
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
@ -160,20 +170,27 @@ class Localtax extends CommonObject
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LOCALTAX_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
//FIXME: Add rollback if trigger fail
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -70,9 +70,10 @@ class Paiement extends CommonObject
|
||||
* Load payment from database
|
||||
*
|
||||
* @param int $id Id of payment to get
|
||||
* @param int $ref Ref of payment to get (same as $id)
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
|
||||
@ -81,7 +82,10 @@ class Paiement extends CommonObject
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
|
||||
$sql.= ' WHERE p.fk_paiement = c.id';
|
||||
$sql.= ' AND p.rowid = '.$id;
|
||||
if ($ref)
|
||||
$sql.= ' AND p.rowid = '.$ref;
|
||||
else
|
||||
$sql.= ' AND p.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -61,7 +62,7 @@ class LignePrelevement
|
||||
* Recupere l'objet prelevement
|
||||
*
|
||||
* @param int $rowid id de la facture a recuperer
|
||||
* @return void|int
|
||||
* @return integer
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
@ -156,5 +157,22 @@ class LignePrelevement
|
||||
if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'prelevement_lignes'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +95,8 @@ class PaymentSalary extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||
|
||||
@ -129,11 +131,18 @@ class PaymentSalary extends CommonObject
|
||||
$result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
//FIXME: Add rollback if trigger fail
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ $form = new Form($db);
|
||||
$salstatic = new PaymentSalary($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_societe as fk_soc,";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,";
|
||||
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
|
||||
@ -88,8 +88,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
|
||||
if ($object->id)
|
||||
{
|
||||
$alreadypayed=$object->getSommePaiement();
|
||||
|
||||
$head=tax_prepare_head($object, $user);
|
||||
|
||||
$head=tax_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if ($selected_cat === -2) // Without any category
|
||||
{
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe";
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
|
||||
}
|
||||
else if ($selected_cat) // Into a specific category
|
||||
{
|
||||
@ -201,13 +201,13 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
}
|
||||
if ($selected_cat === -2) // Without any category
|
||||
{
|
||||
$sql.=" AND cs.fk_societe is null";
|
||||
$sql.=" AND cs.fk_soc is null";
|
||||
}
|
||||
else if ($selected_cat) { // Into a specific category
|
||||
$sql.= " AND (c.rowid = ".$selected_cat;
|
||||
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
|
||||
$sql.= ")";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@ -221,7 +221,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if ($selected_cat === -2) // Without any category
|
||||
{
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe";
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc";
|
||||
}
|
||||
else if ($selected_cat) // Into a specific category
|
||||
{
|
||||
@ -235,13 +235,13 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
}
|
||||
if ($selected_cat === -2) // Without any category
|
||||
{
|
||||
$sql.=" AND cs.fk_societe is null";
|
||||
$sql.=" AND cs.fk_soc is null";
|
||||
}
|
||||
else if ($selected_cat) { // Into a specific category
|
||||
$sql.= " AND (c.rowid = ".$selected_cat;
|
||||
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat;
|
||||
$sql.= ")";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid";
|
||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
||||
}
|
||||
}
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
|
||||
@ -298,7 +298,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
if ($annee_decalage != $year_end) print '<td width="15"> </td>';
|
||||
}
|
||||
|
||||
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;;
|
||||
$total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;
|
||||
$total[$annee]+=$cum[$case];
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,9 @@ class Tva extends CommonObject
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$this->db->begin();
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
|
||||
$sql.= "tms,";
|
||||
$sql.= "datep,";
|
||||
@ -126,13 +128,22 @@ class Tva extends CommonObject
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
//FIXME: Add rollback if trigger fail
|
||||
return $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +171,9 @@ class Tva extends CommonObject
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$this->db->begin();
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
|
||||
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
@ -181,20 +194,27 @@ class Tva extends CommonObject
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('TVA_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
|
||||
//FIXME: Add rollback if trigger fail
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error,$object->errors,'errors');
|
||||
setEventMessages($object->error,$object->errors,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@ -1084,4 +1085,20 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'socpeople'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ llxHeader("",$langs->trans("Contact"), $helpurl);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$head = contact_prepare_head($object, $user);
|
||||
$head = contact_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Contact"), 0, 'contact');
|
||||
|
||||
|
||||
@ -973,6 +973,8 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">'."\n";
|
||||
print '<input type="hidden" name="remise_percent" value="0">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -1068,7 +1070,9 @@ if ($action == 'create')
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br><div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
|
||||
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
@ -1080,10 +1084,8 @@ if ($action == 'create')
|
||||
print '<br>'.$langs->trans("Note").': '.$langs->trans("OnlyLinesWithTypeServiceAreUsed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
else
|
||||
/* *************************************************************************** */
|
||||
@ -1285,7 +1287,9 @@ else
|
||||
$usemargins=0;
|
||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
||||
|
||||
// Title line for service
|
||||
$var=false;
|
||||
|
||||
// Title line for service
|
||||
$cursorline=1;
|
||||
while ($cursorline <= $nbofservices)
|
||||
{
|
||||
@ -1326,8 +1330,6 @@ else
|
||||
print '<td width="30"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
@ -1355,12 +1357,12 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>".dol_htmlentitiesbr($objp->description)."</td>\n";
|
||||
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n";
|
||||
}
|
||||
// TVA
|
||||
print '<td align="center">'.vatrate($objp->tva_tx,'%',$objp->info_bits).'</td>';
|
||||
// Prix
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
print '<td align="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
|
||||
// Quantite
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
//Unit
|
||||
@ -1368,7 +1370,7 @@ else
|
||||
// Remise
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent."%</td>\n";
|
||||
print '<td align="right" '.$bc[$var].'>'.$objp->remise_percent."%</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1515,7 +1517,7 @@ else
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
print $langs->trans("DateStartPlanned").' ';
|
||||
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
|
||||
print '<br>'.$langs->trans("DateEndPlanned").' ';
|
||||
print ' '.$langs->trans("DateEndPlanned").' ';
|
||||
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
|
||||
print '</td>';
|
||||
|
||||
@ -1539,7 +1541,7 @@ else
|
||||
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
@ -1555,7 +1557,7 @@ else
|
||||
if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == GETPOST('rowid'))
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
|
||||
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1575,7 +1577,7 @@ else
|
||||
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
|
||||
|
||||
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1587,7 +1589,7 @@ else
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment');
|
||||
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1599,7 +1601,7 @@ else
|
||||
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$comment = GETPOST('comment');
|
||||
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
@ -1608,7 +1610,7 @@ else
|
||||
{
|
||||
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
print '<td width="30" align="right">';
|
||||
if ($user->societe_id == 0)
|
||||
@ -1625,7 +1627,7 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>';
|
||||
// Si pas encore active
|
||||
@ -1664,7 +1666,7 @@ else
|
||||
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&ligne='.GETPOST('ligne').'&action=active" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
|
||||
|
||||
// Definie date debut et fin par defaut
|
||||
$dateactstart = $objp->date_debut;
|
||||
@ -1714,7 +1716,7 @@ else
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder tableforservicepart2" width="100%">';
|
||||
|
||||
// Definie date debut et fin par defaut
|
||||
$dateactstart = $objp->date_debut_reelle;
|
||||
|
||||
@ -1136,7 +1136,7 @@ class Contrat extends CommonObject
|
||||
if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
|
||||
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
|
||||
if (isset($this->entity)) $this->entity=trim($this->entity);
|
||||
if (isset($this->statut)) $this->statut=trim($this->statut);
|
||||
if (isset($this->statut)) $this->statut=(int) $this->statut;
|
||||
if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc);
|
||||
if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
|
||||
if (isset($this->fk_commercial_signature)) $this->fk_commercial_signature=trim($this->fk_commercial_signature);
|
||||
@ -2123,6 +2123,23 @@ class Contrat extends CommonObject
|
||||
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @return bool
|
||||
*/
|
||||
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
|
||||
{
|
||||
$tables = array(
|
||||
'contrat'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2430,7 +2447,7 @@ class ContratLigne extends CommonObjectLine
|
||||
// Clean parameters
|
||||
$this->fk_contrat=trim($this->fk_contrat);
|
||||
$this->fk_product=trim($this->fk_product);
|
||||
$this->statut=trim($this->statut);
|
||||
$this->statut=(int) $this->statut;
|
||||
$this->label=trim($this->label);
|
||||
$this->description=trim($this->description);
|
||||
$this->tva_tx=trim($this->tva_tx);
|
||||
@ -2452,7 +2469,12 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->fk_user_ouverture=trim($this->fk_user_ouverture);
|
||||
$this->fk_user_cloture=trim($this->fk_user_cloture);
|
||||
$this->commentaire=trim($this->commentaire);
|
||||
|
||||
//if (empty($this->subprice)) $this->subprice = 0;
|
||||
if (empty($this->price_ht)) $this->price_ht = 0;
|
||||
if (empty($this->total_ht)) $this->total_ht = 0;
|
||||
if (empty($this->total_tva)) $this->total_tva = 0;
|
||||
if (empty($this->total_ttc)) $this->total_ttc = 0;
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
@ -2496,8 +2518,8 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " remise_percent='".$this->remise_percent."',";
|
||||
$sql.= " remise=".($this->remise?"'".$this->remise."'":"null").",";
|
||||
$sql.= " fk_remise_except=".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
|
||||
$sql.= " subprice='".$this->subprice."',";
|
||||
$sql.= " price_ht='".$this->price_ht."',";
|
||||
$sql.= " subprice=".($this->subprice != '' ? $this->subprice : "null").",";
|
||||
$sql.= " price_ht=".($this->price_ht != '' ? $this->price_ht : "null").",";
|
||||
$sql.= " total_ht='".$this->total_ht."',";
|
||||
$sql.= " total_tva='".$this->total_tva."',";
|
||||
$sql.= " total_localtax1='".$this->total_localtax1."',";
|
||||
|
||||
@ -63,7 +63,7 @@ if (! empty($_POST['removedfile']))
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
|
||||
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -80,7 +80,7 @@ class box_activity extends ModeleBoxes
|
||||
$nbofyears=2;
|
||||
|
||||
if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
||||
$textHead = $langs->trans("Activity").' <span class="badge">'.$nbofyears.' '.$langs->trans("DurationYears").'</span>';
|
||||
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofyears*12);
|
||||
$this->info_box_head = array(
|
||||
'text' => $textHead,
|
||||
'limit'=> dol_strlen($textHead),
|
||||
@ -102,7 +102,8 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
if ($refresh)
|
||||
{
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2015 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
|
||||
@ -70,18 +70,6 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
$text = $langs->trans("BoxProductDistribution",$max);
|
||||
$this->info_box_head = array(
|
||||
'text' => $text,
|
||||
'limit'=> dol_strlen($text),
|
||||
'graph'=> 1,
|
||||
'sublink'=>'',
|
||||
'subtext'=>$langs->trans("Filter"),
|
||||
'subpicto'=>'filter.png',
|
||||
'subclass'=>'linkobject',
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
|
||||
$param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
|
||||
@ -110,6 +98,20 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$nowarray=dol_getdate(dol_now(),true);
|
||||
if (empty($year)) $year=$nowarray['year'];
|
||||
|
||||
|
||||
$text = $langs->trans("BoxProductDistribution",$max).' - '.$langs->trans("Year").': '.$year;
|
||||
$this->info_box_head = array(
|
||||
'text' => $text,
|
||||
'limit'=> dol_strlen($text),
|
||||
'graph'=> 1,
|
||||
'sublink'=>'',
|
||||
'subtext'=>$langs->trans("Filter"),
|
||||
'subpicto'=>'filter.png',
|
||||
'subclass'=>'linkobject',
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
|
||||
$nbofgraph=0;
|
||||
if ($showinvoicenb) $nbofgraph++;
|
||||
if ($showpropalnb) $nbofgraph++;
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2012 Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015 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
|
||||
@ -73,7 +74,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||
$sql.= " GROUP BY p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
$sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
|
||||
$sql.= $db->order('p.seuil_stock_alerte', 'DESC');
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -514,8 +514,12 @@ class CMailFile
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
// Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word
|
||||
/**
|
||||
* Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word
|
||||
*
|
||||
* @param string $stringtoencode String to encode
|
||||
* @return string string encoded
|
||||
*/
|
||||
function encodetorfc2822($stringtoencode)
|
||||
{
|
||||
global $conf;
|
||||
@ -639,7 +643,7 @@ class CMailFile
|
||||
/**
|
||||
* Create SMTP headers (mode = 'mail')
|
||||
*
|
||||
* @return smtp headers
|
||||
* @return string headers
|
||||
*/
|
||||
function write_smtpheaders()
|
||||
{
|
||||
@ -690,7 +694,7 @@ class CMailFile
|
||||
*
|
||||
* @param array $filename_list Array of filenames
|
||||
* @param array $mimefilename_list Array of mime types
|
||||
* @return array mime headers
|
||||
* @return string mime headers
|
||||
*/
|
||||
function write_mimeheaders($filename_list, $mimefilename_list)
|
||||
{
|
||||
|
||||
@ -60,6 +60,34 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
const TYPE_SITUATION = 5;
|
||||
|
||||
/**
|
||||
* Draft
|
||||
*/
|
||||
const STATUS_DRAFT = 0;
|
||||
|
||||
/**
|
||||
* Validated (need to be paid)
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
|
||||
/**
|
||||
* Classified paid.
|
||||
* If paid partially, $this->close_code can be:
|
||||
* - CLOSECODE_DISCOUNTVAT
|
||||
* - CLOSECODE_BADDEBT
|
||||
* If paid completelly, this->close_code will be null
|
||||
*/
|
||||
const STATUS_CLOSED = 2;
|
||||
|
||||
/**
|
||||
* Classified abandoned and no payment done.
|
||||
* $this->close_code can be:
|
||||
* - CLOSECODE_BADDEBT
|
||||
* - CLOSECODE_ABANDONED
|
||||
* - CLOSECODE_REPLACED
|
||||
*/
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
/**
|
||||
* Return amount of payments already done
|
||||
*
|
||||
@ -188,7 +216,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
* Return label of object status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
|
||||
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @return string Label
|
||||
*/
|
||||
function getLibStatut($mode=0,$alreadypaid=-1)
|
||||
@ -202,7 +230,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
* @param int $paye Status field paye
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
|
||||
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @param int $type Type facture
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
@ -326,7 +354,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
* Renvoi une date limite de reglement de facture en fonction des
|
||||
* conditions de reglements de la facture et date de facturation
|
||||
*
|
||||
* @param string $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
|
||||
* @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition.
|
||||
* @return date Date limite de reglement si ok, <0 si ko
|
||||
*/
|
||||
function calculate_date_lim_reglement($cond_reglement=0)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
@ -1612,7 +1612,7 @@ abstract class CommonObject
|
||||
}
|
||||
if (! in_array($suffix,array('','_public','_private')))
|
||||
{
|
||||
dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -1888,10 +1888,11 @@ abstract class CommonObject
|
||||
* @param int $targetid Object target id
|
||||
* @param string $targettype Object target type
|
||||
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
|
||||
* @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type.
|
||||
* @return void
|
||||
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
|
||||
*/
|
||||
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
|
||||
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1925,7 +1926,7 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Links beetween objects are stored in this table
|
||||
// Links between objects are stored in table element_element
|
||||
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
|
||||
$sql.= " WHERE ";
|
||||
@ -1984,7 +1985,7 @@ abstract class CommonObject
|
||||
|
||||
$classpath = $element.'/class';
|
||||
|
||||
// To work with non standard path
|
||||
// To work with non standard classpath or module name
|
||||
if ($objecttype == 'facture') {
|
||||
$classpath = 'compta/facture/class';
|
||||
}
|
||||
@ -2020,7 +2021,7 @@ abstract class CommonObject
|
||||
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
|
||||
}
|
||||
|
||||
if ($conf->$module->enabled && $element != $this->element)
|
||||
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||
{
|
||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||
|
||||
@ -3225,7 +3226,7 @@ abstract class CommonObject
|
||||
|
||||
$marginInfo = $this->getMarginInfos($force_price);
|
||||
|
||||
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // FIXME Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
|
||||
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
|
||||
{
|
||||
print $langs->trans('ShowMarginInfos').' : ';
|
||||
$hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW'];
|
||||
@ -3360,25 +3361,26 @@ abstract class CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||
$sql.= " WHERE rowid =".$rowid;
|
||||
$sql.= " WHERE rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $notrigger)
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
|
||||
if ($result < 0) { $this->db->rollback(); return -1; }
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3905,5 +3907,27 @@ abstract class CommonObject
|
||||
return $user->rights->{$this->element};
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to replace a thirdparty id with another one.
|
||||
* This function is meant to be called from replaceThirdparty with the appropiate tables
|
||||
* Column name fk_soc MUST be used to identify thirdparties
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $origin_id Old thirdparty id
|
||||
* @param int $dest_id New thirdparty id
|
||||
* @param array $tables Tables that need to be changed
|
||||
* @return bool
|
||||
*/
|
||||
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)
|
||||
{
|
||||
foreach ($tables as $table) {
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
|
||||
|
||||
if (!$db->query($sql)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ class DolGraph
|
||||
* Set Y precision
|
||||
*
|
||||
* @param float $which_prec Precision
|
||||
* @return string
|
||||
* @return boolean
|
||||
*/
|
||||
function SetPrecisionY($which_prec)
|
||||
{
|
||||
@ -187,7 +187,7 @@ class DolGraph
|
||||
* Set y label
|
||||
*
|
||||
* @param string $label Y label
|
||||
* @return boolean True
|
||||
* @return boolean|null True
|
||||
*/
|
||||
function SetYLabel($label)
|
||||
{
|
||||
@ -198,7 +198,7 @@ class DolGraph
|
||||
* Set width
|
||||
*
|
||||
* @param int $w Width
|
||||
* @return boolean True
|
||||
* @return boolean|null True
|
||||
*/
|
||||
function SetWidth($w)
|
||||
{
|
||||
@ -554,7 +554,7 @@ class DolGraph
|
||||
/**
|
||||
* Return min value of all data
|
||||
*
|
||||
* @return int Max value of all data
|
||||
* @return double Max value of all data
|
||||
*/
|
||||
function GetFloorMinValue()
|
||||
{
|
||||
@ -578,7 +578,7 @@ class DolGraph
|
||||
*
|
||||
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
|
||||
* @param string $fileurl Url path to show image if saved onto disk
|
||||
* @return void
|
||||
* @return integer|null
|
||||
*/
|
||||
function draw($file,$fileurl='')
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/dolprintipp.class.php
|
||||
* \brief A set of functions for using printIPP
|
||||
* \brief List jobs printed with driver printipp
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -57,78 +57,6 @@ class dolprintIPP
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
function getlist_available_printers()
|
||||
{
|
||||
global $conf,$db;
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
$ipp->getPrinters();
|
||||
return $ipp->available_printers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
*
|
||||
* @return string '' if OK, Error message if KO
|
||||
*/
|
||||
function print_file($file, $module)
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setJobName($file,true);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = 'SELECT rowid,printer_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"';
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$ipp->setPrinterURI($obj->printer_uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->PRINTIPP_URI_DEFAULT))
|
||||
{
|
||||
$ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'NoDefaultPrinterDefined';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set number of copy
|
||||
$ipp->setCopies($obj->copy);
|
||||
$ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file);
|
||||
$ipp->printJob();
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* List jobs print
|
||||
*
|
||||
@ -191,25 +119,4 @@ class dolprintIPP
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get printer detail
|
||||
*
|
||||
* @param string $uri URI
|
||||
* @return array List of attributes
|
||||
*/
|
||||
function get_printer_detail($uri)
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
$ipp->setPrinterURI($uri);
|
||||
$ipp->getPrinterAttributes();
|
||||
return $ipp->printer_attributes;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
|
||||
/**
|
||||
* Events class
|
||||
* Initialy built by build_class_from_table on 2008-02-28 17:25
|
||||
*/
|
||||
class Events // extends CommonObject
|
||||
{
|
||||
@ -41,6 +40,8 @@ class Events // extends CommonObject
|
||||
var $id;
|
||||
var $db;
|
||||
|
||||
var $error;
|
||||
|
||||
var $tms;
|
||||
var $type;
|
||||
var $entity;
|
||||
|
||||
@ -568,11 +568,11 @@ class ExtraFields
|
||||
global $conf;
|
||||
|
||||
if ( empty($elementtype) ) return array();
|
||||
|
||||
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
|
||||
$array_name_label=array();
|
||||
|
||||
|
||||
// For avoid conflicts with external modules
|
||||
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
||||
|
||||
@ -602,7 +602,7 @@ class ExtraFields
|
||||
$this->attribute_elementtype[$tab->name]=$tab->elementtype;
|
||||
$this->attribute_unique[$tab->name]=$tab->fieldunique;
|
||||
$this->attribute_required[$tab->name]=$tab->fieldrequired;
|
||||
$this->attribute_param[$tab->name]=unserialize($tab->param);
|
||||
$this->attribute_param[$tab->name]=($tab->param ? unserialize($tab->param) : '');
|
||||
$this->attribute_pos[$tab->name]=$tab->pos;
|
||||
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||
@ -1056,7 +1056,7 @@ class ExtraFields
|
||||
elseif ($type == 'link')
|
||||
{
|
||||
$out='';
|
||||
|
||||
|
||||
$param_list=array_keys($param['options']);
|
||||
// 0 : ObjectName
|
||||
// 1 : classPath
|
||||
|
||||
@ -192,7 +192,7 @@ class HookManager
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error)?'':" ".$this->error).(empty($this->errors)?'':" ".join(",",$this->errors)), LOG_ERR);
|
||||
}
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
}
|
||||
// Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||
|
||||
@ -868,7 +868,7 @@ class Form
|
||||
*
|
||||
* @param string $selected Preselected type
|
||||
* @param string $htmlname Name of field in form
|
||||
* @param string $filter optional filters criteras (example: 's.rowid <> x')
|
||||
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)')
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
@ -1306,7 +1306,7 @@ class Form
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
}
|
||||
}
|
||||
if (! empty($user->societe_id)) $sql.= " AND u.fk_societe = ".$user->societe_id;
|
||||
if (! empty($user->societe_id)) $sql.= " AND u.fk_soc = ".$user->societe_id;
|
||||
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')";
|
||||
if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')";
|
||||
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut <> 0";
|
||||
@ -1529,7 +1529,7 @@ class Form
|
||||
print img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
}
|
||||
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' autofocus />';
|
||||
if ($hidelabel == 3) {
|
||||
print img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
@ -1646,7 +1646,7 @@ class Form
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'" autofocus>';
|
||||
$out.='<option value="0" selected="selected"> </option>';
|
||||
|
||||
$i = 0;
|
||||
@ -2919,7 +2919,7 @@ class Form
|
||||
{
|
||||
print '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
print $obj->label;
|
||||
print trim($obj->label);
|
||||
if ($statut == 2 && $obj->status == 1) print ' ('.$langs->trans("Closed").')';
|
||||
print '</option>';
|
||||
$i++;
|
||||
@ -2978,10 +2978,11 @@ class Form
|
||||
* @param string $htmlname HTML field name
|
||||
* @param int $maxlength Maximum length for labels
|
||||
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @return string
|
||||
* @see select_categories
|
||||
*/
|
||||
function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0)
|
||||
function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("categories");
|
||||
@ -2990,6 +2991,7 @@ class Form
|
||||
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
|
||||
|
||||
$output = '<select class="flat" name="'.$htmlname.'">';
|
||||
$outarray=array();
|
||||
if (is_array($cate_arbo))
|
||||
{
|
||||
if (! count($cate_arbo)) $output.= '<option value="-1" disabled="disabled">'.$langs->trans("NoCategoriesDefined").'</option>';
|
||||
@ -3007,12 +3009,16 @@ class Form
|
||||
$add = '';
|
||||
}
|
||||
$output.= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'],$maxlength,'middle').'</option>';
|
||||
|
||||
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$output.= '</select>';
|
||||
$output.= "\n";
|
||||
return $output;
|
||||
|
||||
if ($outputmode) return $outarray;
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
|
||||
* $formmail->proprietes=1 ou chaine ou tableau de valeurs
|
||||
* $formmail->show_form() affiche le formulaire
|
||||
*/
|
||||
class FormMail
|
||||
class FormMail extends Form
|
||||
{
|
||||
var $db;
|
||||
|
||||
@ -71,6 +71,8 @@ class FormMail
|
||||
|
||||
var $error;
|
||||
|
||||
public $lines_model;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -242,7 +244,7 @@ class FormMail
|
||||
else
|
||||
{
|
||||
$out='';
|
||||
|
||||
|
||||
// Define list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
@ -263,8 +265,11 @@ class FormMail
|
||||
}
|
||||
|
||||
// Get message template
|
||||
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs);
|
||||
|
||||
$model_id=0;
|
||||
if (array_key_exists('models_id',$this->param)) {
|
||||
$model_id=$this->param["models_id"];
|
||||
}
|
||||
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
|
||||
|
||||
$out.= "\n<!-- Debut form mail -->\n";
|
||||
if ($this->withform == 1)
|
||||
@ -277,6 +282,28 @@ class FormMail
|
||||
{
|
||||
$out.= '<input type="hidden" id="'.$key.'" name="'.$key.'" value="'.$value.'" />'."\n";
|
||||
}
|
||||
|
||||
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
|
||||
if ($result<0) {
|
||||
setEventMessage($this->error,'errors');
|
||||
}
|
||||
$modelmail_array=array();
|
||||
foreach($this->lines_model as $line) {
|
||||
$modelmail_array[$line->id]=$line->label;
|
||||
}
|
||||
|
||||
if (count($modelmail_array)>0) {
|
||||
$out.= '<table class="nobordernopadding" width="100%"><tr><td width="20%">'."\n";
|
||||
$out.= $langs->trans('SelectMailModel').':'.$this->selectarray('modelmailselected', $modelmail_array,$model_id);
|
||||
$out.= '</td>';
|
||||
$out.= '<td width="5px">';
|
||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
$out.= '</td>';
|
||||
$out.= '<td><input class="flat" type="submit" value="'.$langs->trans('Valid').'" name="modelselected" id="modelselected"></td>';
|
||||
$out.= '</tr></table>';
|
||||
}
|
||||
|
||||
|
||||
$out.= '<table class="border" width="100%">'."\n";
|
||||
|
||||
// Substitution array
|
||||
@ -617,8 +644,8 @@ class FormMail
|
||||
$defaultmessage = dol_nl2br($defaultmessage);
|
||||
}
|
||||
|
||||
|
||||
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||
|
||||
if (isset($_POST["message"]) && ! $_POST['modelselected']) $defaultmessage=$_POST["message"];
|
||||
else
|
||||
{
|
||||
$defaultmessage=make_substitutions($defaultmessage,$this->substit);
|
||||
@ -690,9 +717,10 @@ class FormMail
|
||||
* @param string $type_template Get message for key module
|
||||
* @param string $user Use template public or limited to this user
|
||||
* @param Translate $outputlangs Output lang object
|
||||
* @param int $id Id template to find
|
||||
* @return array array('topic'=>,'content'=>,..)
|
||||
*/
|
||||
private function getEMailTemplate($db, $type_template, $user, $outputlangs)
|
||||
private function getEMailTemplate($db, $type_template, $user, $outputlangs,$id=0)
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
@ -702,6 +730,7 @@ class FormMail
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
if (!empty($id)) $sql.= " AND rowid=".$id;
|
||||
$sql.= $db->order("lang,label","ASC");
|
||||
//print $sql;
|
||||
|
||||
@ -745,5 +774,98 @@ class FormMail
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find if template exists
|
||||
* Search into table c_email_templates
|
||||
*
|
||||
* @param string $type_template Get message for key module
|
||||
* @param string $user Use template public or limited to this user
|
||||
* @param Translate $outputlangs Output lang object
|
||||
* @return int <0 if KO,
|
||||
*/
|
||||
public function isEMailTemplate($type_template, $user, $outputlangs)
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT label, topic, content, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
$sql.= $this->db->order("lang,label","ASC");
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num= $this->db->num_rows($resql);
|
||||
$this->db->free($resql);
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=get_class($this).' '.__METHOD__.' ERROR:'.$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find if template exists
|
||||
* Search into table c_email_templates
|
||||
*
|
||||
* @param string $type_template Get message for key module
|
||||
* @param string $user Use template public or limited to this user
|
||||
* @param Translate $outputlangs Output lang object
|
||||
* @return int <0 if KO,
|
||||
*/
|
||||
public function fetchAllEMailTemplate($type_template, $user, $outputlangs)
|
||||
{
|
||||
$ret=array();
|
||||
|
||||
$sql = "SELECT rowid, label, topic, content, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity("c_email_templates").")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
$sql.= $this->db->order("lang,label","ASC");
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->lines_model=array();
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$line = new ModelMail();
|
||||
$line->id=$obj->rowid;
|
||||
$line->label=$obj->label;
|
||||
$line->topic=$obj->topic;
|
||||
$line->content=$obj->lacontentbel;
|
||||
$line->lang=$obj->lang;
|
||||
$this->lines_model[]=$line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=get_class($this).' '.__METHOD__.' ERROR:'.$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ModelMail
|
||||
*/
|
||||
class ModelMail
|
||||
{
|
||||
public $id;
|
||||
public $label;
|
||||
public $topic;
|
||||
public $content;
|
||||
public $lang;
|
||||
}
|
||||
|
||||
@ -374,9 +374,13 @@ class FormOther
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
|
||||
$comboenhancement = ajax_combobox($htmlname);
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
if ($comboenhancement)
|
||||
{
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
}
|
||||
// Select each sales and print them in a select input
|
||||
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
||||
@ -387,7 +391,7 @@ class FormOther
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
|
||||
if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_societe = ".$user->societe_id;
|
||||
if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id;
|
||||
// Add existing sales representatives of thirdparty of external user
|
||||
if (empty($user->rights->user->user->lire) && $user->societe_id)
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ class InfoBox
|
||||
/**
|
||||
* Name of positions 0=Home, 1=...
|
||||
*
|
||||
* @return array Array with list of zones
|
||||
* @return string[] Array with list of zones
|
||||
*/
|
||||
static function getListOfPagesForBoxes()
|
||||
{
|
||||
|
||||
@ -349,7 +349,7 @@ class Ldap
|
||||
/**
|
||||
* Change ldap protocol version to use.
|
||||
*
|
||||
* @return string version
|
||||
* @return boolean version
|
||||
*/
|
||||
function setVersion() {
|
||||
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
|
||||
@ -360,7 +360,7 @@ class Ldap
|
||||
/**
|
||||
* changement du referrals.
|
||||
*
|
||||
* @return string referrals
|
||||
* @return boolean referrals
|
||||
*/
|
||||
function setReferrals() {
|
||||
// LDAP_OPT_REFERRALS est une constante qui vaut ?
|
||||
@ -1314,7 +1314,7 @@ class Ldap
|
||||
* Convertit le temps ActiveDirectory en Unix timestamp
|
||||
*
|
||||
* @param string $value AD time to convert
|
||||
* @return string Unix timestamp
|
||||
* @return integer Unix timestamp
|
||||
*/
|
||||
function convert_time($value)
|
||||
{
|
||||
|
||||
@ -56,8 +56,8 @@ class Notify
|
||||
|
||||
|
||||
/**
|
||||
* Return message that say how many notification will occurs on requested event.
|
||||
* This is to show confirmation messages before event is done.
|
||||
* Return message that say how many notification (and to which email) will occurs on requested event.
|
||||
* This is to show confirmation messages before event is recorded.
|
||||
*
|
||||
* @param string $action Id of action in llx_c_action_trigger
|
||||
* @param int $socid Id of third party
|
||||
@ -69,10 +69,23 @@ class Notify
|
||||
global $langs;
|
||||
$langs->load("mails");
|
||||
|
||||
$nb=$this->countDefinedNotifications($action,$socid,$object);
|
||||
$listofnotiftodo=$this->getNotificationsArray($action,$socid,$object);
|
||||
$nb=count($listofnotiftodo);
|
||||
if ($nb <= 0) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb);
|
||||
|
||||
$i=0;
|
||||
foreach ($listofnotiftodo as $key => $val)
|
||||
{
|
||||
if ($i) $texte.=', ';
|
||||
else $texte.=' (';
|
||||
if ($val['isemailvalid']) $texte.=$val['email'];
|
||||
else $texte.=$val['emaildesc'];
|
||||
$i++;
|
||||
}
|
||||
if ($i) $texte.=')';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
@ -81,22 +94,22 @@ class Notify
|
||||
*
|
||||
* @param string $notifcode Code of action in llx_c_action_trigger (new usage) or Id of action in llx_c_action_trigger (old usage)
|
||||
* @param int $socid Id of third party or 0 for all thirdparties
|
||||
* @param Object $object Object the notification is about
|
||||
* @return int <0 if KO, nb of notifications sent if OK
|
||||
* @param Object $object Object the notification is about (need it to check threshold value of some notifications)
|
||||
* @return array|int <0 if KO, array of notifications to send if OK
|
||||
*/
|
||||
function countDefinedNotifications($notifcode,$socid,$object=null)
|
||||
function getNotificationsArray($notifcode,$socid,$object=null)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user;
|
||||
|
||||
$error=0;
|
||||
$num=0;
|
||||
$resarray=array();
|
||||
|
||||
$valueforthreshold = 0;
|
||||
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
@ -112,13 +125,23 @@ class Notify
|
||||
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
dol_syslog(get_class($this)."::countDefinedNotifications ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $num = $obj->nb;
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$isvalid=isValidEmail($newval2);
|
||||
$resarray[] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>trim($obj->email), 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -129,7 +152,6 @@ class Notify
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
// List of notifications enabled for fixed email
|
||||
foreach($conf->global as $key => $val)
|
||||
{
|
||||
@ -146,12 +168,33 @@ class Notify
|
||||
if ($valueforthreshold < $threshold) continue;
|
||||
|
||||
$tmpemail=explode(',',$val);
|
||||
$num+=count($tmpemail);
|
||||
foreach($tmpemail as $key2 => $val2)
|
||||
{
|
||||
$newval2=trim($val2);
|
||||
if ($newval2 == '__SUPERVISOREMAIL__')
|
||||
{
|
||||
if ($user->fk_user > 0)
|
||||
{
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($user->fk_user);
|
||||
if ($tmpuser->email) $newval2=$tmpuser->email;
|
||||
else $newval2='';
|
||||
}
|
||||
else $newval2='';
|
||||
}
|
||||
if ($newval2)
|
||||
{
|
||||
$isvalid=isValidEmail($newval2, 0);
|
||||
$resarray[]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>trim($newval2), 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) return -1;
|
||||
return $num;
|
||||
|
||||
//var_dump($resarray);
|
||||
return $resarray;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,7 +31,7 @@ abstract class Stats
|
||||
{
|
||||
protected $db;
|
||||
var $_lastfetchdate=array(); // Dates of cache file read by methods
|
||||
var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
|
||||
var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
|
||||
|
||||
/**
|
||||
* Return nb of elements by month for several years
|
||||
@ -76,7 +76,7 @@ abstract class Stats
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load file into $data
|
||||
if ($foundintocache) // Cache file found and is not too old
|
||||
{
|
||||
@ -203,11 +203,14 @@ abstract class Stats
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
if ($fp)
|
||||
{
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
}
|
||||
else dol_syslog("Failed to write cache file", LOG_ERR);
|
||||
$this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
|
||||
}
|
||||
|
||||
@ -309,21 +312,23 @@ abstract class Stats
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
if ($fp)
|
||||
{
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
}
|
||||
$this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Here we have low level of shared code called by XxxStats.class.php
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of elements by year
|
||||
*
|
||||
@ -532,8 +537,8 @@ abstract class Stats
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return number or total of product refs
|
||||
*
|
||||
@ -544,7 +549,7 @@ abstract class Stats
|
||||
function _getAllByProduct($sql, $limit=10)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
@ -567,6 +572,6 @@ abstract class Stats
|
||||
else dol_print_error($this->db);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,95 +26,95 @@
|
||||
interface Database
|
||||
{
|
||||
/**
|
||||
* Format a SQL IF
|
||||
* Format a SQL IF
|
||||
*
|
||||
* @param string $test Test string (example: 'cd.statut=0', 'field IS NULL')
|
||||
* @param string $resok resultat si test egal
|
||||
* @param string $resko resultat si test non egal
|
||||
* @return string SQL string
|
||||
* @param string $test Test string (example: 'cd.statut=0', 'field IS NULL')
|
||||
* @param string $resok resultat si test egal
|
||||
* @param string $resko resultat si test non egal
|
||||
* @return string SQL string
|
||||
*/
|
||||
function ifsql($test, $resok, $resko);
|
||||
|
||||
/**
|
||||
* Return datas as an array
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_row($resultset);
|
||||
|
||||
/**
|
||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||
*
|
||||
* @param string $param Date TMS to convert
|
||||
* @return string Date in a string YYYYMMDDHHMMSS
|
||||
* @param int $param Date TMS to convert
|
||||
* @return string Date in a string YYYYMMDDHHMMSS
|
||||
*/
|
||||
function idate($param);
|
||||
|
||||
/**
|
||||
* Return last error code
|
||||
* Return last error code
|
||||
*
|
||||
* @return string lasterrno
|
||||
* @return string lasterrno
|
||||
*/
|
||||
function lasterrno();
|
||||
|
||||
/**
|
||||
* Start transaction
|
||||
*
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
*/
|
||||
function begin();
|
||||
|
||||
/**
|
||||
* Create a new database
|
||||
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
||||
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
||||
* Create a new database
|
||||
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
|
||||
* We force to create database with charset this->forcecharset and collate this->forcecollate
|
||||
*
|
||||
* @param string $database Database name to create
|
||||
* @param string $charset Charset used to store data
|
||||
* @param string $collation Charset used to sort data
|
||||
* @param string $owner Username of database owner
|
||||
* @return resource resource defined if OK, null if KO
|
||||
* @param string $database Database name to create
|
||||
* @param string $charset Charset used to store data
|
||||
* @param string $collation Charset used to sort data
|
||||
* @param string $owner Username of database owner
|
||||
* @return resource resource defined if OK, null if KO
|
||||
*/
|
||||
function DDLCreateDb($database, $charset = '', $collation = '', $owner = '');
|
||||
|
||||
/**
|
||||
* Return version of database server into an array
|
||||
* Return version of database server into an array
|
||||
*
|
||||
* @return array Version array
|
||||
* @return array Version array
|
||||
*/
|
||||
function getVersionArray();
|
||||
|
||||
/**
|
||||
* Convert a SQL request in Mysql syntax to native syntax
|
||||
*
|
||||
* @param string $line SQL request line to convert
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @return string SQL request line converted
|
||||
* @param string $line SQL request line to convert
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @return string SQL request line converted
|
||||
*/
|
||||
static function convertSQLFromMysql($line, $type = 'ddl');
|
||||
|
||||
/**
|
||||
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
|
||||
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
|
||||
*
|
||||
* @param resource $resultset Curseur de la requete voulue
|
||||
* @return int Nombre de lignes
|
||||
* @see num_rows
|
||||
* @param resource $resultset Curseur de la requete voulue
|
||||
* @return int Nombre de lignes
|
||||
* @see num_rows
|
||||
*/
|
||||
function affected_rows($resultset);
|
||||
|
||||
/**
|
||||
* Return description of last error
|
||||
* Return description of last error
|
||||
*
|
||||
* @return string Error text
|
||||
* @return string Error text
|
||||
*/
|
||||
function error();
|
||||
|
||||
/**
|
||||
* Return label of manager
|
||||
*
|
||||
* @return string Label
|
||||
* @return string Label
|
||||
*/
|
||||
function getLabel();
|
||||
|
||||
@ -128,58 +128,58 @@ interface Database
|
||||
function DDLListTables($database, $table = '');
|
||||
|
||||
/**
|
||||
* Return last request executed with query()
|
||||
* Return last request executed with query()
|
||||
*
|
||||
* @return string Last query
|
||||
* @return string Last query
|
||||
*/
|
||||
function lastquery();
|
||||
|
||||
/**
|
||||
* Define sort criteria of request
|
||||
*
|
||||
* @param string $sortfield List of sort fields
|
||||
* @param string $sortorder Sort order
|
||||
* @return string String to provide syntax of a sort sql string
|
||||
* @param string $sortfield List of sort fields
|
||||
* @param string $sortorder Sort order
|
||||
* @return string String to provide syntax of a sort sql string
|
||||
*/
|
||||
function order($sortfield = 0, $sortorder = 0);
|
||||
|
||||
/**
|
||||
* Decrypt sensitive data in database
|
||||
* Decrypt sensitive data in database
|
||||
*
|
||||
* @param string $value Value to decrypt
|
||||
* @return string Decrypted value if used
|
||||
* @return string Decrypted value if used
|
||||
*/
|
||||
function decrypt($value);
|
||||
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_array($resultset);
|
||||
|
||||
/**
|
||||
* Return last error label
|
||||
* Return last error label
|
||||
*
|
||||
* @return string lasterror
|
||||
* @return string lasterror
|
||||
*/
|
||||
function lasterror();
|
||||
|
||||
/**
|
||||
* Escape a string to insert data
|
||||
* Escape a string to insert data
|
||||
*
|
||||
* @param string $stringtoencode String to escape
|
||||
* @return string String escaped
|
||||
* @param string $stringtoencode String to escape
|
||||
* @return string String escaped
|
||||
*/
|
||||
function escape($stringtoencode);
|
||||
|
||||
/**
|
||||
* Get last ID after an insert INSERT
|
||||
*
|
||||
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||
* @param string $fieldid Field name
|
||||
* @return int Id of row
|
||||
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||
* @param string $fieldid Field name
|
||||
* @return int Id of row
|
||||
*/
|
||||
function last_insert_id($tab, $fieldid = 'rowid');
|
||||
|
||||
@ -193,186 +193,186 @@ interface Database
|
||||
/**
|
||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||
*
|
||||
* @param string $log Add more log to default log line
|
||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||
* @param string $log Add more log to default log line
|
||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||
*/
|
||||
function rollback($log = '');
|
||||
|
||||
/**
|
||||
* Execute a SQL request and return the resultset
|
||||
*
|
||||
* @param string $query SQL query string
|
||||
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||
* @param string $query SQL query string
|
||||
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @return resource Resultset of answer
|
||||
* @return resource Resultset of answer
|
||||
*/
|
||||
function query($query, $usesavepoint = 0, $type = 'auto');
|
||||
|
||||
/**
|
||||
* Connexion to server
|
||||
*
|
||||
* @param string $host database server host
|
||||
* @param string $login login
|
||||
* @param string $passwd password
|
||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
* @param string $host database server host
|
||||
* @param string $login login
|
||||
* @param string $passwd password
|
||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
*/
|
||||
function connect($host, $login, $passwd, $name, $port = 0);
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit = 0, $offset = 0);
|
||||
|
||||
/**
|
||||
* Return value of server parameters
|
||||
*
|
||||
* @param string $filter Filter list on a particular value
|
||||
* @return array Array of key-values (key=>value)
|
||||
* @param string $filter Filter list on a particular value
|
||||
* @return array Array of key-values (key=>value)
|
||||
*/
|
||||
function getServerParametersValues($filter = '');
|
||||
|
||||
/**
|
||||
* Return value of server status
|
||||
* Return value of server status
|
||||
*
|
||||
* @param string $filter Filter list on a particular value
|
||||
* @return array Array of key-values (key=>value)
|
||||
* @param string $filter Filter list on a particular value
|
||||
* @return array Array of key-values (key=>value)
|
||||
*/
|
||||
function getServerStatusValues($filter = '');
|
||||
|
||||
/**
|
||||
* Return collation used in database
|
||||
* Return collation used in database
|
||||
*
|
||||
* @return string Collation value
|
||||
* @return string Collation value
|
||||
*/
|
||||
function getDefaultCollationDatabase();
|
||||
|
||||
/**
|
||||
* Return number of lines for result of a SELECT
|
||||
* Return number of lines for result of a SELECT
|
||||
*
|
||||
* @param resource $resultset Resulset of requests
|
||||
* @return int Nb of lines
|
||||
* @see affected_rows
|
||||
* @param resource $resultset Resulset of requests
|
||||
* @return int Nb of lines
|
||||
* @see affected_rows
|
||||
*/
|
||||
function num_rows($resultset);
|
||||
|
||||
/**
|
||||
* Return full path of dump program
|
||||
* Return full path of dump program
|
||||
*
|
||||
* @return string Full path of dump program
|
||||
*/
|
||||
function getPathOfDump();
|
||||
|
||||
/**
|
||||
* Return version of database client driver
|
||||
* Return version of database client driver
|
||||
*
|
||||
* @return string Version string
|
||||
*/
|
||||
function getDriverInfo();
|
||||
|
||||
/**
|
||||
* Return generic error code of last operation.
|
||||
* Return generic error code of last operation.
|
||||
*
|
||||
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
|
||||
*/
|
||||
function errno();
|
||||
|
||||
/**
|
||||
* Create a table into database
|
||||
* Create a table into database
|
||||
*
|
||||
* @param string $table Nom de la table
|
||||
* @param array $fields Tableau associatif [nom champ][tableau des descriptions]
|
||||
* @param string $primary_key Nom du champ qui sera la clef primaire
|
||||
* @param string $type Type de la table
|
||||
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
|
||||
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
|
||||
* @param string $keys Tableau des champs cles noms => valeur
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* @param string $table Nom de la table
|
||||
* @param array $fields Tableau associatif [nom champ][tableau des descriptions]
|
||||
* @param string $primary_key Nom du champ qui sera la clef primaire
|
||||
* @param string $type Type de la table
|
||||
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
|
||||
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
|
||||
* @param string $keys Tableau des champs cles noms => valeur
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = "", $fulltext_keys = "", $keys = "");
|
||||
|
||||
/**
|
||||
* Return list of available charset that can be used to store data in database
|
||||
* Return list of available charset that can be used to store data in database
|
||||
*
|
||||
* @return array List of Charset
|
||||
*/
|
||||
function getListOfCharacterSet();
|
||||
|
||||
/**
|
||||
* Create a new field into table
|
||||
* Create a new field into table
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to add
|
||||
* @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
|
||||
* @param string $field_position Optionnel ex.: "after champtruc"
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to add
|
||||
* @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
|
||||
* @param string $field_position Optionnel ex.: "after champtruc"
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function DDLAddField($table, $field_name, $field_desc, $field_position = "");
|
||||
|
||||
/**
|
||||
* Drop a field from table
|
||||
* Drop a field from table
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to drop
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to drop
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function DDLDropField($table, $field_name);
|
||||
|
||||
/**
|
||||
* Update format of a field into a table
|
||||
* Update format of a field into a table
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to modify
|
||||
* @param string $field_desc Array with description of field format
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $table Name of table
|
||||
* @param string $field_name Name of field to modify
|
||||
* @param string $field_desc Array with description of field format
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function DDLUpdateField($table, $field_name, $field_desc);
|
||||
|
||||
/**
|
||||
* Return list of available collation that can be used for database
|
||||
* Return list of available collation that can be used for database
|
||||
*
|
||||
* @return array List of Collation
|
||||
* @return array List of Collation
|
||||
*/
|
||||
function getListOfCollation();
|
||||
|
||||
/**
|
||||
* Return a pointer of line with description of a table or field
|
||||
* Return a pointer of line with description of a table or field
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resource Resource
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resource Resource
|
||||
*/
|
||||
function DDLDescTable($table, $field = "");
|
||||
|
||||
/**
|
||||
* Return version of database server
|
||||
* Return version of database server
|
||||
*
|
||||
* @return string Version string
|
||||
* @return string Version string
|
||||
*/
|
||||
function getVersion();
|
||||
|
||||
/**
|
||||
* Return charset used to store data in database
|
||||
* Return charset used to store data in database
|
||||
*
|
||||
* @return string Charset
|
||||
* @return string Charset
|
||||
*/
|
||||
function getDefaultCharacterSetDatabase();
|
||||
|
||||
/**
|
||||
* Create a user and privileges to connect to database (even if database does not exists yet)
|
||||
* Create a user and privileges to connect to database (even if database does not exists yet)
|
||||
*
|
||||
* @param string $dolibarr_main_db_host Ip serveur
|
||||
* @param string $dolibarr_main_db_user Nom user a creer
|
||||
* @param string $dolibarr_main_db_pass Mot de passe user a creer
|
||||
* @param string $dolibarr_main_db_name Database name where user must be granted
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* @param string $dolibarr_main_db_host Ip serveur
|
||||
* @param string $dolibarr_main_db_user Nom user a creer
|
||||
* @param string $dolibarr_main_db_pass Mot de passe user a creer
|
||||
* @param string $dolibarr_main_db_name Database name where user must be granted
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function DDLCreateUser(
|
||||
$dolibarr_main_db_host,
|
||||
@ -382,85 +382,85 @@ interface Database
|
||||
);
|
||||
|
||||
/**
|
||||
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
|
||||
* 19700101020000 -> 3600 with TZ+1 and gmt=0
|
||||
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
|
||||
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
|
||||
* 19700101020000 -> 3600 with TZ+1 and gmt=0
|
||||
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
|
||||
*
|
||||
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||
* @return timestamp|string Date TMS
|
||||
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||
* @return int|string Date TMS or ''
|
||||
*/
|
||||
function jdate($string, $gm=false);
|
||||
|
||||
/**
|
||||
* Encrypt sensitive data in database
|
||||
* Warning: This function includes the escape, so it must use direct value
|
||||
* Encrypt sensitive data in database
|
||||
* Warning: This function includes the escape, so it must use direct value
|
||||
*
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
*/
|
||||
function encrypt($fieldorvalue, $withQuotes = 0);
|
||||
|
||||
/**
|
||||
* Validate a database transaction
|
||||
*
|
||||
* @param string $log Add more log to default log line
|
||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||
* @param string $log Add more log to default log line
|
||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||
*/
|
||||
function commit($log = '');
|
||||
|
||||
/**
|
||||
* List information of columns into a table.
|
||||
* List information of columns into a table.
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @return array Tableau des informations des champs de la table
|
||||
* @param string $table Name of table
|
||||
* @return array Array with inforation on table
|
||||
*/
|
||||
function DDLInfoTable($table);
|
||||
|
||||
/**
|
||||
* Free last resultset used.
|
||||
* Free last resultset used.
|
||||
*
|
||||
* @param resource $resultset Curseur de la requete voulue
|
||||
* @return void
|
||||
* @param resource $resultset Fre cursor
|
||||
* @return void
|
||||
*/
|
||||
function free($resultset = 0);
|
||||
|
||||
/**
|
||||
* Close database connexion
|
||||
* Close database connexion
|
||||
*
|
||||
* @return boolean True if disconnect successfull, false otherwise
|
||||
* @see connect
|
||||
* @return boolean True if disconnect successfull, false otherwise
|
||||
* @see connect
|
||||
*/
|
||||
function close();
|
||||
|
||||
/**
|
||||
* Return last query in error
|
||||
* Return last query in error
|
||||
*
|
||||
* @return string lastqueryerror
|
||||
* @return string lastqueryerror
|
||||
*/
|
||||
function lastqueryerror();
|
||||
|
||||
/**
|
||||
* Return connexion ID
|
||||
*
|
||||
* @return string Id connexion
|
||||
* @return string Id connexion
|
||||
*/
|
||||
function DDLGetConnectId();
|
||||
|
||||
/**
|
||||
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||
*
|
||||
* @param resource $resultset Curseur de la requete voulue
|
||||
* @return Object Object result line or false if KO or end of cursor
|
||||
* @param resource $resultset Curseur de la requete voulue
|
||||
* @return Object Object result line or false if KO or end of cursor
|
||||
*/
|
||||
function fetch_object($resultset);
|
||||
|
||||
/**
|
||||
* Select a database
|
||||
* Select a database
|
||||
*
|
||||
* @param string $database Name of database
|
||||
* @return boolean true if OK, false if KO
|
||||
* @param string $database Name of database
|
||||
* @return boolean true if OK, false if KO
|
||||
*/
|
||||
function select_db($database);
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ abstract class DoliDB implements Database
|
||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||
*
|
||||
* @param string $param Date TMS to convert
|
||||
* @param int $param Date TMS to convert
|
||||
* @return string Date in a string YYYYMMDDHHMMSS
|
||||
*/
|
||||
function idate($param)
|
||||
@ -271,7 +271,7 @@ abstract class DoliDB implements Database
|
||||
*
|
||||
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||
* @return int|string Date TMS
|
||||
* @return int|string Date TMS or ''
|
||||
*/
|
||||
function jdate($string, $gm=false)
|
||||
{
|
||||
|
||||
@ -437,10 +437,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
function getDriverInfo()
|
||||
{
|
||||
// FIXME: Dummy method
|
||||
// TODO: Implement
|
||||
|
||||
return '';
|
||||
return 'pgsql php driver';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -296,7 +296,7 @@ class DoliDBSqlite extends DoliDB
|
||||
* @param string $login login
|
||||
* @param string $passwd password
|
||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @param integer $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
*/
|
||||
@ -345,10 +345,7 @@ class DoliDBSqlite extends DoliDB
|
||||
*/
|
||||
function getDriverInfo()
|
||||
{
|
||||
// FIXME: Dummy method
|
||||
// TODO: Implement
|
||||
|
||||
return '';
|
||||
return 'sqlite php driver';
|
||||
}
|
||||
|
||||
|
||||
@ -459,7 +456,7 @@ class DoliDBSqlite extends DoliDB
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param Resultset $resultset Resultset of request
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_row($resultset)
|
||||
@ -511,7 +508,7 @@ class DoliDBSqlite extends DoliDB
|
||||
/**
|
||||
* Free last resultset used.
|
||||
*
|
||||
* @param resultset $resultset Curseur de la requete voulue
|
||||
* @param integer $resultset Curseur de la requete voulue
|
||||
* @return void
|
||||
*/
|
||||
function free($resultset=0)
|
||||
@ -629,7 +626,7 @@ class DoliDBSqlite extends DoliDB
|
||||
*
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
*/
|
||||
function encrypt($fieldorvalue, $withQuotes=0)
|
||||
{
|
||||
|
||||
@ -365,10 +365,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
*/
|
||||
function getDriverInfo()
|
||||
{
|
||||
// FIXME: Dummy method
|
||||
// TODO: Implement
|
||||
|
||||
return '';
|
||||
return 'sqlite3 php driver';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,14 @@
|
||||
* This is the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
function GetFolders( $resourceType, $currentFolder )
|
||||
/**
|
||||
* GetFolders
|
||||
*
|
||||
* @param string $resourceType Resource type
|
||||
* @param string $currentFolder Current folder
|
||||
* @return void
|
||||
*/
|
||||
function GetFolders($resourceType, $currentFolder)
|
||||
{
|
||||
// Map the virtual path to the local server path.
|
||||
$sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFolders');
|
||||
@ -178,6 +185,15 @@ function CreateFolder( $resourceType, $currentFolder )
|
||||
|
||||
// DOL_CHANGE
|
||||
//function FileUpload( $resourceType, $currentFolder, $sCommand )
|
||||
/**
|
||||
* FileUpload
|
||||
*
|
||||
* @param string $resourceType Resource type
|
||||
* @param string $currentFolder Current folder
|
||||
* @param string $sCommand Command
|
||||
* @param string $CKEcallback Callback
|
||||
* @return null
|
||||
*/
|
||||
function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
{
|
||||
if (!isset($_FILES)) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
//FIXME total not working
|
||||
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
|
||||
* Laurent Destailleur 2015 <eldy@users.sourceforge.net>
|
||||
*
|
||||
|
||||
@ -315,7 +315,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
* @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @param int $forcefocus Force focus on field
|
||||
* @return string Return html string to convert a select field into a combo
|
||||
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
||||
*/
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0)
|
||||
{
|
||||
|
||||
@ -84,7 +84,7 @@ function bank_prepare_head(Account $object)
|
||||
}
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to shoc
|
||||
*/
|
||||
@ -99,13 +99,13 @@ function bank_admin_prepare_head($object)
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin');
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'attributes';
|
||||
@ -120,12 +120,12 @@ function bank_admin_prepare_head($object)
|
||||
* Check SWIFT informations for a bank account
|
||||
*
|
||||
* @param Account $account A bank account
|
||||
* @return boolean True if informations are valid, false otherwise
|
||||
* @return boolean True if informations are valid, false otherwise
|
||||
*/
|
||||
function checkSwiftForAccount($account)
|
||||
{
|
||||
$swift = $account->bic;
|
||||
if (eregi("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift)) {
|
||||
if (preg_march("/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -61,7 +61,7 @@ else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
|
||||
*
|
||||
* @param string $code Code
|
||||
* @param string $encoding Encoding
|
||||
* @param string $scale Scale
|
||||
* @param integer $scale Scale
|
||||
* @param string $mode 'png' or 'jpg' ...
|
||||
*
|
||||
*
|
||||
@ -159,7 +159,7 @@ function barcode_encode($code,$encoding)
|
||||
* Calculate EAN sum
|
||||
*
|
||||
* @param string $ean EAN to encode
|
||||
* @return string Sum
|
||||
* @return integer Sum
|
||||
*/
|
||||
function barcode_gen_ean_sum($ean)
|
||||
{
|
||||
@ -299,7 +299,7 @@ function barcode_encode_genbarcode($code,$encoding)
|
||||
* @param string $mode png,gif,jpg (default='png')
|
||||
* @param int $total_y the total height of the image ( default: scale * 60 )
|
||||
* @param array $space default: $space[top] = 2 * $scale; $space[bottom]= 2 * $scale; $space[left] = 2 * $scale; $space[right] = 2 * $scale;
|
||||
* @return void
|
||||
* @return string|null
|
||||
*/
|
||||
function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, $space = '')
|
||||
{
|
||||
|
||||
@ -94,7 +94,7 @@ function contact_prepare_head(Contact $object)
|
||||
$head[$tab][2] = 'category';
|
||||
$tab++;
|
||||
}
|
||||
|
||||
|
||||
// Info
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user