Merge remote-tracking branch 'upstream/develop' into 3.7-webservices-fix

This commit is contained in:
Arnaud Aujon 2015-06-06 13:39:37 +02:00
commit 3fad8ffa80
138 changed files with 2839 additions and 1314 deletions

View File

@ -43,14 +43,31 @@ Dolibarr better:
- All fields "fk_societe" were renamed into "fk_soc". - All fields "fk_societe" were renamed into "fk_soc".
***** ChangeLog for 3.7.1 compared to 3.7.* ***** ***** ChangeLog for 3.7.1 compared to 3.7.* *****
- Fix: Bug in the new photo system FIX Bug in the new photo system
- Fix: Error management FIX Error management
- Fix: [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error FIX [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error
- Fix: [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe FIX [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe
FIX #2901
FIX when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status
FIX check the user status during authentication
FIX top links menu have target attribute with wrong value
FIX extrafields required on thirdparty
FIX create contact with extrafield is null when it is require
FIX width multiselect
FIX "script" tag with wrong syntax
Fix bug debian 786479
FIX update usergroup name
Fix facturestats was not filtering on invoice type
FIX #2856 : Wrong table design
FIX button create payment hide if tax amount is less than 1
FIX event for restricted user was restricted if company null
FIX send mail, copy sendto don't read the list of contact
FIX Properly escape untrusted data to prevent HTML injection.
FIX send mail, copy sendto don't read the list of contact
- Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose
your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to
restore old path. restore old path.
WARNING: WARNING:
@ -236,8 +253,8 @@ Dolibarr better:
- Table llx_c_pays were renamed into llx_c_country. - Table llx_c_pays were renamed into llx_c_country.
- Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after
creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead.
- A lot of pages called fiche.php were renamed into card.php - A lot of pages named fiche.php were renamed into card.php
- A lot of pages called liste.php were renamed into list.php - A lot of pages named liste.php were renamed into list.php
- If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the
warehouse module and your Point Of Sale module setup if you use one. warehouse module and your Point Of Sale module setup if you use one.
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.

View File

@ -455,8 +455,9 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
# Removed known external modules to avoir any error when packaging on test env # Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
@ -981,10 +982,10 @@ if ($nboftargetok) {
mkdir($DESTI.'/package_windows'); mkdir($DESTI.'/package_windows');
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n"; print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n"; print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n";
$SOURCEBACK=$SOURCE; $SOURCEBACK=$SOURCE;
$SOURCEBACK =~ s/\//\\/g; $SOURCEBACK =~ s/\//\\/g;

View File

@ -350,6 +350,11 @@
</rule> </rule>
<rule ref="PEAR.NamingConventions.ValidVariableName" /> <rule ref="PEAR.NamingConventions.ValidVariableName" />
<!-- This is not in PSR2 -->
<rule ref="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<severity>0</severity>
</rule>
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" /> <rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
<!-- Need to be commented to be disabled <!-- Need to be commented to be disabled

View File

@ -167,6 +167,12 @@ class modMyModule extends DolibarrModules
// Example: // Example:
//$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>'')););
// Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
// );
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;
@ -180,7 +186,6 @@ class modMyModule extends DolibarrModules
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;
// Main menu entries // Main menu entries
$this->menu = array(); // List of menus to add $this->menu = array(); // List of menus to add
$r=0; $r=0;

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) ---Put here your own copyright and developer email---
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,407 +20,463 @@
*/ */
/** /**
* \file dev/skeletons/skeleton_class.class.php * \file dev/skeletons/skeleton_class.class.php
* \ingroup mymodule othermodule1 othermodule2 * \ingroup mymodule othermodule1 othermodule2
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
* Put here some comments * Put some comments here
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Put here description of your class * Class Skeleton_Class
*
* Put here description of your class
*/ */
class Skeleton_Class extends CommonObject class Skeleton_Class extends CommonObject
{ {
var $db; //!< To store db handler /**
var $error; //!< To return error code (or message) * @var DoliDb Database handler
var $errors=array(); //!< To return several error codes (or messages) */
var $element='skeleton'; //!< Id that identify managed objects protected $db;
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
var $lines=array(); /**
* @var string Error code (or message)
* @deprecated
* @see Skeleton_Class::errors
*/
public $error;
/**
* @var string[] Error codes (or messages)
*/
public $errors = array();
/**
* @var string Id to identify managed objects
*/
public $element = 'skeleton';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'skeleton';
var $id; /**
var $prop1; * @var Skeleton_ClassLine[] Lines
var $prop2; */
public $lines = array();
/**
* @var int ID
*/
public $id;
/**
* @var mixed Sample property 1
*/
public $prop1;
/**
* @var mixed Sample property 2
*/
public $prop2;
//... //...
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
public function __construct( DoliDB $db )
{
$this->db = $db;
/** return 1;
* Constructor }
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
$this->db = $db;
return 1;
}
/**
* Create object into database
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, Id of created object if OK
*/
public function create( User $user, $notrigger = false )
{
dol_syslog( __METHOD__, LOG_DEBUG );
/** $error = 0;
* Create object into database
*
* @param User $user User that creates
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters // Clean parameters
if (isset($this->prop1)) $this->prop1=trim($this->prop1); if (isset( $this->prop1 )) {
if (isset($this->prop2)) $this->prop2=trim($this->prop2); $this->prop1 = trim( $this->prop1 );
}
if (isset( $this->prop2 )) {
$this->prop2 = trim( $this->prop2 );
}
//... //...
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= " field1,"; $sql .= ' field1,';
$sql.= " field2"; $sql .= ' field2';
//... //...
$sql.= ") VALUES ("; $sql .= ') VALUES (';
$sql.= " '".$this->prop1."',"; $sql .= ' \'' . $this->prop1 . '\',';
$sql.= " '".$this->prop2."'"; $sql .= ' \'' . $this->prop2 . '\'';
//... //...
$sql.= ")"; $sql .= ')';
$this->db->begin(); $this->db->begin();
dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query( $sql );
$resql=$this->db->query($sql); if (!$resql) {
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
}
if (! $error) if (!$error) {
{ $this->id = $this->db->last_insert_id( MAIN_DB_PREFIX . $this->table_element );
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
if (! $notrigger) if (!$notrigger) {
{ // Uncomment this and change MYOBJECT to your own tag if you
// Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger.
// want this action to call a trigger.
//// Call triggers //// Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; //if ($result < 0) $error++;
//// End call triggers //// End call triggers
} }
} }
// Commit or rollback // Commit or rollback
if ($error) if ($error) {
{
$this->db->rollback(); $this->db->rollback();
return -1*$error;
} return - 1 * $error;
else } else {
{
$this->db->commit(); $this->db->commit();
return $this->id;
return $this->id;
} }
} }
/**
* Load object in memory from the database
*
* @param int $id Id object
* @param string $ref Ref
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch( $id, $ref = null )
{
dol_syslog( __METHOD__, LOG_DEBUG );
/** $sql = 'SELECT';
* Load object in memory from the database $sql .= ' t.rowid,';
* $sql .= ' t.field1,';
* @param int $id Id object $sql .= ' t.field2';
* @param string $ref Ref
* @return int <0 if KO, 0 if not found, >0 if OK
*/
function fetch($id,$ref='')
{
global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
//... //...
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; if (null !== $ref) {
else $sql.= " WHERE t.rowid = ".$id; $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
} else {
$sql .= ' WHERE t.rowid = ' . $id;
}
dol_syslog(get_class($this)."::fetch"); $resql = $this->db->query( $sql );
$resql=$this->db->query($sql); if ($resql) {
if ($resql) $numrows = $this->db->num_rows( $resql );
{ if ($numrows) {
$numrows = $this->db->num_rows($resql); $obj = $this->db->fetch_object( $resql );
if ($numrows)
{
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->prop1 = $obj->field1; $this->prop1 = $obj->field1;
$this->prop2 = $obj->field2; $this->prop2 = $obj->field2;
//... //...
} }
$this->db->free($resql); $this->db->free( $resql );
return ($numrows?1:0); if ($numrows) {
} return 1;
else } else {
{ return 0;
$this->error="Error ".$this->db->lasterror(); }
return -1; } else {
} $this->errors[] = 'Error ' . $this->db->lasterror();
} dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
/** return - 1;
* Load object in memory from the database }
* }
* @param string $sortorder Sort Order
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit offset limit * @param int $limit offset limit
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
*
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array()) public function fetchAll( $sortorder, $sortfield, $limit, $offset, array $filter = array() )
{ {
global $langs; dol_syslog( __METHOD__, LOG_DEBUG );
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
//...
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
// Manage filter $sql = 'SELECT';
$sqlwhere=array(); $sql .= ' t.rowid,';
if (count($filter)>0) { $sql .= ' t.field1,';
foreach ( $filter as $key => $value ) { $sql .= ' t.field2';
//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; //...
} $sql .= ' FROM ' . MAIN_DB_PREFIX . 'mytable as t';
}
if (count($sqlwhere)>0) {
$sql.= ' WHERE '.implode(' AND ', $sqlwhere);
}
$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset);
$this->lines = array (); // Manage filter
$sqlwhere = array();
if (count( $filter ) > 0) {
foreach ($filter as $key => $value) {
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape( $value ) . '%\'';
}
}
if (count( $sqlwhere ) > 0) {
$sql .= ' WHERE ' . implode( ' AND ', $sqlwhere );
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit( $limit + 1, $offset );
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG); $this->lines = array();
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) $resql = $this->db->query( $sql );
{ if ($resql) {
$line=new Skeleton_ClassLine(); $num = $this->db->num_rows( $resql );
$line->id = $obj->rowid; while ($obj = $this->db->fetch_object( $resql )) {
$line->prop1 = $obj->field1; $line = new Skeleton_ClassLine();
$line->prop2 = $obj->field2;
$this->lines[]=$line; $line->id = $obj->rowid;
//... $line->prop1 = $obj->field1;
} $line->prop2 = $obj->field2;
$this->db->free($resql);
return $num; $this->lines[] = $line;
} //...
else }
{ $this->db->free( $resql );
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
return -1;
}
}
return $num;
} else {
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
/** return - 1;
* Update object into database }
* }
* @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers /**
* @return int <0 if KO, >0 if OK * Update object into database
*/ *
function update($user, $notrigger=0) * @param User $user User that modifies
{ * @param bool $notrigger false=launch triggers after, true=disable triggers
global $conf, $langs; *
$error=0; * @return int <0 if KO, >0 if OK
*/
public function update( User $user, $notrigger = false )
{
$error = 0;
dol_syslog( __METHOD__, LOG_DEBUG );
// Clean parameters // Clean parameters
if (isset($this->prop1)) $this->prop1=trim($this->prop1); if (isset( $this->prop1 )) {
if (isset($this->prop2)) $this->prop2=trim($this->prop2); $this->prop1 = trim( $this->prop1 );
}
if (isset( $this->prop2 )) {
$this->prop2 = trim( $this->prop2 );
}
//... //...
// Check parameters // Check parameters
// Put here code to add a control on parameters values // Put here code to add a control on parameters values
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
$sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").","; if (isset( $this->field1 )) {
$sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null").""; $sql .= ' field1=\'' . $this->db->escape( $this->field1 ) . '\',';
} else {
$sql .= ' field1=null' . ',';
}
if (isset( $this->field2 )) {
$sql .= ' field2=\'' . $this->db->escape( $this->field2 ) . '\'';
} else {
$sql .= ' field2=null';
}
//... //...
$sql.= " WHERE rowid=".$this->id; $sql .= ' WHERE rowid=' . $this->id;
$this->db->begin(); $this->db->begin();
dol_syslog(__METHOD__); $resql = $this->db->query( $sql );
$resql = $this->db->query($sql); if (!$resql) {
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
if (! $error && ! $notrigger) dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
{
// 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
} }
// Commit or rollback if (!$error && !$notrigger) {
if ($error) // 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
}
// Commit or rollback
if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1*$error;
} return - 1 * $error;
else } else {
{
$this->db->commit(); $this->db->commit();
return 1;
}
}
/**
* Delete object in database
*
* @param User $user User that deletes
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
$this->db->begin();
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE rowid=".$this->id;
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
}
// Commit or rollback
if ($error)
{
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1; return 1;
} }
} }
/**
* Delete object in database
*
* @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, >0 if OK
*/
public function delete( User $user, $notrigger = false )
{
dol_syslog( __METHOD__, LOG_DEBUG );
$error = 0;
$this->db->begin();
if (!$error) {
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
$resql = $this->db->query( $sql );
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return 1;
}
}
/** /**
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* *
* @param int $fromid Id of object to clone * @param int $fromid Id of object to clone
* @return int New id of clone *
* @return int New id of clone
*/ */
function createFromClone($fromid) public function createFromClone( $fromid )
{ {
global $user,$langs; dol_syslog( __METHOD__, LOG_DEBUG );
$error=0; global $user;
$error = 0;
$object=new Skeleton_Class($this->db); $object = new Skeleton_Class( $this->db );
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
$object->fetch($fromid); $object->fetch( $fromid );
$object->id=0; // Reset object
$object->statut=0; $object->id = 0;
// Clear fields // Clear fields
// ... // ...
// Create clone // Create clone
$result=$object->create($user); $result = $object->create( $user );
// Other options // Other options
if ($result < 0) if ($result < 0) {
{ $error ++;
$this->error=$object->error; $this->errors = $object->errors;
$error++; dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
}
if (! $error)
{
} }
// End // End
if (! $error) if (!$error) {
{
$this->db->commit(); $this->db->commit();
return $object->id; return $object->id;
} } else {
else
{
$this->db->rollback(); $this->db->rollback();
return -1;
return - 1;
} }
} }
/** /**
* Initialise object with example values * Initialise object with example values
* Id must be 0 if object instance is a specimen * Id must be 0 if object instance is a specimen
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
$this->id=0; $this->id = 0;
$this->prop1='prop1'; $this->prop1 = 'prop1';
$this->prop2='prop2'; $this->prop2 = 'prop2';
} }
} }
/**
* Class Skeleton_ClassLine
*/
class Skeleton_ClassLine class Skeleton_ClassLine
{ {
var $id; /**
var $prop1; * @var int ID
var $prop2; */
public $id;
/**
* @var mixed Sample line property 1
*/
public $prop1;
/**
* @var mixed Sample line property 2
*/
public $prop2;
} }

View File

@ -55,6 +55,8 @@ abstract class ActionsAdherentCardCommon
*/ */
private function getInstanceDao() private function getInstanceDao()
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
if (! is_object($this->object)) if (! is_object($this->object))
{ {
$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');

View File

@ -39,7 +39,6 @@ class AdherentType extends CommonObject
/** /**
* @var int * @var int
* @deprecated Use rowid
*/ */
public $ref; public $ref;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -151,6 +152,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
@ -528,6 +530,12 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%"><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>'; print '<tr '.$bc[$var].'><td width="35%"><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" size="20" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">'; print '<input name="tva" id="intra_vat" size="20" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '</td></tr>';
// Object of the company
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%"><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
print '<textarea class="flat" name="object" id="object" cols="80" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -930,6 +938,9 @@ else
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%" valign="top">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -78,10 +78,13 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') dolibarr_set_const($db,"THEME_ELDY_USE_HOVER", 1,'chaine',0,'',$conf->entity);
else dolibarr_set_const($db,"THEME_ELDY_USE_HOVER",0,'chaine',0,'',$conf->entity);
// This one is not always defined // This one is not always defined
if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity);
if (isset($_POST["MAIN_BUGTRACK_ENABLELINK"])) dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
@ -279,22 +282,19 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) // Show bugtrack link
{ $var=!$var;
// Show bugtrack link print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
$var=!$var; print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1);
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '</td>';
print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); print '<td width="20">&nbsp;</td>';
print '</td>'; print '</tr>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
}
// Message on login page // Message on login page
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageLogin").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageLogin").'</td><td colspan="2">';
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90); $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'."\n"; print '</td></tr>'."\n";
@ -303,7 +303,7 @@ if ($action == 'edit') // Edit
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageOfDay").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageOfDay").'</td><td colspan="2">';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90); $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'."\n"; print '</td></tr>'."\n";
@ -465,15 +465,12 @@ else // Show
print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1); print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
print '</td></tr>'; print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) // Show bugtrack link
{ $var=!$var;
// Show bugtrack link print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
$var=!$var; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<td width="20">&nbsp;</td>';
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>"; print "</tr>";
print '<td width="20">&nbsp;</td>';
print "</tr>";
}
// Message login // Message login
$var=!$var; $var=!$var;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -81,7 +81,9 @@ class DolibarrApi
// If object has lines, remove $db property // If object has lines, remove $db property
if(isset($object->lines) && count($object->lines) > 0) { if(isset($object->lines) && count($object->lines) > 0) {
for($i=0; $i < count($object->lines); $i++) { $nboflines = count($object->lines);
for ($i=0; $i < $nbofline; $i++)
{
$this->_cleanObjectDatas($object->lines[$i]); $this->_cleanObjectDatas($object->lines[$i]);
} }
} }

View File

@ -18,7 +18,7 @@
use \Luracast\Restler\iAuthenticate; use \Luracast\Restler\iAuthenticate;
use \Luracast\Restler\Resources; use \Luracast\Restler\Resources;
use \Luracast\Restler\Defaults; use \Luracast\Restler\Defaults;
use Luracast\Restler\RestException; use \Luracast\Restler\RestException;
/** /**
@ -44,24 +44,14 @@ class DolibarrApiAccess implements iAuthenticate
*/ */
public static $user = ''; public static $user = '';
// @codingStandardsIgnoreStart
/**
* @return string string to be used with WWW-Authenticate header
* @example Basic
* @example Digest
* @example OAuth
*/
public function __getWWWAuthenticateString();
/** /**
* Check access * Check access
* *
* @return boolean * @return bool
* @throws RestException
*/ */
public function _isAllowed() public function _isAllowed()
{ {
// @codingStandardsIgnoreEnd
global $db; global $db;
$stored_key = ''; $stored_key = '';
@ -74,7 +64,8 @@ class DolibarrApiAccess implements iAuthenticate
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'"; $sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'";
if ($db->query($sql)) $result = $db->query($sql);
if ($result)
{ {
if ($db->num_rows($result)) if ($db->num_rows($result))
{ {
@ -116,19 +107,26 @@ class DolibarrApiAccess implements iAuthenticate
} }
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
public function __getWWWAuthenticateString() /**
* @return string string to be used with WWW-Authenticate header
* @example Basic
* @example Digest
* @example OAuth
*/
public function _getWWWAuthenticateString()
{ {
return ''; return '';
} }
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
/** /**
* Verify access * Verify access
* *
* @param array $m Properties of method * @param array $m Properties of method
* *
* @access private * @access private
*/ * @return bool
*/
public static function verifyAccess(array $m) public static function verifyAccess(array $m)
{ {
$requires = isset($m['class']['DolibarrApiAccess']['properties']['requires']) $requires = isset($m['class']['DolibarrApiAccess']['properties']['requires'])

View File

@ -208,7 +208,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessages($cat->error,$this->errors,'errors'); setEventMessages( $cat->error, $cat->errors, 'errors' );
} }
} }
} }

View File

@ -48,6 +48,67 @@ class Categorie extends CommonObject
const TYPE_MEMBER = 3; const TYPE_MEMBER = 3;
const TYPE_CONTACT = 4; const TYPE_CONTACT = 4;
/**
* @var array ID mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
private $MAP_ID = array(
'product' => 0,
'supplier' => 1,
'customer' => 2,
'member' => 3,
'contact' => 4,
);
/**
* @var array Foreign keys mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
private $MAP_CAT_FK = array(
'product' => 'product',
'customer' => 'soc',
'supplier' => 'soc',
'member' => 'member',
'contact' => 'socpeople',
);
/**
* @var array Category tables mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
private $MAP_CAT_TABLE = array(
'product' => 'product',
'customer' => 'societe',
'supplier' => 'fournisseur',
'member' => 'member',
'contact' => 'contact',
);
/**
* @var array Object class mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
private $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
'member' => 'Adherent',
'contact' => 'Contact',
);
/**
* @var array Object table mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
private $MAP_OBJ_TABLE = array(
'product' => 'product',
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
'contact' => 'socpeople',
);
public $element='category'; public $element='category';
public $table_element='categories'; public $table_element='categories';
@ -56,13 +117,21 @@ class Categorie extends CommonObject
var $label; var $label;
var $description; var $description;
var $socid; var $socid;
var $type; // 0=Product, 1=Supplier, 2=Customer/Prospect, 3=Member, 4=Contact /**
* @var int Category type
*
* @see Categorie::TYPE_PRODUCT
* @see Categorie::TYPE_SUPPLIER
* @see Categorie::TYPE_CUSTOMER
* @see Categorie::TYPE_MEMBER
* @see Categorie::TYPE_CONTACT
*/
var $type;
var $import_key; var $import_key;
var $cats=array(); // Tableau en memoire des categories var $cats=array(); // Tableau en memoire des categories
var $motherof=array(); var $motherof=array();
/** /**
* Constructor * Constructor
* *
@ -477,11 +546,12 @@ class Categorie extends CommonObject
} }
/** /**
* Link an object to the category * Link an object to the category
* *
* @param Object $obj Object to link to category * @param CommonObject $obj Object to link to category
* @param string $type Type of category ('societe', 'member', 'product', 'contact', 'fournisseur) * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked *
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/ */
function add_type($obj,$type) function add_type($obj,$type)
{ {
@ -492,28 +562,21 @@ class Categorie extends CommonObject
if ($this->id == -1) return -2; if ($this->id == -1) return -2;
// For backward compatibility // For backward compatibility
if ($type == 'company') $type='societe'; if ($type == 'societe') {
elseif ($type == 'customer') $type='societe'; $type = 'customer';
elseif ($type == 'supplier') $type='fournisseur'; dol_syslog( get_class( $this ) . "::add_type(): type 'societe' is deprecated, please use 'customer' instead",
LOG_WARNING );
/** } elseif ($type == 'fournisseur') {
* llx_categorie_contact => fk_socpeople $type = 'supplier';
* llx_categorie_fournisseur, llx_categorie_societe => fk_soc dol_syslog( get_class( $this ) . "::add_type(): type 'fournisseur' is deprecated, please use 'supplier' instead",
* llx_categorie_member => fk_member LOG_WARNING );
* llx_categorie_product => fk_product
*/
if ($type == 'contact') {
$column_name = 'socpeople';
} elseif ($type == 'fournisseur' || ($type == 'societe')) {
$column_name = 'soc';
} else {
$column_name = $type;
} }
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".$type." (fk_categorie, fk_".$column_name.")"; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " VALUES (".$this->id.", ".$obj->id.")"; $sql .= " (fk_categorie, fk_" . $this->MAP_CAT_FK[$type] . ")";
$sql .= " VALUES (" . $this->id . ", " . $obj->id . ")";
dol_syslog(get_class($this).'::add_type', LOG_DEBUG); dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -596,9 +659,10 @@ class Categorie extends CommonObject
/** /**
* Delete object from category * Delete object from category
* *
* @param Object $obj Object * @param CommonObject $obj Object
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @return int 1 if OK, -1 if KO *
* @return int 1 if OK, -1 if KO
*/ */
function del_type($obj,$type) function del_type($obj,$type)
{ {
@ -607,19 +671,21 @@ class Categorie extends CommonObject
$error=0; $error=0;
// For backward compatibility // For backward compatibility
if ($type == 'company') $type='societe'; if ($type == 'societe') {
if ($type == 'customer') $type='societe'; $type = 'customer';
if ($type == 'supplier') $type='fournisseur'; dol_syslog( get_class( $this ) . "::del_type(): type 'societe' is deprecated, please use 'customer' instead",
LOG_WARNING );
$column_name=$type; } elseif ($type == 'fournisseur') {
if ($type=='contact') $column_name='socpeople'; $type = 'supplier';
if ($type=='fournisseur') $column_name='societe'; dol_syslog( get_class( $this ) . "::del_type(): type 'fournisseur' is deprecated, please use 'supplier' instead",
LOG_WARNING );
}
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".$type; $sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " WHERE fk_categorie = ".$this->id; $sql .= " WHERE fk_categorie = " . $this->id;
$sql .= " AND fk_".$column_name." = ".$obj->id; $sql .= " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $obj->id;
dol_syslog(get_class($this).'::del_type', LOG_DEBUG); dol_syslog(get_class($this).'::del_type', LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -652,41 +718,32 @@ class Categorie extends CommonObject
} }
/** /**
* Return list of fetched instance of elements having this category * Return list of fetched instance of elements having this category
* *
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @return mixed -1 if KO, array of instance of object if OK *
* @return mixed -1 if KO, array of instance of object if OK
*/ */
function getObjectsInCateg($type) function getObjectsInCateg($type)
{ {
$field=''; $classname=''; $category_table=''; $object_table='';
if ($type=='product') { $field='product'; $classname='Product'; }
if ($type=='customer') { $field='soc'; $classname='Societe'; $category_table='societe'; $object_table='societe'; }
if ($type=='supplier') { $field='soc'; $classname='Fournisseur'; $category_table='fournisseur'; $object_table='societe'; }
if ($type=='member') { $field='member'; $classname='Adherent'; $category_table=''; $object_table='adherent'; }
if ($type=='contact') { $field='socpeople'; $classname='Contact'; $category_table='contact'; $object_table='socpeople'; }
$objs = array(); $objs = array();
// Clean parameters $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db );
if (empty($category_table)) $category_table=$field;
if (empty($object_table)) $object_table=$field;
$sql = "SELECT c.fk_".$field; $sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type];
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$category_table." as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c";
$sql.= ", ".MAIN_DB_PREFIX.$object_table." as o"; $sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o";
$sql.= " WHERE o.entity IN (".getEntity($field, 1).")"; $sql .= " WHERE o.entity IN (" . getEntity( $obj->element, 1).")";
$sql.= " AND c.fk_categorie = ".$this->id; $sql.= " AND c.fk_categorie = ".$this->id;
$sql.= " AND c.fk_".$field." = o.rowid"; $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
while ($rec = $this->db->fetch_array($resql)) while ($rec = $this->db->fetch_array($resql)) {
{ $obj = new $this->MAP_OBJ_CLASS[$type]( $this->db );
$obj = new $classname($this->db); $obj->fetch( $rec['fk_' . $this->MAP_CAT_FK[$type]]);
$obj->fetch($rec['fk_'.$field]);
$objs[] = $obj; $objs[] = $obj;
} }
return $objs; return $objs;
@ -699,40 +756,17 @@ class Categorie extends CommonObject
} }
/** /**
* check for the presence of an object in a category * Check for the presence of an object in a category
* *
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $object_id id of the object to search * @param int $object_id id of the object to search
* @return int number of occurrences *
* @return int number of occurrences
*/ */
function containsObject($type, $object_id) function containsObject($type, $object_id )
{ {
$field = ''; $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$category_table = ''; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id;
if ($type == 'product') {
$field = 'product';
}
if ($type == 'customer') {
$field = 'societe';
}
if ($type == 'supplier') {
$field = 'societe';
$category_table = 'fournisseur';
}
if ($type == 'member') {
$field = 'member';
$category_table = '';
}
if ($type == 'contact') {
$field = 'socpeople';
$category_table = 'contact';
}
if (empty($category_table)) {
$category_table = $field;
}
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $category_table;
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $field . " = " . $object_id;
dol_syslog(get_class($this)."::containsObject", LOG_DEBUG); dol_syslog(get_class($this)."::containsObject", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
@ -772,7 +806,6 @@ class Categorie extends CommonObject
} }
} }
/** /**
* Load this->motherof that is array(id_son=>id_parent, ...) * Load this->motherof that is array(id_son=>id_parent, ...)
* *
@ -808,23 +841,34 @@ class Categorie extends CommonObject
} }
/** /**
* Reconstruit l'arborescence des categories sous la forme d'un tableau * Reconstruit l'arborescence des categories sous la forme d'un tableau
* Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec:
* id = id de la categorie * id = id de la categorie
* id_mere = id de la categorie mere * id_mere = id de la categorie mere
* id_children = tableau des id enfant * id_children = tableau des id enfant
* label = nom de la categorie * label = nom de la categorie
* fulllabel = nom avec chemin complet de la categorie * fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id * fullpath = chemin complet compose des id
* *
* @param string $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member'). Old
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree. * mode (0, 1, 2, ...) is deprecated.
* @return array Array of categories. this->cats and this->motherof are set. * @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
*/ */
function get_full_arbo($type,$markafterid=0) function get_full_arbo($type,$markafterid=0)
{ {
global $conf, $langs; global $conf, $langs;
// For backward compatibility
if (is_numeric( $type )) {
// We want to reverse lookup
$map_type = array_flip( $this->MAP_ID );
$type = $map_type[$type];
dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead",
LOG_WARNING );
}
$this->cats = array(); $this->cats = array();
// Init this->motherof that is array(id_son=>id_parent, ...) // Init this->motherof that is array(id_son=>id_parent, ...)
@ -836,8 +880,8 @@ class Categorie extends CommonObject
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")";
$sql.= " AND c.type = ".$type; $sql .= " AND c.type = " . $this->MAP_ID[$type];
dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1171,35 +1215,39 @@ class Categorie extends CommonObject
} }
/** /**
* Return list of categories (id or instances) linked to element of id $id and type $type * Return list of categories (id or instances) linked to element of id $id and type $type
* Should be named getListOfCategForObject * Should be named getListOfCategForObject
* *
* @param int $id Id of element * @param int $id Id of element
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode
* @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category labels * (0, 1, 2, ...) is deprecated.
* @return mixed Array of category objects or < 0 if KO * @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels
*
* @return mixed Array of category objects or < 0 if KO
*/ */
function containing($id,$type,$mode='object') function containing($id,$type,$mode='object')
{ {
// Deprecation warning
if (is_numeric($type)) {
dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING);
}
$cats = array(); $cats = array();
$typeid=-1; $table=''; // For backward compatibility
if ($type == '0' || $type == 'product') { if (is_numeric( $type )) {
$typeid=self::TYPE_PRODUCT; $table='product'; $type='product'; // We want to reverse lookup
} else if ($type == '1' || $type == 'supplier') { $map_type = array_flip( $this->MAP_ID );
$typeid=self::TYPE_SUPPLIER; $table='soc'; $type='fournisseur'; $type = $map_type[$type];
} else if ($type == '2' || $type == 'customer') { dol_syslog( get_class( $this ) . "::containing(): numeric types are deprecated, please use string instead",
$typeid=self::TYPE_CUSTOMER; $table='soc'; $type='societe'; LOG_WARNING );
} else if ($type == '3' || $type == 'member') {
$typeid=self::TYPE_MEMBER; $table='member'; $type='member';
} else if ($type == '4' || $type == 'contact') {
$typeid=self::TYPE_CONTACT; $table='socpeople'; $type='contact';
} }
$sql = "SELECT ct.fk_categorie, c.label"; $sql = "SELECT ct.fk_categorie, c.label";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
$sql.= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".$table." = ".$id." AND c.type = ".$typeid; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
$sql.= " AND c.entity IN (".getEntity('category',1).")"; $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
dol_syslog(get_class($this).'::containing', LOG_DEBUG); dol_syslog(get_class($this).'::containing', LOG_DEBUG);
$res = $this->db->query($sql); $res = $this->db->query($sql);
@ -1241,19 +1289,26 @@ class Categorie extends CommonObject
*/ */
function rechercher($id, $nom, $type, $exact = false, $case = false) function rechercher($id, $nom, $type, $exact = false, $case = false)
{ {
// Deprecation warning
if (is_numeric($type)) {
dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING);
}
$cats = array(); $cats = array();
$typeid=-1; // For backward compatibility
if ($type == 0 || $type == 'product') { $typeid=self::TYPE_PRODUCT; } if (is_numeric( $type )) {
else if ($type == 1 || $type == 'supplier') { $typeid=self::TYPE_SUPPLIER; } // We want to reverse lookup
else if ($type == 2 || $type == 'customer') { $typeid=self::TYPE_CUSTOMER; } $map_type = array_flip( $this->MAP_ID );
else if ($type == 3 || $type == 'member') { $typeid=self::TYPE_MEMBER; } $type = $map_type;
else if ($type == 4 || $type == 'contact') { $typeid=self::TYPE_CONTACT; } dol_syslog( get_class( $this ) . "::rechercher(): numeric types are deprecated, please use string instead",
LOG_WARNING );
}
// Generation requete recherche // Generation requete recherche
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie";
$sql.= " WHERE type = ".$typeid; $sql .= " WHERE type = " . $this->MAP_ID[$type];
$sql.= " AND entity IN (".getEntity('category',1).")"; $sql .= " AND entity IN (" . getEntity( 'category', 1 ) . ")";
if ($nom) if ($nom)
{ {
if (! $exact) if (! $exact)

View File

@ -96,7 +96,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
{ {
$idtoremove=GETPOST('removedassigned'); $idtoremove=GETPOST('removedassigned');
if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=json_decode($_SESSION['assignedtouser'],1);
else $tmpassigneduserids=array(); else $tmpassigneduserids=array();
foreach ($tmpassigneduserids as $key => $val) foreach ($tmpassigneduserids as $key => $val)
@ -104,7 +104,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]); if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]);
} }
//var_dump($_POST['removedassigned']);exit; //var_dump($_POST['removedassigned']);exit;
$_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); $_SESSION['assignedtouser']=json_encode($tmpassigneduserids);
$donotclearsession=1; $donotclearsession=1;
if ($action == 'add') $action = 'create'; if ($action == 'add') $action = 'create';
if ($action == 'update') $action = 'edit'; if ($action == 'update') $action = 'edit';
@ -119,10 +119,10 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
$assignedtouser=array(); $assignedtouser=array();
if (! empty($_SESSION['assignedtouser'])) if (! empty($_SESSION['assignedtouser']))
{ {
$assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); $assignedtouser=json_decode($_SESSION['assignedtouser'], true);
} }
$assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1); $assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1);
$_SESSION['assignedtouser']=dol_json_encode($assignedtouser); $_SESSION['assignedtouser']=json_encode($assignedtouser);
} }
$donotclearsession=1; $donotclearsession=1;
if ($action == 'add') $action = 'create'; if ($action == 'add') $action = 'create';
@ -215,7 +215,7 @@ if ($action == 'add')
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
$listofuserid=array(); $listofuserid=array();
if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']); if (! empty($_SESSION['assignedtouser'])) $listofuserid=json_decode($_SESSION['assignedtouser']);
$i=0; $i=0;
foreach($listofuserid as $key => $value) foreach($listofuserid as $key => $value)
{ {
@ -387,7 +387,7 @@ if ($action == 'update')
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
{ {
// Restore array with key with same value than param 'id' // Restore array with key with same value than param 'id'
$tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); $tmplist1=json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
foreach($tmplist1 as $key => $val) foreach($tmplist1 as $key => $val)
{ {
if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
@ -677,13 +677,13 @@ if ($action == 'create')
{ {
$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); $assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=json_encode($listofuserid);
} }
else else
{ {
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
{ {
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); $listofuserid=json_decode($_SESSION['assignedtouser'], true);
} }
} }
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
@ -929,13 +929,13 @@ if ($id > 0)
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
} }
} }
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=json_encode($listofuserid);
} }
else else
{ {
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
{ {
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); $listofuserid=json_decode($_SESSION['assignedtouser'], true);
} }
} }
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
@ -1101,13 +1101,13 @@ if ($id > 0)
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
} }
} }
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=json_encode($listofuserid);
} }
else else
{ {
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
{ {
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); $listofuserid=json_decode($_SESSION['assignedtouser'], true);
} }
} }
print $form->select_dolusers_forevent('view','assignedtouser',1); print $form->select_dolusers_forevent('view','assignedtouser',1);

View File

@ -61,6 +61,7 @@ class ActionComm extends CommonObject
/** /**
* @var string * @var string
* @deprecated Use $label * @deprecated Use $label
* @see label
*/ */
public $libelle; public $libelle;
@ -71,6 +72,7 @@ class ActionComm extends CommonObject
* Object user that create action * Object user that create action
* @var User * @var User
* @deprecated * @deprecated
* @see authorid
*/ */
var $author; var $author;
@ -78,6 +80,7 @@ class ActionComm extends CommonObject
* Object user that modified action * Object user that modified action
* @var User * @var User
* @deprecated * @deprecated
* @see usermodid
*/ */
var $usermod; var $usermod;
var $authorid; // Id user that create action var $authorid; // Id user that create action
@ -114,6 +117,7 @@ class ActionComm extends CommonObject
* Object user of owner * Object user of owner
* @var User * @var User
* @deprecated * @deprecated
* @see userownerid
*/ */
var $usertodo; var $usertodo;
@ -121,6 +125,7 @@ class ActionComm extends CommonObject
* Object user that did action * Object user that did action
* @var User * @var User
* @deprecated * @deprecated
* @see userdoneid
*/ */
var $userdone; var $userdone;
@ -130,12 +135,16 @@ class ActionComm extends CommonObject
/** /**
* Company linked to action (optional) * Company linked to action (optional)
* @var Societe|null * @var Societe|null
* @deprecated
* @see socid
*/ */
var $societe; var $societe;
/** /**
* Contact linked to action (optional) * Contact linked to action (optional)
* @var Contact|null * @var Contact|null
* @deprecated
* @see contactid
*/ */
var $contact; var $contact;
@ -468,7 +477,7 @@ class ActionComm extends CommonObject
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
$this->transparency = $obj->transparency; $this->transparency = $obj->transparency;
$this->punctual = $obj->punctual; $this->punctual = $obj->punctual; // deprecated
$this->socid = $obj->fk_soc; // To have fetch_thirdparty method working $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working
$this->contactid = $obj->fk_contact; // To have fetch_contact method working $this->contactid = $obj->fk_contact; // To have fetch_contact method working

View File

@ -186,13 +186,13 @@ if ($object->id > 0)
if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val; if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
} }
} }
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=json_encode($listofuserid);
} }
else else
{ {
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
{ {
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); $listofuserid=json_decode($_SESSION['assignedtouser'], true);
} }
} }
print $form->select_dolusers_forevent('view','assignedtouser',1); print $form->select_dolusers_forevent('view','assignedtouser',1);

View File

@ -59,14 +59,42 @@ class AskPriceSupplier extends CommonObject
var $client; // Objet societe client (a charger par fetch_client) var $client; // Objet societe client (a charger par fetch_client)
var $fk_project; var $fk_project;
/**
* @deprecated
* @see user_author_id
*/
var $author; var $author;
var $ref; var $ref;
var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande
var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed) var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
var $datec; // Date of creation
var $date; // Date of proposal var $date; // Date of proposal
var $date_livraison; var $date_livraison;
/**
* @deprecated
* @see date_creation
*/
var $datec;
/**
* Creation date
* @var int
*/
public $date_creation;
/**
* @deprecated
* @see date_validation
*/
var $datev;
/**
* Validation date
* @var int
*/
public $date_validation;
var $user_author_id; var $user_author_id;
var $user_valid_id; var $user_valid_id;
var $user_close_id; var $user_close_id;
@ -76,9 +104,22 @@ class AskPriceSupplier extends CommonObject
var $total_localtax1; // Total Local Taxes 1 var $total_localtax1; // Total Local Taxes 1
var $total_localtax2; // Total Local Taxes 2 var $total_localtax2; // Total Local Taxes 2
var $total_ttc; // Total with tax var $total_ttc; // Total with tax
var $price; // deprecated (for compatibility)
var $tva; // deprecated (for compatibility) /**
var $total; // deprecated (for compatibility) * @deprecated
* @see price_ht
*/
var $price;
/**
* @deprecated
* @see total_tva
*/
var $tva;
/**
* @deprecated
* @see total_ttc
*/
var $total;
var $cond_reglement_id; var $cond_reglement_id;
var $cond_reglement_code; var $cond_reglement_code;
@ -88,7 +129,11 @@ class AskPriceSupplier extends CommonObject
var $remise; var $remise;
var $remise_percent; var $remise_percent;
var $remise_absolue; var $remise_absolue;
var $note; // deprecated (for compatibility) /**
* @deprecated
* @see note_public, note_private
*/
var $note;
var $note_private; var $note_private;
var $note_public; var $note_public;
var $shipping_method_id; var $shipping_method_id;
@ -1031,7 +1076,7 @@ class AskPriceSupplier extends CommonObject
$this->remise = $obj->remise; $this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue; $this->remise_absolue = $obj->remise_absolue;
$this->total = $obj->total; // TODO obsolete $this->total = $obj->total; // TODO deprecated
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva; $this->total_tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1; $this->total_localtax1 = $obj->localtax1;
@ -1040,14 +1085,14 @@ class AskPriceSupplier extends CommonObject
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->note = $obj->note_private; // TODO obsolete $this->note = $obj->note_private; // TODO deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->statut_libelle = $obj->statut_label; $this->statut_libelle = $obj->statut_label;
$this->datec = $this->db->jdate($obj->datec); // TODO obsolete $this->datec = $this->db->jdate($obj->datec); // TODO deprecated
$this->datev = $this->db->jdate($obj->datev); // TODO obsolete $this->datev = $this->db->jdate($obj->datev); // TODO deprecated
$this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_livraison = $this->db->jdate($obj->date_livraison); $this->date_livraison = $this->db->jdate($obj->date_livraison);
@ -2431,7 +2476,17 @@ class AskPriceSupplierLine extends CommonObject
var $fk_parent_line; var $fk_parent_line;
var $desc; // Description ligne var $desc; // Description ligne
var $fk_product; // Id produit predefini var $fk_product; // Id produit predefini
var $product_type = 0; // Type 0 = product, 1 = Service /**
* @deprecated
* @see product_type
*/
var $fk_product_type;
/**
* Product type
* @var int
* @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE
*/
public $product_type = Product::TYPE_PRODUCT;
var $qty; var $qty;
var $tva_tx; var $tva_tx;
@ -2459,14 +2514,43 @@ class AskPriceSupplierLine extends CommonObject
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
// Ne plus utiliser /**
* @deprecated
* @see remise_percent, fk_remise_except
*/
var $remise; var $remise;
/**
* @deprecated
* @see subprice
*/
var $price; var $price;
// From llx_product // From llx_product
var $ref; // Reference produit /**
var $libelle; // Label produit * @deprecated
var $product_desc; // Description produit * @see product_ref
*/
var $ref;
/**
* Product reference
* @var string
*/
public $product_ref;
/**
* @deprecated
* @see product_label
*/
var $libelle;
/**
* Product label
* @var string
*/
public $product_label;
/**
* Product description
* @var string
*/
public $product_desc;
var $localtax1_tx; // Local tax 1 var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2 var $localtax2_tx; // Local tax 2

View File

@ -140,7 +140,7 @@ if (empty($reshook))
if ($result < 0) setEventMessage($object->error,$object->errors,'errors'); if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
} }
// update prospect level // set communication status
if ($action == 'setstcomm') if ($action == 'setstcomm')
{ {
$object->fetch($id); $object->fetch($id);
@ -468,6 +468,12 @@ if ($id > 0)
print '</div></td></tr>'; print '</div></td></tr>';
} }
// Categories
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";
// Other attributes // Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

View File

@ -421,7 +421,7 @@ class Mailing extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
return 1; return $this->delete_targets();
} }
else else
{ {
@ -430,6 +430,29 @@ class Mailing extends CommonObject
} }
} }
/**
* Delete targets emailing
*
* @return int 1 if OK, 0 if error
*/
function delete_targets()
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql.= " WHERE fk_mailing = ".$this->id;
dol_syslog("Mailing::delete_targets", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
return 0;
}
}
/** /**
* Change status of each recipient * Change status of each recipient

View File

@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
@ -305,7 +306,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid'); $object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model'); $object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated $object->author = $user->id; // deprecated
$object->note = GETPOST('note'); $object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->statut = Propal::STATUS_DRAFT; $object->statut = Propal::STATUS_DRAFT;
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -331,7 +333,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid'); $object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model'); $object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated $object->author = $user->id; // deprecated
$object->note = GETPOST('note'); $object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -1256,6 +1259,7 @@ $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formpropal = new FormPropal($db); $formpropal = new FormPropal($db);
$companystatic = new Societe($db); $companystatic = new Societe($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$now = dol_now(); $now = dol_now();
@ -1340,7 +1344,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>'; print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
// Ref customer // Ref customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
@ -1444,13 +1448,20 @@ if ($action == 'create')
} }
print '</td></tr>'; print '</td></tr>';
// Model // Project
print '<tr>'; if (! empty($conf->projet->enabled) && $socid > 0)
print '<td>' . $langs->trans("DefaultModel") . '</td>'; {
print '<td colspan="2">'; $projectid = GETPOST('projectid')?GETPOST('projectid'):0;
$liste = ModelePDFPropales::liste_modeles($db); if ($origin == 'project') $projectid = ($originid ? $originid : 0);
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
print "</td></tr>"; $langs->load("projects");
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>';
print '</tr>';
}
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
@ -1462,25 +1473,41 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Project // Template to use by default
if (! empty($conf->projet->enabled) && $socid > 0) print '<tr>';
print '<td>' . $langs->trans("DefaultModel") . '</td>';
print '<td colspan="2">';
$liste = ModelePDFPropales::liste_modeles($db);
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
print "</td></tr>";
// Public note
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">';
$note_public = '';
if (is_object($objectsrc)) // Take value from source object
{ {
$formproject = new FormProjets($db); $note_public = $objectsrc->note_public;
}
$projectid = 0; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
if ($origin == 'project') print $doleditor->Create(1);
$projectid = ($originid ? $originid : 0);
// Private note
if (empty($user->societe_id))
{
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">'; print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); $note_private = '';
if ($numprojet == 0) { if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object
$langs->load("projects"); {
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>'; $note_private = $objectsrc->note_private;
} }
print '</td>'; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print '</tr>'; print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';
} }
// Other attributes // Other attributes

View File

@ -75,26 +75,35 @@ class Propal extends CommonObject
/** /**
* Status of the quote * Status of the quote
* Check the following constants:
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_SIGNED
* - STATUS_NOTSIGNED
* - STATUS_BILLED
* @var int * @var int
* @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
*/ */
var $statut; var $statut;
/** /**
* Date of creation * @deprecated
* @var * @see date_creation
*/ */
var $datec; var $datec;
/** /**
* Date of validation * Creation date
* @var * @var int
*/
public $date_creation;
/**
* @deprecated
* @see date_validation
*/ */
var $datev; var $datev;
/**
* Validation date
* @var int
*/
public $date_validation;
/** /**
* Date of the quote * Date of the quote
* @var * @var
@ -102,8 +111,8 @@ class Propal extends CommonObject
var $date; var $date;
/** /**
* Same than date ¿? * @deprecated
* @var * @see date
*/ */
var $datep; var $datep;
var $date_livraison; var $date_livraison;
@ -121,14 +130,17 @@ class Propal extends CommonObject
/** /**
* @deprecated * @deprecated
* @see total_ht
*/ */
var $price; var $price;
/** /**
* @deprecated * @deprecated
* @see total_tva
*/ */
var $tva; var $tva;
/** /**
* @deprecated * @deprecated
* @see total_ttc
*/ */
var $total; var $total;
@ -142,6 +154,7 @@ class Propal extends CommonObject
var $remise_absolue; var $remise_absolue;
/** /**
* @deprecated * @deprecated
* @see note_private, note_public
*/ */
var $note; var $note;
var $note_private; var $note_private;
@ -1048,7 +1061,9 @@ class Propal extends CommonObject
*/ */
function createFromClone($socid=0) function createFromClone($socid=0)
{ {
global $user,$langs,$conf,$hookmanager; global $db, $user,$langs,$conf,$hookmanager;
dol_include_once('/projet/class.project.class.php');
$this->context['createfromclone']='createfromclone'; $this->context['createfromclone']='createfromclone';
@ -1074,7 +1089,16 @@ class Propal extends CommonObject
$this->socid = $objsoc->id; $this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = '';
$project = new Project($db);
if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) {
if($project->socid <= 0) $this->fk_project = $objFrom->fk_project;
else $this->fk_project = '';
} else {
$this->fk_project = '';
}
$this->fk_delivery_address = ''; $this->fk_delivery_address = '';
} }
@ -1222,7 +1246,7 @@ class Propal extends CommonObject
$this->remise = $obj->remise; $this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue; $this->remise_absolue = $obj->remise_absolue;
$this->total = $obj->total; // TODO obsolete $this->total = $obj->total; // TODO deprecated
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva; $this->total_tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1; $this->total_localtax1 = $obj->localtax1;
@ -1231,14 +1255,14 @@ class Propal extends CommonObject
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->fk_project = $obj->fk_projet; $this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
$this->note = $obj->note_private; // TODO obsolete $this->note = $obj->note_private; // TODO deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->statut_libelle = $obj->statut_label; $this->statut_libelle = $obj->statut_label;
$this->datec = $this->db->jdate($obj->datec); // TODO obsolete $this->datec = $this->db->jdate($obj->datec); // TODO deprecated
$this->datev = $this->db->jdate($obj->datev); // TODO obsolete $this->datev = $this->db->jdate($obj->datev); // TODO deprecated
$this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date = $this->db->jdate($obj->dp); // Proposal date $this->date = $this->db->jdate($obj->dp); // Proposal date
@ -1967,9 +1991,12 @@ class Propal extends CommonObject
* *
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
* @deprecated * @deprecated
* @see classifyBilled()
*/ */
function classer_facturee() function classer_facturee()
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $this->classifyBilled(); return $this->classifyBilled();
} }
@ -2724,7 +2751,7 @@ class Propal extends CommonObject
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param string $option Where point the link ('compta', 'expedition', 'document', ...) * @param string $option Where point the link ('expedition', 'document', ...)
* @param string $get_params Parametres added to url * @param string $get_params Parametres added to url
* @return string String with URL * @return string String with URL
*/ */
@ -2912,17 +2939,19 @@ class PropaleLigne extends CommonObjectLine
var $oldline; var $oldline;
// From llx_propaldet // From llx_propaldet
var $rowid;
var $fk_propal; var $fk_propal;
var $fk_parent_line; var $fk_parent_line;
var $desc; // Description ligne var $desc; // Description ligne
var $fk_product; // Id produit predefini var $fk_product; // Id produit predefini
/**
* @deprecated
* @see product_type
*/
var $fk_product_type;
/** /**
* Product type. * Product type.
* Use the following constants:
* - Product::TYPE_PRODUCT
* - Product::TYPE_SERVICE
* @var int * @var int
* @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE
*/ */
var $product_type = Product::TYPE_PRODUCT; var $product_type = Product::TYPE_PRODUCT;
@ -2952,14 +2981,43 @@ class PropaleLigne extends CommonObjectLine
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
// Ne plus utiliser /**
* @deprecated
* @see $remise_percent, $fk_remise_except
*/
var $remise; var $remise;
/**
* @deprecated
* @see subprice
*/
var $price; var $price;
// From llx_product // From llx_product
var $ref; // Reference produit /**
var $libelle; // Label produit * @deprecated
var $product_desc; // Description produit * @see product_ref
*/
var $ref;
/**
* Product reference
* @var string
*/
public $product_ref;
/**
* @deprecated
* @see product_label
*/
var $libelle;
/**
* Product label
* @var string
*/
public $product_label;
/**
* Product description
* @var string
*/
public $product_desc;
var $localtax1_tx; // Local tax 1 var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2 var $localtax2_tx; // Local tax 2
@ -3007,7 +3065,8 @@ class PropaleLigne extends CommonObjectLine
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$this->rowid = $objp->rowid; $this->id = $objp->rowid;
$this->rowid = $objp->rowid; // deprecated
$this->fk_propal = $objp->fk_propal; $this->fk_propal = $objp->fk_propal;
$this->fk_parent_line = $objp->fk_parent_line; $this->fk_parent_line = $objp->fk_parent_line;
$this->label = $objp->custom_label; $this->label = $objp->custom_label;
@ -3016,7 +3075,7 @@ class PropaleLigne extends CommonObjectLine
$this->price = $objp->price; // deprecated $this->price = $objp->price; // deprecated
$this->subprice = $objp->subprice; $this->subprice = $objp->subprice;
$this->tva_tx = $objp->tva_tx; $this->tva_tx = $objp->tva_tx;
$this->remise = $objp->remise; $this->remise = $objp->remise; // deprecated
$this->remise_percent = $objp->remise_percent; $this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except; $this->fk_remise_except = $objp->fk_remise_except;
$this->fk_product = $objp->fk_product; $this->fk_product = $objp->fk_product;

View File

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$langs->load('companies');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
$langs->load('propal'); $langs->load('propal');
$langs->load('compta'); $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
$langs->load("companies");
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
@ -103,7 +104,7 @@ if ($id > 0 || ! empty($ref))
print "<tr><td>".$langs->trans("Company")."</td>"; print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>'; print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers // Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent); if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");

View File

@ -204,6 +204,9 @@ if (empty($reshook))
$formother=new FormOther($db); $formother=new FormOther($db);
$form=new Form($db); $form=new Form($db);
$prospectstatic=new Client($db);
$prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus();
$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,"; $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,"; $sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
@ -353,7 +356,7 @@ if ($resql)
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">'; print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>'; print '</td>';
// Prospect levelt // Prospect level
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$options_from = '<option value="">&nbsp;</option>'; // Generate in $options_from the list of each option sorted $options_from = '<option value="">&nbsp;</option>'; // Generate in $options_from the list of each option sorted
foreach ($tab_level as $tab_level_sortorder => $tab_level_label) foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
@ -380,9 +383,12 @@ if ($resql)
// Prospect status // Prospect status
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
// TODO Add here a list of prospect status $arraystcomm=array();
//print $form->selectarray($htmlname, $array, $search_stcomm); foreach($prospectstatic->cacheprospectstatus as $key => $val)
//print '&nbsp;'; {
$arraystcomm[$val['id']]=$val['label'];
}
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
@ -390,7 +396,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>'; print '</td>';
// Print the search button // Print the search button
@ -407,10 +413,6 @@ if ($resql)
$i = 0; $i = 0;
$var=true; $var=true;
$prospectstatic=new Client($db);
$prospectstatic->client=2;
$prospectstatic->loadCacheOfProspStatus();
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$conf->liste_limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
// Si fichier detail PDF existe // Si fichier detail PDF existe
// TODO obsolete ? // TODO deprecated ?
if (file_exists($filedetail)) if (file_exists($filedetail))
{ {
print "<tr ".$bc[$var]."><td>Commande detaillee</td>"; print "<tr ".$bc[$var]."><td>Commande detaillee</td>";

View File

@ -1214,6 +1214,7 @@ llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:Commandes_Clients|
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formorder = new FormOrder($db); $formorder = new FormOrder($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
/** /**
* ******************************************************************* * *******************************************************************
@ -1320,7 +1321,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>'; print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
// Reference client // Reference client
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
@ -1422,14 +1423,16 @@ if ($action == 'create' && $user->rights->commande->creer)
// Project // Project
if (! empty($conf->projet->enabled) && $socid > 0) if (! empty($conf->projet->enabled) && $socid > 0)
{ {
$formproject = new FormProjets($db); $projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">'; $langs->load("projects");
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
if ($numprojet == 0) { print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>'; print '</td>';
} print '</tr>';
print '</td></tr>';
} }
// Incoterms // Incoterms
@ -1458,29 +1461,30 @@ if ($action == 'create' && $user->rights->commande->creer)
print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF); print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF);
print "</td></tr>"; print "</td></tr>";
// Note publique // Note public
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
// print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>'; // print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>'; print '</td></tr>';
// Note privee // Note private
if (empty($user->societe_id)) { if (empty($user->societe_id)) {
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
// print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>'; // print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>'; print '</td></tr>';
} }
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
{
// TODO for compatibility // TODO for compatibility
if ($origin == 'contrat') { if ($origin == 'contrat') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
@ -1514,8 +1518,11 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
} else { }
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { else
{
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE))
{
/* /*
* Services/produits predefinis * Services/produits predefinis
*/ */

View File

@ -74,17 +74,15 @@ class Commande extends CommonOrder
/** /**
* Status of the order. Check the following constants: * Status of the order. Check the following constants:
* - STATUS_CANCELED
* - STATUS_DRAFT
* - STATUS_ACCEPTED
* - STATUS_CLOSED
* @var int * @var int
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
*/ */
var $statut; var $statut;
/** /**
* @deprecated * @deprecated
* @see billed
*/ */
var $facturee; // deprecated var $facturee;
var $billed; // billed or not var $billed; // billed or not
var $brouillon; var $brouillon;
@ -100,7 +98,11 @@ class Commande extends CommonOrder
var $fk_delivery_address; var $fk_delivery_address;
var $address; var $address;
var $date; // Date commande var $date; // Date commande
var $date_commande; // Date commande (deprecated) /**
* @deprecated
* @see date
*/
var $date_commande;
var $date_livraison; // Date livraison souhaitee var $date_livraison; // Date livraison souhaitee
var $shipping_method_id; var $shipping_method_id;
var $fk_remise_except; var $fk_remise_except;
@ -116,7 +118,11 @@ class Commande extends CommonOrder
var $rang; var $rang;
var $special_code; var $special_code;
var $source; // Origin of order var $source; // Origin of order
var $note; // deprecated /**
* @deprecated
* @see note_private, note_public
*/
var $note;
var $note_private; var $note_private;
var $note_public; var $note_public;
var $extraparams=array(); var $extraparams=array();
@ -1033,7 +1039,9 @@ class Commande extends CommonOrder
*/ */
function createFromProposal($object) function createFromProposal($object)
{ {
global $conf,$user,$langs,$hookmanager; global $db, $conf,$user,$langs,$hookmanager;
dol_include_once('/core/class/extrafields.class.php');
$error=0; $error=0;
@ -1104,9 +1112,15 @@ class Commande extends CommonOrder
// get extrafields from original line // get extrafields from original line
$object->fetch_optionals($object->id); $object->fetch_optionals($object->id);
foreach($object->array_options as $options_key => $value)
$this->array_options[$options_key] = $value;
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
}
}
// Possibility to add external linked objects with hooks // Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id; $this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
@ -1728,6 +1742,7 @@ class Commande extends CommonOrder
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
return 1; return 1;
@ -1776,7 +1791,7 @@ class Commande extends CommonOrder
* @param int $filtre_statut Filter on status * @param int $filtre_statut Filter on status
* @return int <0 if KO, Nb of lines found if OK * @return int <0 if KO, Nb of lines found if OK
* *
* TODO deprecated, move to Shipping class * TODO deprecate, move to Shipping class
*/ */
function loadExpeditions($filtre_statut=-1) function loadExpeditions($filtre_statut=-1)
{ {
@ -1823,7 +1838,7 @@ class Commande extends CommonOrder
* *
* @return int Nb of shipments * @return int Nb of shipments
* *
* TODO deprecated, move to Shipping class * TODO deprecate, move to Shipping class
*/ */
function nb_expedition() function nb_expedition()
{ {
@ -1849,7 +1864,7 @@ class Commande extends CommonOrder
* @param int $filtre_statut Filtre sur statut * @param int $filtre_statut Filtre sur statut
* @return int 0 si OK, <0 si KO * @return int 0 si OK, <0 si KO
* *
* TODO deprecated, move to Shipping class * TODO deprecate, move to Shipping class
*/ */
function livraison_array($filtre_statut=self::STATUS_CANCELED) function livraison_array($filtre_statut=self::STATUS_CANCELED)
{ {
@ -2399,9 +2414,12 @@ class Commande extends CommonOrder
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
* @deprecated * @deprecated
* @see classifyBilled()
*/ */
function classer_facturee() function classer_facturee()
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $this->classifyBilled(); return $this->classifyBilled();
} }
@ -3346,6 +3364,7 @@ class OrderLine extends CommonOrderLine
* Id of parent order * Id of parent order
* @var int * @var int
* @deprecated Use fk_commande * @deprecated Use fk_commande
* @see fk_commande
*/ */
public $commande_id; public $commande_id;
@ -3367,6 +3386,7 @@ class OrderLine extends CommonOrderLine
/** /**
* @deprecated * @deprecated
* @see remise_percent, fk_remise_except
*/ */
var $remise; var $remise;

View File

@ -41,6 +41,7 @@ class Account extends CommonObject
/** /**
* @var int Use id instead of rowid * @var int Use id instead of rowid
* @deprecated * @deprecated
* @see id
*/ */
var $rowid; var $rowid;
var $id; var $id;
@ -240,6 +241,11 @@ class Account extends CommonObject
*/ */
function addline($date, $oper, $label, $amount, $num_chq, $categorie, $user, $emetteur='',$banque='') function addline($date, $oper, $label, $amount, $num_chq, $categorie, $user, $emetteur='',$banque='')
{ {
// Deprecatîon warning
if (is_numeric($oper)) {
dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING);
}
// Clean parameters // Clean parameters
$emetteur=trim($emetteur); $emetteur=trim($emetteur);
$banque=trim($banque); $banque=trim($banque);

View File

@ -44,7 +44,11 @@ class Deplacement extends CommonObject
var $fk_user_author; var $fk_user_author;
var $fk_user; var $fk_user;
var $km; var $km;
var $note; // TODO obsolete /**
* @deprecated
* @see note_private, note_public
*/
var $note; // TODO deprecated
var $note_private; var $note_private;
var $note_public; var $note_public;
var $socid; var $socid;

View File

@ -1854,6 +1854,8 @@ $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$bankaccountstatic = new Account($db); $bankaccountstatic = new Account($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$now = dol_now(); $now = dol_now();
llxHeader('', $langs->trans('Bill'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); llxHeader('', $langs->trans('Bill'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
@ -2080,22 +2082,21 @@ if ($action == 'create')
} }
print '<tr><td valign="top" class="fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">'; print '<tr><td valign="top" class="fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">';
print '<table class="nobordernopadding">' . "\n";
print '<div class="tagtable">' . "\n";
// Standard invoice // Standard invoice
print '<tr height="18"><td width="16px" valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '>'; $tmp='<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '> ';
print '</td><td valign="middle">'; $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
$desc = $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1);
print $desc; print $desc;
print '</td></tr>' . "\n"; print '</div></div>';
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
{ {
// Deposit // Deposit
print '<tr height="18"><td width="16px" valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '>'; $tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
print '</td><td valign="middle" class="nowrap">';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#typedeposit, #valuedeposit").click(function() { jQuery("#typedeposit, #valuedeposit").click(function() {
@ -2103,9 +2104,13 @@ if ($action == 'create')
}); });
}); });
</script>'; </script>';
$desc = $form->textwithpicto($langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1);
print '<table class="nobordernopadding"><tr><td>' . $desc . '</td>'; $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
if (($origin == 'propal') || ($origin == 'commande')) { print '<table class="nobordernopadding"><tr><td>';
print $desc;
print '</td>';
if (($origin == 'propal') || ($origin == 'commande'))
{
print '<td class="nowrap" style="padding-left: 5px">'; print '<td class="nowrap" style="padding-left: 5px">';
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
@ -2113,44 +2118,41 @@ if ($action == 'create')
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>'; print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr>' . "\n";
print '</div></div>';
} }
if ($socid > 0) if ($socid > 0)
{ {
if (! empty($conf->global->INVOICE_USE_SITUATION)) if (! empty($conf->global->INVOICE_USE_SITUATION))
{ {
// First situation invoice // First situation invoice
print '<tr height="18"><td width="16px" valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '>'; $tmp='<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
print '</td><td valign="middle">'; $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
$desc = $form->textwithpicto($langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1); print $desc;
print $desc; print '</div></div>';
print '</td></tr>' . "\n";
// Next situation invoice // Next situation invoice
$opt = $form->load_situation_invoices(GETPOST('originid'), $socid); $opt = $form->load_situation_invoices(GETPOST('originid'), $socid);
print '<tr height="18"><td valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked' : '') . ' '; $tmp='<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked' : '');
if ($opt == '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>' || (GETPOST('origin') && GETPOST('origin') != 'facture')) print 'disabled'; if ($opt == ('<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture')) $tmp.=' disabled';
print '>'; $tmp.= '> ';
print '</td><td valign="middle">'; $text = $tmp.$langs->trans("InvoiceSituationAsk") . ' ';
$text = $langs->trans("InvoiceSituationAsk") . ' '; $text .= '<select class="flat" id="situations" name="situations">';
$text .= '<select class="flat" id="situations" name="situations">'; $text .= $opt;
$text .= $opt; $text .= '</select>';
$text .= '</select>'; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1); print $desc;
print $desc; print '</div></div>';
print '</td></tr>' . "\n";
} }
// Replacement // Replacement
print '<tr height="18"><td valign="middle">'; print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
if (! $options) if (! $options) $tmp.=' disabled';
print ' disabled'; $tmp.='> ';
print '>';
print '</td><td valign="middle">';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() { jQuery("#fac_replacement").change(function() {
@ -2158,7 +2160,7 @@ if ($action == 'create')
}); });
}); });
</script>'; </script>';
$text = $langs->trans("InvoiceReplacementAsk") . ' '; $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"'; $text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
if (! $options) if (! $options)
$text .= ' disabled'; $text .= ' disabled';
@ -2170,20 +2172,19 @@ if ($action == 'create')
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>'; $text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
} }
$text .= '</select>'; $text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</td></tr>' . "\n"; print '</div></div>';
} }
else else
{ {
print '<tr height="18"><td valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" name="type" id="radio_replacement" value="0" disabled>'; $tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
print '</td><td valign="middle">'; $text = $tmp.$langs->trans("InvoiceReplacement") . ' ';
$text = $langs->trans("InvoiceReplacement") . ' ';
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</td></tr>' . "\n"; print '</div></div>';
} }
if (empty($origin)) if (empty($origin))
@ -2191,12 +2192,10 @@ if ($action == 'create')
if ($socid > 0) if ($socid > 0)
{ {
// Credit note // Credit note
print '<tr height="18"><td valign="top">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : ''); $tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) if (! $optionsav) $tmp.=' disabled';
print ' disabled'; $tmp.= '> ';
print '>';
print '</td><td valign="top">';
// Show credit note options only if we checked credit note // Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -2212,7 +2211,7 @@ if ($action == 'create')
}); });
}); });
</script>'; </script>';
$text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
// $text.='<input type="text" value="">'; // $text.='<input type="text" value="">';
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"'; $text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
if (! $optionsav) if (! $optionsav)
@ -2225,7 +2224,7 @@ if ($action == 'create')
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>'; $text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
} }
$text .= '</select>'; $text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '<div id="credit_note_options">'; print '<div id="credit_note_options">';
@ -2233,22 +2232,22 @@ if ($action == 'create')
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>"; print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>'; print '</div>';
print '</td></tr>' . "\n"; print '</div></div>';
} }
else else
{ {
print '<tr height="18"><td valign="middle">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
print '<input type="radio" name="type" id="radio_creditnote" value="0" disabled>'; $tmp='<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
print '</td><td valign="middle">'; $text = $tmp.$langs->trans("InvoiceAvoir") . ' ';
$text = $langs->trans("InvoiceAvoir") . ' ';
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</td></tr>' . "\n"; print '</div></div>' . "\n";
} }
} }
print '</table>'; print '</div>';
print '</td></tr>'; print '</td></tr>';
if ($socid > 0) if ($socid > 0)
@ -2293,12 +2292,15 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled) && $socid > 0) { if (! empty($conf->projet->enabled) && $socid > 0)
$formproject = new FormProjets($db); {
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects($soc->id, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>'; print '</td></tr>';
} }
@ -2320,7 +2322,7 @@ if ($action == 'create')
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }
// Modele PDF // Template to use by default
print '<tr><td>' . $langs->trans('Model') . '</td>'; print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>'; print '<td>';
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
@ -2337,7 +2339,7 @@ if ($action == 'create')
{ {
$note_public = $objectsrc->note_public; $note_public = $objectsrc->note_public;
} }
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
// Private note // Private note
@ -2351,7 +2353,7 @@ if ($action == 'create')
{ {
$note_private = $objectsrc->note_private; $note_private = $objectsrc->note_private;
} }
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea> // print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>'; print '</td></tr>';
@ -2418,7 +2420,9 @@ if ($action == 'create')
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>"; print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
} }
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
} else { }
else
{
// Show deprecated optional form to add product line here // Show deprecated optional form to add product line here
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) { if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) {
print '<tr><td colspan="3">'; print '<tr><td colspan="3">';
@ -3486,50 +3490,50 @@ if ($action == 'create')
// Show global modifiers // Show global modifiers
if (! empty($conf->global->INVOICE_US_SITUATION)) if (! empty($conf->global->INVOICE_US_SITUATION))
{ {
if ($object->situation_cycle_ref && $object->statut == 0) { if ($object->situation_cycle_ref && $object->statut == 0) {
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">'; print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
print '<input type="hidden" name="action" value="updatealllines" />'; print '<input type="hidden" name="action" value="updatealllines" />';
print '<input type="hidden" name="id" value="' . $object->id . '" />'; print '<input type="hidden" name="id" value="' . $object->id . '" />';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>'; print '<td align="center" width="5">&nbsp;</td>';
}
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
print '<td align="right" width="50">&nbsp;</td>';
print '<td align="right" width="80">&nbsp;</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">&nbsp;</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
print '<td align="right" class="margininfos" width="80">&nbsp;</td>';
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) {
print '<td align="right" class="margininfos" width="50">&nbsp;</td>';
} }
} print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
print '<td align="right" width="50">&nbsp;</td>'; print '<td align="right" width="50">&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td align="right" width="80">&nbsp;</td>';
print '<td width="10">&nbsp;</td>'; if ($inputalsopricewithtax) print '<td align="right" width="80">&nbsp;</td>';
print '<td width="10">&nbsp;</td>'; print '<td align="right" width="50">&nbsp</td>';
print "</tr>\n"; print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
print '<td align="right" class="margininfos" width="80">&nbsp;</td>';
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) {
print '<td align="right" class="margininfos" width="50">&nbsp;</td>';
}
}
print '<td align="right" width="50">&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print "</tr>\n";
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>'; print '<td align="center" width="5">&nbsp;</td>';
}
print '<tr width="100%" class="nodrag nodrop">';
print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td align="right" class="nowrap"><input type="text" size="1" value="" name="all_progress">%</td>';
print '<td colspan="4" align="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '</tr>';
print '</form>';
} }
print '<tr width="100%" height="18" class="nodrag nodrop">';
print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td align="right" class="nowrap"><input type="text" size="1" value="" name="all_progress">%</td>';
print '<td colspan="4" align="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '</tr>';
print '</form>';
}
} }
// Show object lines // Show object lines

View File

@ -92,18 +92,16 @@ class Facture extends CommonInvoice
var $revenuestamp; var $revenuestamp;
/** /**
* @deprecated * @deprecated
* @see note_private, note_public
*/ */
var $note; var $note;
var $note_private; var $note_private;
var $note_public; var $note_public;
/** /**
* Check constants for more info: * Invoice status
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_PAID
* - STATUS_ABANDONED
* @var int * @var int
* @see Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_PAID, Facture::STATUS_ABANDONED
*/ */
var $statut; var $statut;
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon //! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
@ -131,6 +129,9 @@ class Facture extends CommonInvoice
* @deprecated * @deprecated
*/ */
var $products=array(); var $products=array();
/**
* @var FactureLigne[]
*/
var $lines=array(); var $lines=array();
var $line; var $line;
var $extraparams=array(); var $extraparams=array();
@ -1119,7 +1120,8 @@ class Facture extends CommonInvoice
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$line = new FactureLigne($this->db); $line = new FactureLigne($this->db);
$line->rowid = $objp->rowid; $line->id = $objp->rowid;
$line->rowid = $objp->rowid; // deprecated
$line->label = $objp->custom_label; // deprecated $line->label = $objp->custom_label; // deprecated
$line->desc = $objp->description; // Description line $line->desc = $objp->description; // Description line
$line->product_type = $objp->product_type; // Type of line $line->product_type = $objp->product_type; // Type of line
@ -2105,6 +2107,11 @@ class Facture extends CommonInvoice
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null)
{ {
// Deprecation warning
if ($label) {
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
}
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline facid=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline facid=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
@ -2289,6 +2296,11 @@ class Facture extends CommonInvoice
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
{ {
// Deprecation warning
if ($label) {
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
global $mysoc; global $mysoc;
@ -3685,7 +3697,10 @@ class FactureLigne extends CommonInvoiceLine
var $fk_facture; var $fk_facture;
//! Id parent line //! Id parent line
var $fk_parent_line; var $fk_parent_line;
var $label; // deprecated /**
* @deprecated
*/
var $label;
//! Description ligne //! Description ligne
var $desc; var $desc;
@ -3717,8 +3732,16 @@ class FactureLigne extends CommonInvoiceLine
//var $remise; // Montant calcule de la remise % sur PU HT (exemple 20) //var $remise; // Montant calcule de la remise % sur PU HT (exemple 20)
// From llx_product // From llx_product
/**
* @deprecated
* @see product_ref
*/
var $ref; // Product ref (deprecated) var $ref; // Product ref (deprecated)
var $product_ref; // Product ref var $product_ref; // Product ref
/**
* @deprecated
* @see product_label
*/
var $libelle; // Product label (deprecated) var $libelle; // Product label (deprecated)
var $product_label; // Product label var $product_label; // Product label
var $product_desc; // Description produit var $product_desc; // Description produit

View File

@ -37,6 +37,7 @@ $langs->load('propal');
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$langs->load("bills"); $langs->load("bills");
$langs->load('companies');
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility

View File

@ -36,6 +36,7 @@ if (!$user->rights->facture->lire) accessforbidden();
$langs->load("bills"); $langs->load("bills");
$langs->load("banks"); $langs->load("banks");
$langs->load("withdrawals"); $langs->load("withdrawals");
$langs->load('companies');
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');

View File

@ -40,7 +40,16 @@ class Paiement extends CommonObject
var $ref; var $ref;
var $facid; var $facid;
var $datepaye; var $datepaye;
var $total; // deprecated /**
* @deprecated
* @see amount, amounts
*/
var $total;
/**
* @deprecated
* @see amount, amounts
*/
var $montant;
var $amount; // Total amount of payment var $amount; // Total amount of payment
var $amounts=array(); // Array of amounts var $amounts=array(); // Array of amounts
var $author; var $author;

View File

@ -40,6 +40,11 @@ class PaymentSocialContribution extends CommonObject
var $datec=''; var $datec='';
var $tms=''; var $tms='';
var $datep=''; var $datep='';
/**
* @deprecated
* @see amount
*/
var $total;
var $amount; // Total amount of payment var $amount; // Total amount of payment
var $amounts=array(); // Array of amounts var $amounts=array(); // Array of amounts
var $fk_typepaiement; var $fk_typepaiement;

View File

@ -51,6 +51,8 @@ abstract class ActionsContactCardCommon
*/ */
private function getInstanceDao() private function getInstanceDao()
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
if (! is_object($this->object)) if (! is_object($this->object))
{ {
$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php'); $modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');

View File

@ -1105,18 +1105,14 @@ else
{ {
if ($user->rights->societe->contact->creer) if ($user->rights->societe->contact->creer)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
} }
if (! $object->user_id && $user->rights->user->user->creer) if (! $object->user_id && $user->rights->user->user->creer)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
if ($user->rights->societe->contact->supprimer)
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete'.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.$langs->trans('Delete').'</a>';
}
// Activer // Activer
if ($object->statut == 0 && $user->rights->societe->contact->creer) if ($object->statut == 0 && $user->rights->societe->contact->creer)
{ {
@ -1126,6 +1122,12 @@ else
if ($object->statut == 1 && $user->rights->societe->contact->creer) if ($object->statut == 1 && $user->rights->societe->contact->creer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
}
// Delete
if ($user->rights->societe->contact->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete'.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.$langs->trans('Delete').'</a>';
} }
} }

View File

@ -50,9 +50,21 @@ class Contact extends CommonObject
var $zip; var $zip;
var $town; var $town;
var $fk_departement; // deprecated /**
var $departement_code; // deprecated * @deprecated
var $departement; // deprecated * @see state_id
*/
var $fk_departement;
/**
* @deprecated
* @see state_code
*/
var $departement_code;
/**
* @deprecated
* @see state
*/
var $departement;
var $state_id; // Id of department var $state_id; // Id of department
var $state_code; // Code of department var $state_code; // Code of department
var $state; // Label of department var $state; // Label of department
@ -80,7 +92,11 @@ class Contact extends CommonObject
var $birthday; var $birthday;
var $default_lang; var $default_lang;
var $note_public; // Public note var $note_public; // Public note
var $note; // deprecated /**
* @deprecated
* @see note_public, note_private
*/
var $note;
var $note_private; // Private note var $note_private; // Private note
var $no_email; // 1=Don't send e-mail to this contact, 0=do var $no_email; // 1=Don't send e-mail to this contact, 0=do

View File

@ -80,8 +80,9 @@ llxHeader("",$langs->trans("Contact"), $helpurl);
if ($object->id) if ($object->id)
{ {
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
dol_fiche_head($head, 'documents', $langs->trans("Contact"), 0, 'contact'); dol_fiche_head($head, 'documents', $title, 0, 'contact');
// Construit liste des fichiers // Construit liste des fichiers

View File

@ -154,6 +154,7 @@ class Contrat extends CommonObject
/** /**
* @deprecated Use fk_project instead * @deprecated Use fk_project instead
* @see fk_project
*/ */
var $fk_projet; var $fk_projet;
@ -1642,6 +1643,8 @@ class Contrat extends CommonObject
*/ */
function update_statut($user) function update_statut($user)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
// If draft, we keep it (should not happen) // If draft, we keep it (should not happen)
if ($this->statut == 0) return 1; if ($this->statut == 0) return 1;
@ -2165,6 +2168,7 @@ class ContratLigne extends CommonObjectLine
/** /**
* @var string * @var string
* @deprecated Use $label instead * @deprecated Use $label instead
* @see label
*/ */
public $libelle; public $libelle;
@ -2189,6 +2193,7 @@ class ContratLigne extends CommonObjectLine
/** /**
* @var float * @var float
* @deprecated Use $price_ht instead * @deprecated Use $price_ht instead
* @see price_ht
*/ */
public $price; public $price;

View File

@ -118,6 +118,7 @@ abstract class CommonDocGenerator
'mycompany_idprof5'=>$mysoc->idprof5, 'mycompany_idprof5'=>$mysoc->idprof5,
'mycompany_idprof6'=>$mysoc->idprof6, 'mycompany_idprof6'=>$mysoc->idprof6,
'mycompany_vatnumber'=>$mysoc->tva_intra, 'mycompany_vatnumber'=>$mysoc->tva_intra,
'mycompany_object'=>$mysoc->object,
// Only private not exists for "mysoc" // Only private not exists for "mysoc"
'mycompany_note_private'=>$mysoc->note_private, 'mycompany_note_private'=>$mysoc->note_private,

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 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-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -44,6 +44,7 @@ abstract class CommonObject
/** /**
* @var string Error string * @var string Error string
* @deprecated Use instead the array of error strings * @deprecated Use instead the array of error strings
* @see errors
*/ */
public $error; public $error;
@ -82,7 +83,7 @@ abstract class CommonObject
public $errors=array(); public $errors=array();
/** /**
* @var string Can be used to pass information when only object is provided to method * @var string[] Can be used to pass information when only object is provided to method
*/ */
public $context=array(); public $context=array();
@ -96,7 +97,24 @@ abstract class CommonObject
public $lastname; public $lastname;
public $firstname; public $firstname;
public $civility_id; public $civility_id;
/**
* @deprecated
* @see thirdparty
*/
public $client;
/**
* @var Societe
*/
public $thirdparty; public $thirdparty;
/**
* @deprecated
* @see project
*/
public $projet;
/**
* @var Project
*/
public $project;
// No constructor as it is an abstract class // No constructor as it is an abstract class
@ -113,13 +131,15 @@ abstract class CommonObject
*/ */
static function isExistingObject($element, $id, $ref='', $ref_ext='') static function isExistingObject($element, $id, $ref='', $ref_ext='')
{ {
global $db; global $db,$conf;
$sql = "SELECT rowid, ref, ref_ext"; $sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element; $sql.= " FROM ".MAIN_DB_PREFIX.$element;
if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id); $sql.= " WHERE entity IN (".getEntity($element).")" ;
else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'";
else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'"; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'";
else { else {
$error='ErrorWrongParameters'; $error='ErrorWrongParameters';
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR); dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
@ -759,10 +779,14 @@ abstract class CommonObject
*/ */
function fetch_projet() function fetch_projet()
{ {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (empty($this->fk_project) && ! empty($this->fk_projet)) $this->fk_project = $this->fk_projet; // For backward compatibility
if (empty($this->fk_project)) return 0; if (empty($this->fk_project)) return 0;
$project = new Project($this->db); $project = new Project($this->db);
$result = $project->fetch($this->fk_project); $result = $project->fetch($this->fk_project);
$this->projet = $project; // deprecated $this->projet = $project; // deprecated
$this->project = $project; $this->project = $project;
return $result; return $result;
@ -1639,9 +1663,10 @@ abstract class CommonObject
/** /**
* Update public note (kept for backward compatibility) * Update public note (kept for backward compatibility)
* *
* @param string $note New value for note * @param string $note New value for note
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated * @deprecated
* @see update_note()
*/ */
function update_note_public($note) function update_note_public($note)
{ {
@ -3956,15 +3981,16 @@ abstract class CommonObject
* This function is meant to be called from replaceThirdparty with the appropiate tables * This function is meant to be called from replaceThirdparty with the appropiate tables
* Column name fk_soc MUST be used to identify thirdparties * Column name fk_soc MUST be used to identify thirdparties
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param array $tables Tables that need to be changed * @param array $tables Tables that need to be changed
* @return bool * @return bool
*/ */
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables) public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)
{ {
foreach ($tables as $table) { foreach ($tables as $table)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
if (!$db->query($sql)) { if (!$db->query($sql)) {

View File

@ -39,6 +39,7 @@ abstract class CommonObjectLine extends CommonObject
* Id of the line * Id of the line
* @var int * @var int
* @deprecated Try to use id property as possible (even if field into database is still rowid) * @deprecated Try to use id property as possible (even if field into database is still rowid)
* @see id
*/ */
public $rowid; public $rowid;

View File

@ -43,6 +43,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product ref * Product ref
* @var string * @var string
* @deprecated Use product_ref * @deprecated Use product_ref
* @see product_ref
*/ */
public $ref; public $ref;
@ -56,6 +57,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product label * Product label
* @var string * @var string
* @deprecated Use product_label * @deprecated Use product_label
* @see product_label
*/ */
public $libelle; public $libelle;
@ -78,7 +80,9 @@ abstract class CommonOrderLine extends CommonObjectLine
public $qty; public $qty;
/** /**
* Unit price
* @deprecated * @deprecated
* @see subprice
*/ */
var $price; var $price;

View File

@ -376,7 +376,7 @@ class Form
* @return string Code html du tooltip (texte+picto) * @return string Code html du tooltip (texte+picto)
* @see Use function textwithpicto if you can. * @see Use function textwithpicto if you can.
*/ */
function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 0, $incbefore = '', $noencodehtmltext = 0) function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0)
{ {
global $conf; global $conf;
@ -391,14 +391,19 @@ class Form
$htmltext=str_replace("\r","",$htmltext); $htmltext=str_replace("\r","",$htmltext);
$htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace("\n","",$htmltext);
$extrastyle='';
if ($direction < 0) { $extracss=($extracss?$extracss.' ':'').'inline-block'; $extrastyle='padding: 0px; padding-left: 3px !important;'; }
if ($direction > 0) { $extracss=($extracss?$extracss.' ':'').'inline-block'; $extrastyle='padding: 0px; padding-right: 3px !important;'; }
$htmltext=str_replace('"',"&quot;",$htmltext); $htmltext=str_replace('"',"&quot;",$htmltext);
if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip if ($tooltipon == 2 || $tooltipon == 3) $paramfortooltipimg=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td img tag to store tooltip
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag
$s=""; $s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr style="height: auto;">'; if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr style="height: auto;">';
elseif ($notabs == 2) $s.='<div class="inline-block nowrap">'; elseif ($notabs == 2) $s.='<div class="inline-block nowrap">';
// Define value if value is before
if ($direction < 0) { if ($direction < 0) {
$s.='<'.$tag.$paramfortooltipimg; $s.='<'.$tag.$paramfortooltipimg;
if ($tag == 'td') { if ($tag == 'td') {
@ -407,16 +412,12 @@ class Form
$s.= '>'.$img.'</'.$tag.'>'; $s.= '>'.$img.'</'.$tag.'>';
} }
// Use another method to help avoid having a space in value in order to use this value with jquery // Use another method to help avoid having a space in value in order to use this value with jquery
// TODO add this in css // Define label
//if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?'&nbsp;':'').$text.(($direction > 0)?'&nbsp;':'').'</'.$tag.'>';
$paramfortooltiptd.= (($direction < 0)?' class="inline-block" style="padding: 0px; padding-left: 3px !important;"':'');
$paramfortooltiptd.= (($direction > 0)?' class="inline-block" style="padding: 0px; padding-right: 3px !important;"':'');
if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; if ((string) $text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
// Define value if value is after
if ($direction > 0) { if ($direction > 0) {
$s.='<'.$tag.$paramfortooltipimg; $s.='<'.$tag.$paramfortooltipimg;
if ($tag == 'td') { if ($tag == 'td') $s .= ' valign="middle" width="14"';
$s .= ' valign="middle" width="14"';
}
$s.= '>'.$img.'</'.$tag.'>'; $s.= '>'.$img.'</'.$tag.'>';
} }
if (empty($notabs)) $s.='</tr></table>'; if (empty($notabs)) $s.='</tr></table>';
@ -437,7 +438,7 @@ class Form
* @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
* @return string HTML code of text, picto, tooltip * @return string HTML code of text, picto, tooltip
*/ */
function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 0) function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2)
{ {
global $conf; global $conf;
@ -858,6 +859,7 @@ class Form
* @param int $limit Maximum number of elements * @param int $limit Maximum number of elements
* @return string HTML string with * @return string HTML string with
* @deprecated Use select_thirdparty instead * @deprecated Use select_thirdparty instead
* @see select_thirdparty()
*/ */
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0) function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
{ {
@ -1227,6 +1229,7 @@ class Form
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @return void * @return void
* @deprecated * @deprecated
* @see select_dolusers()
*/ */
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
{ {
@ -1248,10 +1251,11 @@ class Form
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request * @param string $morefilter Add more filters into sql request
* @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @return string HTML select string * @return string HTML select string
* @see select_dolgroups * @see select_dolgroups
*/ */
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0) function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='')
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
@ -1347,8 +1351,8 @@ class Form
$userstatic->lastname=$obj->lastname; $userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname; $userstatic->firstname=$obj->firstname;
$disableline=0; $disableline='';
if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=1; if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1');
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid)) if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
{ {
@ -1398,6 +1402,10 @@ class Form
} }
} }
$out.=($moreinfo?')':''); $out.=($moreinfo?')':'');
if ($disableline && $disableline != '1')
{
$out.=' - '.$disableline; // This is text from $enableonlytext parameter
}
$out.= '</option>'; $out.= '</option>';
$i++; $i++;
@ -1460,7 +1468,7 @@ class Form
$assignedtouser=array(); $assignedtouser=array();
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
{ {
$assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); $assignedtouser=json_decode($_SESSION['assignedtouser'], true);
} }
$nbassignetouser=count($assignedtouser); $nbassignetouser=count($assignedtouser);
@ -3029,6 +3037,7 @@ class Form
* @param int $width Force width of box * @param int $width Force width of box
* @return void * @return void
* @deprecated * @deprecated
* @see formconfirm()
*/ */
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500)
{ {
@ -3086,7 +3095,7 @@ class Form
// Now add questions // Now add questions
$more.='<table class="paddingrightonly" width="100%">'."\n"; $more.='<table class="paddingrightonly" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n"; $more.='<tr><td colspan="3">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
if (is_array($input) && ! empty($input)) if (is_array($input) && ! empty($input))
@ -3095,15 +3104,15 @@ class Form
if ($input['type'] == 'text') if ($input['type'] == 'text')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'password') else if ($input['type'] == 'password')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'select') else if ($input['type'] == 'select')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
@ -3111,13 +3120,13 @@ class Form
else if ($input['type'] == 'checkbox') else if ($input['type'] == 'checkbox')
{ {
$more.='<tr>'; $more.='<tr>';
$more.='<td valign="top">'.$input['label'].' </td><td valign="top" align="left">'; $more.='<td>'.$input['label'].' </td><td align="left">';
$more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'; $more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked'; if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked';
if (is_bool($input['value']) && $input['value']) $more.=' checked'; if (is_bool($input['value']) && $input['value']) $more.=' checked';
if (isset($input['disabled'])) $more.=' disabled'; if (isset($input['disabled'])) $more.=' disabled';
$more.=' /></td>'; $more.=' /></td>';
$more.='<td valign="top" align="left">&nbsp;</td>'; $more.='<td align="left">&nbsp;</td>';
$more.='</tr>'."\n"; $more.='</tr>'."\n";
} }
else if ($input['type'] == 'radio') else if ($input['type'] == 'radio')
@ -3128,10 +3137,10 @@ class Form
$more.='<tr>'; $more.='<tr>';
if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>'; if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>';
else $more.='<td>&nbsp;</td>'; else $more.='<td>&nbsp;</td>';
$more.='<td valign="top" width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'; $more.='<td width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"';
if ($input['disabled']) $more.=' disabled'; if ($input['disabled']) $more.=' disabled';
$more.=' /></td>'; $more.=' /></td>';
$more.='<td valign="top" align="left">'; $more.='<td align="left">';
$more.=$selval; $more.=$selval;
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
$i++; $i++;
@ -3139,8 +3148,8 @@ class Form
} }
else if ($input['type'] == 'other') else if ($input['type'] == 'other')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td colspan="2" align="left">';
$more.=$input['value']; $more.=$input['value'];
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }
@ -4248,6 +4257,7 @@ class Form
$hourSelected=0; $minSelected=0; $hourSelected=0; $minSelected=0;
// Hours
if ($iSecond != '') if ($iSecond != '')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -4278,6 +4288,7 @@ class Form
$retstring.=' '.$langs->trans('HourShort'); $retstring.=' '.$langs->trans('HourShort');
// Minutes
if ($minunderhours) $retstring.='<br>'; if ($minunderhours) $retstring.='<br>';
else $retstring.="&nbsp;"; else $retstring.="&nbsp;";
@ -4726,33 +4737,47 @@ class Form
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':''; //$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':'';
$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':''; //$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':'';
$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?'<':'&nbsp;').'</a>':'';
$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?'>':'&nbsp;').'</a>':'';
//print "xx".$previous_ref."x".$next_ref; //print "xx".$previous_ref."x".$next_ref;
if ($previous_ref || $next_ref || $morehtml) { //if ($previous_ref || $next_ref || $morehtml) {
$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; //$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
} $ret.='<div style="vertical-align: middle"><div class="inline-block floatleft refid">';
//}
$ret.=dol_htmlentities($object->$fieldref); $ret.=dol_htmlentities($object->$fieldref);
if ($morehtmlref) if ($morehtmlref)
{ {
$ret.=' '.$morehtmlref; $ret.=' '.$morehtmlref;
} }
$ret.='</div>';
if ($previous_ref || $next_ref || $morehtml)
{
$ret.='<div class="pagination"><ul>';
}
if ($morehtml) if ($morehtml)
{ {
$ret.='</td><td class="paddingrightonly" align="right">'.$morehtml; //$ret.='</td><td class="paddingrightonly" align="right">'.$morehtml;
$ret.='<li class="noborder litext">'.$morehtml.'</li>';
} }
if ($shownav && ($previous_ref || $next_ref)) if ($shownav && ($previous_ref || $next_ref))
{ {
$ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>'; //$ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>';
$ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref; //$ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref;
$ret.='<li class="pagination">'.$previous_ref.'</li>';
$ret.='<li class="pagination">'.$next_ref.'</li>';
} }
if ($previous_ref || $next_ref || $morehtml) if ($previous_ref || $next_ref || $morehtml)
{ {
$ret.='</td></tr></table>'; //$ret.='</td></tr></table>';
$ret.='</ul></div>';
} }
$ret.='</div>';
return $ret; return $ret;
} }
@ -4794,10 +4819,10 @@ class Form
* @param int $width Width of photo * @param int $width Width of photo
* @param int $height Height of photo (auto if 0) * @param int $height Height of photo (auto if 0)
* @param int $caneditfield Add edit fields * @param int $caneditfield Add edit fields
* @param string $photologo CSS name to use on img for photo * @param string $cssclass CSS name to use on img for photo
* @return string HTML code to output photo * @return string HTML code to output photo
*/ */
static function showphoto($modulepart,$object,$width=100,$height=0,$caneditfield=0,$cssclass='photowithmargin') static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin')
{ {
global $conf,$langs; global $conf,$langs;

View File

@ -423,6 +423,7 @@ class FormCompany
* @param string $filter Add a SQL filter on list * @param string $filter Add a SQL filter on list
* @return void * @return void
* @deprecated Use print xxx->select_juridicalstatus instead * @deprecated Use print xxx->select_juridicalstatus instead
* @see select_juridicalstatus()
*/ */
function select_forme_juridique($selected='', $country_codeid=0, $filter='') function select_forme_juridique($selected='', $country_codeid=0, $filter='')
{ {
@ -513,7 +514,7 @@ class FormCompany
} }
} }
$out.= '</select>'; $out.= '</select>';
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
// Make select dynamic // Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';

View File

@ -249,7 +249,7 @@ class FormFile
* @param string $modelselected Model to preselect by default * @param string $modelselected Model to preselect by default
* @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning)
* @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined)
* @param int $iconPDF Obsolete, see getDocumentsLink * @param int $iconPDF Deprecated, see getDocumentsLink
* @param int $maxfilenamelength Max length for filename shown * @param int $maxfilenamelength Max length for filename shown
* @param string $noform Do not output html form tags * @param string $noform Do not output html form tags
* @param string $param More param on http links * @param string $param More param on http links
@ -261,6 +261,11 @@ class FormFile
*/ */
function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='')
{ {
// Deprecation warning
if (0 !== $iconPDF) {
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
}
global $langs, $conf, $user, $hookmanager; global $langs, $conf, $user, $hookmanager;
global $form, $bc; global $form, $bc;

View File

@ -48,7 +48,16 @@ class FormMail extends Form
var $withsubstit; // Show substitution array var $withsubstit; // Show substitution array
var $withfrom; var $withfrom;
var $withto; // Show recipient emails /**
* @var int
* @deprecated Fill withto with array before calling method.
* @see withto
*/
public $withtosocid;
/**
* @var int|int[]
*/
public $withto; // Show recipient emails
var $withtofree; // Show free text for recipient emails var $withtofree; // Show free text for recipient emails
var $withtocc; var $withtocc;
var $withtoccc; var $withtoccc;
@ -275,7 +284,7 @@ class FormMail extends Form
$out.= "\n<!-- Debut form mail -->\n"; $out.= "\n<!-- Debut form mail -->\n";
if ($this->withform == 1) if ($this->withform == 1)
{ {
$out.= '<form method="POST" name="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n"; $out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n";
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">'; $out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; $out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
$out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />'; $out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
@ -703,6 +712,23 @@ class FormMail extends Form
$out.= '</table>'."\n"; $out.= '</table>'."\n";
if ($this->withform == 1) $out.= '</form>'."\n"; if ($this->withform == 1) $out.= '</form>'."\n";
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTER is set
if (! empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY))
{
$out.= '<script type="text/javascript" language="javascript">';
$out.= 'jQuery(document).ready(function () {';
$out.= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is calle at every key pressed ! */
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});';
$out.=' })';
$out.= '</script>';
}
$out.= "<!-- Fin form mail -->\n"; $out.= "<!-- Fin form mail -->\n";
return $out; return $out;

View File

@ -592,6 +592,7 @@ class FormOther
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813') * @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @return void * @return void
* @deprecated * @deprecated
* @see selectColor()
*/ */
function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
{ {
@ -611,6 +612,11 @@ class FormOther
*/ */
function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
{ {
// Deprecation warning
if ($form_name) {
dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
}
global $langs,$conf; global $langs,$conf;
$out=''; $out='';

View File

@ -147,13 +147,15 @@ class FormProjets
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
} }
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0) if (!empty($selected) && $selected == $obj->rowid)
{ {
$out.= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; $out.= '<option value="'.$obj->rowid.'" selected';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out.= '>'.$labeltoshow.'</option>';
} }
else else
{ {
if ($hideunselectables && $disabled) if ($hideunselectables && $disabled && ($selected != $obj->rowid))
{ {
$resultat=''; $resultat='';
} }
@ -194,12 +196,14 @@ class FormProjets
* *
* @param string $table_element Table of the element to update * @param string $table_element Table of the element to update
* @param int $socid socid to filter * @param int $socid socid to filter
* @return string The HTML select list of element * @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/ */
function select_element($table_element,$socid=0) function select_element($table_element,$socid=0)
{ {
global $conf, $langs; global $conf, $langs;
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$projectkey="fk_projet"; $projectkey="fk_projet";
switch ($table_element) switch ($table_element)
{ {
@ -231,7 +235,7 @@ class FormProjets
$sql.= " FROM ".MAIN_DB_PREFIX.$table_element; $sql.= " FROM ".MAIN_DB_PREFIX.$table_element;
$sql.= " WHERE ".$projectkey." is null"; $sql.= " WHERE ".$projectkey." is null";
if (!empty($socid)) $sql.= " AND fk_soc=".$socid; if (! empty($socid) && ! in_array($table_element, array('don'))) $sql.= " AND fk_soc=".$socid;
if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND entity='.getEntity('project'); if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND entity='.getEntity('project');
$sql.= " ORDER BY ref DESC"; $sql.= " ORDER BY ref DESC";

View File

@ -707,6 +707,7 @@ class Translate
* @param string $amount If not '', show currency + amount according to langs ($10, 10€). * @param string $amount If not '', show currency + amount according to langs ($10, 10€).
* @return string Amount + Currency symbol encoded into UTF8 * @return string Amount + Currency symbol encoded into UTF8
* @deprecated Use method price to output a price * @deprecated Use method price to output a price
* @see price()
*/ */
function getCurrencyAmount($currency_code, $amount) function getCurrencyAmount($currency_code, $amount)
{ {

View File

@ -833,6 +833,7 @@ function unActivateModule($value, $requiredby=1)
{ {
$objMod = new $modName($db); $objMod = new $modName($db);
$result=$objMod->remove(); $result=$objMod->remove();
if ($result <= 0) $ret=$objMod->error;
} }
else else
{ {
@ -846,7 +847,7 @@ function unActivateModule($value, $requiredby=1)
} }
// Desactivation des modules qui dependent de lui // Desactivation des modules qui dependent de lui
if ($requiredby) if (! $ret && $requiredby)
{ {
$countrb=count($objMod->requiredby); $countrb=count($objMod->requiredby);
for ($i = 0; $i < $countrb; $i++) for ($i = 0; $i < $countrb; $i++)

View File

@ -82,7 +82,7 @@ function societe_prepare_head(Societe $object)
$h++; $h++;
} }
//show categorie tab //show categorie tab
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) /*if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$type = Categorie::TYPE_CUSTOMER; $type = Categorie::TYPE_CUSTOMER;
@ -91,7 +91,7 @@ function societe_prepare_head(Societe $object)
$head[$h][1] = $langs->trans('Categories'); $head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category'; $head[$h][2] = 'category';
$h++; $h++;
} }*/
// Tab to link resources // Tab to link resources
if ($conf->resource->enabled && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES)) if ($conf->resource->enabled && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES))

View File

@ -278,8 +278,8 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt
* YYYYMMDDHHMMSS * YYYYMMDDHHMMSS
* YYYYMMDDTHHMMSSZ * YYYYMMDDTHHMMSSZ
* YYYY-MM-DDTHH:MM:SSZ (RFC3339) * YYYY-MM-DDTHH:MM:SSZ (RFC3339)
* DD/MM/YY or DD/MM/YYYY (this format should not be used anymore) * DD/MM/YY or DD/MM/YYYY (deprecated)
* DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (this format should not be used anymore) * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated)
* @param int $gm 1 =Input date is GM date, * @param int $gm 1 =Input date is GM date,
* 0 =Input date is local date using PHP server timezone * 0 =Input date is local date using PHP server timezone
* @return int Date as a timestamp * @return int Date as a timestamp
@ -292,7 +292,7 @@ function dol_stringtotime($string, $gm=1)
// Convert date with format DD/MM/YYY HH:MM:SS. This part of code should not be used. // Convert date with format DD/MM/YYY HH:MM:SS. This part of code should not be used.
if (preg_match('/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$string,$reg)) if (preg_match('/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$string,$reg))
{ {
dol_syslog("dol_stringtotime call to function with deprecated parameter", LOG_WARNING); dol_syslog("dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
// Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS' // Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS'
// Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS' // Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS'
$sday = $reg[1]; $sday = $reg[1];

View File

@ -24,15 +24,14 @@
/** /**
* Prepare array with list of admin tabs * Prepare array with list of admin tabs
* *
* @param Donation $object Donation
* @return array Array of tabs to show * @return array Array of tabs to show
*/ */
function donation_admin_prepare_head($object) function donation_admin_prepare_head()
{ {
global $langs, $conf; global $langs, $conf;
$h = 0; $h = 0;
$head = array (); $head = array();
$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php'; $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php';
$head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][1] = $langs->trans("Miscellaneous");
@ -43,14 +42,14 @@ function donation_admin_prepare_head($object)
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin'); complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin');
$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php'; $head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin', 'remove');
return $head; return $head;
} }
@ -66,7 +65,7 @@ function donation_prepare_head($object)
global $langs, $conf; global $langs, $conf;
$h = 0; $h = 0;
$head = array (); $head = array();
$head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id; $head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");

View File

@ -45,10 +45,13 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* @param string $class Class name * @param string $class Class name
* @param string $member Name of property * @param string $member Name of property
* @return mixed Return value of static property * @return mixed Return value of static property
* @deprecated Dolibarr now requires 5.3.0+ * @deprecated Dolibarr now requires 5.3.0+, use $class::$property syntax
* @see https://php.net/manual/language.oop5.static.php
*/ */
function getStaticMember($class, $member) function getStaticMember($class, $member)
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
// This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
/*if (version_compare(phpversion(), '5.3.0', '<')) /*if (version_compare(phpversion(), '5.3.0', '<'))
{ {
@ -227,7 +230,7 @@ function dol_shutdown()
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails) * @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails)
* @param mixed $options Options to pass to filter_var when $check is set to custom * @param mixed $options Options to pass to filter_var when $check is set to custom
* @return string||string[] Value found (string or array), or '' if check fails * @return string|string[] Value found (string or array), or '' if check fails
*/ */
function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
{ {
@ -387,11 +390,12 @@ function dol_buildpath($path, $type=0)
* *
* @param object $object Object to clone * @param object $object Object to clone
* @return object Object clone * @return object Object clone
* @deprecated Dolibarr no longer supports PHP4, you can now use native function * @deprecated Dolibarr no longer supports PHP4, use PHP5 native clone construct
* @see https://php.net/manual/language.oop5.cloning.php
*/ */
function dol_clone($object) function dol_clone($object)
{ {
dol_syslog("Functions.lib::dol_clone Clone object"); dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
$myclone=clone($object); $myclone=clone($object);
return $myclone; return $myclone;
@ -831,6 +835,25 @@ function dol_get_fiche_end($notab=0)
else return ''; else return '';
} }
/**
* Show a string with the label tag dedicated to the HTML edit field.
*
* @param string $langkey Translation key
* @param string $fieldkey Key of the html select field the text refers to
* @param int $fieldrequired 1=Field is mandatory
*/
function fieldLabel($langkey, $fieldkey, $fieldrequired=0)
{
global $conf, $langs;
$ret='';
if ($fieldrequired) $ret.='<span class="fieldrequired">';
if (empty($conf->dol_use_jmobile)) $ret.='<label for="'.$fieldkey.'">';
$ret.=$langs->trans($langkey);
if (empty($conf->dol_use_jmobile)) $ret.='</label>';
if ($fieldrequired) $ret.='</span>';
return $ret;
}
/** /**
* Return string to add class property on html element with pair/impair. * Return string to add class property on html element with pair/impair.
* *
@ -1702,11 +1725,15 @@ function dol_substr($string,$start,$length,$stringencoding='')
* @param string $url Param to add an url to click values * @param string $url Param to add an url to click values
* @return void * @return void
* @deprecated * @deprecated
* @see DolGraph
*/ */
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='') function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='')
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
global $conf,$langs; global $conf,$langs;
global $theme_datacolor; // To have var kept when function is called several times global $theme_datacolor; // To have var kept when function is called several times
if (empty($conf->use_javascript_ajax)) return; if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot'; $jsgraphlib='flot';
$datacolor=array(); $datacolor=array();
@ -2186,7 +2213,7 @@ function img_help($usehelpcursor = 1, $usealttitle = 1)
else $usealttitle = $langs->trans('Info'); else $usealttitle = $langs->trans('Info');
} }
return img_picto($usealttitle, 'info.png', ($usehelpcursor ? 'style="cursor: help"' : '')); return img_picto($usealttitle, 'info.png', ($usehelpcursor ? 'style="vertical-align: middle; cursor: help"' : 'style="vertical-align: middle;"'));
} }
/** /**
@ -2201,7 +2228,7 @@ function img_info($titlealt = 'default')
if ($titlealt == 'default') $titlealt = $langs->trans('Informations'); if ($titlealt == 'default') $titlealt = $langs->trans('Informations');
return img_picto($titlealt, 'info.png'); return img_picto($titlealt, 'info.png', 'style="vertical-align: middle;"');
} }
/** /**
@ -2380,9 +2407,12 @@ function img_mime($file, $titlealt = '')
* @param int $option Option * @param int $option Option
* @return string Return img tag * @return string Return img tag
* @deprecated * @deprecated
* @see img_picto
*/ */
function img_phone($titlealt = 'default', $option = 0) function img_phone($titlealt = 'default', $option = 0)
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
global $conf,$langs; global $conf,$langs;
if ($titlealt == 'default') $titlealt = $langs->trans('Call'); if ($titlealt == 'default') $titlealt = $langs->trans('Call');
@ -2452,7 +2482,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0)
return img_picto($text, 'info', 'class="hideonsmartphone"'); return img_picto($text, 'info', 'class="hideonsmartphone"');
} }
return ($nodiv?'':'<div class="info hideonsmartphone">').img_picto($langs->trans('InfoAdmin'), 'info', 'class="hideonsmartphone"').' '.$text.($nodiv?'':'</div>'); return ($nodiv?'':'<div class="info hideonsmartphone">').img_picto($langs->trans('InfoAdmin'), ($nodiv?'info':'info_black'), 'class="hideonsmartphone"').' '.$text.($nodiv?'':'</div>');
} }
@ -2702,9 +2732,12 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
* @param string $title Title to show * @param string $title Title to show
* @return string Title to show * @return string Title to show
* @deprecated Use print_fiche_titre instead * @deprecated Use print_fiche_titre instead
* @see print_fiche_titre
*/ */
function print_titre($title) function print_titre($title)
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
print '<div class="titre">'.$title.'</div>'; print '<div class="titre">'.$title.'</div>';
} }
@ -2717,6 +2750,7 @@ function print_titre($title)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects * @param int $id To force an id on html objects
* @return void * @return void
* @deprecated Use print load_fiche_titre instead
*/ */
function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id='') function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id='')
{ {
@ -4059,9 +4093,12 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
* *
* @return float Time (millisecondes) with microsecondes in decimal part * @return float Time (millisecondes) with microsecondes in decimal part
* @deprecated Dolibarr does not support PHP4, you should use native function * @deprecated Dolibarr does not support PHP4, you should use native function
* @see microtime()
*/ */
function dol_microtime_float() function dol_microtime_float()
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
return microtime(true); return microtime(true);
} }
@ -4281,6 +4318,8 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
*/ */
function setEventMessage($mesgs, $style='mesgs') function setEventMessage($mesgs, $style='mesgs')
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
if (! is_array($mesgs)) // If mesgs is a string if (! is_array($mesgs)) // If mesgs is a string
{ {
if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs; if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;

View File

@ -42,6 +42,7 @@ if (! function_exists('json_encode'))
* *
* @param mixed $elements PHP Object to json encode * @param mixed $elements PHP Object to json encode
* @return string Json encoded string * @return string Json encoded string
* @deprecated PHP >= 5.3 supports native json_encode
*/ */
function dol_json_encode($elements) function dol_json_encode($elements)
{ {
@ -219,6 +220,7 @@ if (! function_exists('json_decode'))
* @param string $json Json encoded to PHP Object or Array * @param string $json Json encoded to PHP Object or Array
* @param bool $assoc False return an object, true return an array. Try to always use it with true ! * @param bool $assoc False return an object, true return an array. Try to always use it with true !
* @return mixed Object or Array or false on error * @return mixed Object or Array or false on error
* @deprecated PHP >= 5.3 supports native json_decode
*/ */
function dol_json_decode($json, $assoc=false) function dol_json_decode($json, $assoc=false)
{ {

View File

@ -541,8 +541,8 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
{ {
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->public=$lines[$i]->public; $projectstatic->public=$lines[$i]->public;
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
@ -550,7 +550,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
// Project // Project
print "<td>"; print "<td>";
print $projectstatic->getNomUrl(1); print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>"; print "</td>";
// Ref // Ref
@ -711,9 +711,9 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print '<td class="nowrap">'; print '<td class="nowrap">';
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->public=$lines[$i]->public; $projectstatic->public=$lines[$i]->public;
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]; print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print $projectstatic->getNomUrl(1);
print "</td>"; print "</td>";
// Ref // Ref

View File

@ -317,7 +317,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</tr>'; print '</tr>';
} }
$var=!$var; //$var=!$var;
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'; print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">';
print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">'; print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
@ -372,6 +372,19 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</div></td></tr></table>'; print '</div></td></tr></table>';
print '</td></tr>'; print '</td></tr>';
if (! $foruserprofile)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
$hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
print '<td colspan="'.($colspan-1).'"><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
}
print '</table>'; print '</table>';
} }

View File

@ -224,8 +224,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__);
-- Fiscal year & Chart of accounts -- Fiscal year & Chart of accounts
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'main', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'accountancy', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'main', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__);
-- Check deposit -- Check deposit
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&amp;action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&amp;action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__);

View File

@ -462,15 +462,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("users"); $langs->load("users");
if ($user->admin) //if ($user->admin)
{ //{
$langs->load("admin");
$langs->load("help");
// Setup // Setup
$newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, 1, '', $mainmenu, 'setup'); $newmenu->add("/admin/index.php?mainmenu=home&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup');
if (empty($leftmenu) || $leftmenu=="setup") if (empty($leftmenu) || $leftmenu=="setup")
{ {
$langs->load("admin");
$langs->load("help");
$warnpicto=''; $warnpicto='';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
{ {
@ -503,9 +504,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
} }
// System tools // System tools
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("SystemTools"), 0, 1, '', $mainmenu, 'admintools'); $newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("SystemTools"), 0, $user->admin, '', $mainmenu, 'admintools');
if (empty($leftmenu) || preg_match('/^admintools/',$leftmenu)) if (empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
{ {
$langs->load("admin");
$langs->load("help");
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2);
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Triggers'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Triggers'), 2);
@ -534,7 +538,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
if (empty($user->societe_id)) if (empty($user->societe_id))
{ {
$newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, 1, '', $mainmenu, 'modulesadmintools'); $newmenu->add("/admin/tools/index.php?mainmenu=home&amp;leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, $user->admin, '', $mainmenu, 'modulesadmintools');
// Special case: This entry can't be embedded into modules because we need it for both module service and products and we don't want duplicate lines. // Special case: This entry can't be embedded into modules because we need it for both module service and products and we don't want duplicate lines.
if ((empty($leftmenu) || $leftmenu=="modulesadmintools") && $user->admin) if ((empty($leftmenu) || $leftmenu=="modulesadmintools") && $user->admin)
{ {
@ -543,18 +547,21 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
} }
} }
} }
} //}
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, 1, '', $mainmenu, 'users'); $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users');
if (empty($leftmenu) || $leftmenu == 'none' || $leftmenu=="users") if ($user->rights->user->user->lire)
{ {
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); if (empty($leftmenu) || $leftmenu == 'none' || $leftmenu=="users")
$newmenu->add("/user/card.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home'); {
$newmenu->add("/user/index.php", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/hierarchy.php", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/card.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home');
$newmenu->add("", $langs->trans("Groups"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/index.php", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/group/card.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin); $newmenu->add("/user/hierarchy.php", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/group/index.php", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin); $newmenu->add("", $langs->trans("Groups"), 1, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/group/card.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin);
$newmenu->add("/user/group/index.php", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin);
}
} }
} }
@ -582,13 +589,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("commercial"); $langs->load("commercial");
$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); $newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
/* no more required, there is a filter that can do more
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
*/
$newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer); $newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
//$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
} }

View File

@ -42,6 +42,7 @@ abstract class DolibarrModules
/** /**
* @var string Relative path to module style sheet * @var string Relative path to module style sheet
* @deprecated * @deprecated
* @see module_parts
*/ */
public $style_sheet = ''; public $style_sheet = '';
@ -60,6 +61,11 @@ abstract class DolibarrModules
*/ */
public $const = array(); public $const = array();
/**
* @var array Module cron jobs entries
*/
public $cronjobs = array();
/** /**
* @var array Module access rights * @var array Module access rights
*/ */
@ -209,18 +215,21 @@ abstract class DolibarrModules
// Insert activation module constant // Insert activation module constant
if (! $err) $err+=$this->_active(); if (! $err) $err+=$this->_active();
// Insert new pages for tabs into llx_const // Insert new pages for tabs (into llx_const)
if (! $err) $err+=$this->insert_tabs(); if (! $err) $err+=$this->insert_tabs();
// Insert activation of module's parts // Insert activation of module's parts
if (! $err) $err+=$this->insert_module_parts(); if (! $err) $err+=$this->insert_module_parts();
// Insert constant defined by modules, into llx_const // Insert constant defined by modules (into llx_const)
if (! $err) $err+=$this->insert_const(); if (! $err) $err+=$this->insert_const();
// Insert boxes def into llx_boxes_def and boxes setup into llx_boxes // Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
if (! $err && ! preg_match('/noboxes/',$options)) $err+=$this->insert_boxes($options); if (! $err && ! preg_match('/noboxes/',$options)) $err+=$this->insert_boxes($options);
// Insert cron job entries (entry in llx_cronjobs)
if (! $err) $err+=$this->insert_cronjobs();
// Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user. // Insert permission definitions of module into llx_rights_def. If user is admin, grant this permission to user.
if (! $err) $err+=$this->insert_permissions(1); if (! $err) $err+=$this->insert_permissions(1);
@ -307,6 +316,9 @@ abstract class DolibarrModules
// Remove list of module's available boxes (entry in llx_boxes) // Remove list of module's available boxes (entry in llx_boxes)
if (! $err && ! preg_match('/(newboxdefonly|noboxes)/',$options)) $err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only if (! $err && ! preg_match('/(newboxdefonly|noboxes)/',$options)) $err+=$this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
// Remove list of module's cron job entries (entry in llx_cronjobs)
if (! $err) $err+=$this->delete_cronjobs();
// Remove module's permissions from list of available permissions (entries in llx_rights_def) // Remove module's permissions from list of available permissions (entries in llx_rights_def)
if (! $err) $err+=$this->delete_permissions(); if (! $err) $err+=$this->delete_permissions();
@ -823,6 +835,130 @@ abstract class DolibarrModules
return $err; return $err;
} }
/**
* Adds cronjobs
*
* @return int Error count (0 if OK)
*/
function insert_cronjobs()
{
require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
global $conf;
$err=0;
if (is_array($this->cronjobs))
{
foreach ($this->cronjobs as $key => $value)
{
$label = isset($this->cronjobs[$key]['label'])?$this->cronjobs[$key]['label']:'';
$jobtype = isset($this->cronjobs[$key]['jobtype'])?$this->cronjobs[$key]['jobtype']:'';
$class = isset($this->cronjobs[$key]['class'])?$this->cronjobs[$key]['class']:'';
$method = isset($this->cronjobs[$key]['method'])?$this->cronjobs[$key]['method']:'';
$command = isset($this->cronjobs[$key]['command'])?$this->cronjobs[$key]['command']:'';
$parameters = isset($this->cronjobs[$key]['parameters'])?$this->cronjobs[$key]['parameters']:'';
$comment = isset($this->cronjobs[$key]['comment'])?$this->cronjobs[$key]['comment']:'';
$frequency = isset($this->cronjobs[$key]['frequency'])?$this->cronjobs[$key]['frequency']:'';
$unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:'';
// Search if boxes def already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'";
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
if ($command) $sql.= " AND command = '".$this->db->escape($command)."'";
$sql.= " AND entity = ".$conf->entity;
$now=dol_now();
dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG);
$result=$this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
if ($obj->nb == 0)
{
$this->db->begin();
if (! $err)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, label, jobtype, classesname, methodename, command, params, note, frequency, unitfrequency, entity)";
$sql.= " VALUES (";
$sql.= "'".$this->db->escape($this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', ";
$sql.= "'".$this->db->escape($label)."', ";
$sql.= "'".$this->db->escape($jobtype)."', ";
$sql.= ($class?"'".$this->db->escape($class)."'":"null").",";
$sql.= ($method?"'".$this->db->escape($method)."'":"null").",";
$sql.= ($command?"'".$this->db->escape($command)."'":"null").",";
$sql.= ($parameters?"'".$this->db->escape($parameters)."'":"null").",";
$sql.= ($comment?"'".$this->db->escape($comment)."'":"null").",";
$sql.= "'".$this->db->escape($frequency)."', ";
$sql.= "'".$this->db->escape($unitfrequency)."', ";
$sql.= $conf->entity;
$sql.= ")";
print $sql;
dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) $err++;
}
if (! $err)
{
$this->db->commit();
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
}
}
// else box already registered into database
}
else
{
$this->error=$this->db->lasterror();
$err++;
}
}
}
return $err;
}
/**
* Removes boxes
*
* @return int Error count (0 if OK)
*/
function delete_cronjobs()
{
global $conf;
$err=0;
if (is_array($this->cronjobs))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$err++;
}
}
return $err;
}
/** /**
* Removes tabs * Removes tabs
* *

View File

@ -156,10 +156,13 @@ abstract class ModeleNumRefAskPriceSupplier
* @param int $hidedesc Hide description * @param int $hidedesc Hide description
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Propal class * @deprecated Use the new function generateDocument of AskPriceSupplier class
* @see AskPriceSupplier::generateDocument()
*/ */
function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -161,8 +161,11 @@ abstract class ModeleNumRefCommandes
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Commande class * @deprecated Use the new function generateDocument of Commande class
* @see Commande::generateDocument()
*/ */
function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -156,8 +156,11 @@ class ModelNumRefContracts
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Contrat class * @deprecated Use the new function generateDocument of Contrat class
* @see Contrat::generateDocument()
*/ */
function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -181,11 +181,11 @@ class html_cerfafr extends ModeleDon
if (preg_match('/fr/i',$outputlangs->defaultlang)) { if (preg_match('/fr/i',$outputlangs->defaultlang)) {
if ($conf->global->DONATION_ART200 >= 1) if ($conf->global->DONATION_ART200 >= 1)
{ {
$art200='<input type="checkbox" checked>200 du CGI'; $art200='<input type="checkbox" disabled="true" checked>200 du CGI';
} }
else else
{ {
$art200='<input type="checkbox">200 du CGI'; $art200='<input type="checkbox" disabled="true">200 du CGI';
} }
} }
$form = str_replace('__ARTICLE200__',$art200,$form); $form = str_replace('__ARTICLE200__',$art200,$form);
@ -194,11 +194,11 @@ class html_cerfafr extends ModeleDon
if (preg_match('/fr/i',$outputlangs->defaultlang)) { if (preg_match('/fr/i',$outputlangs->defaultlang)) {
if ($conf->global->DONATION_ART238 >= 1) if ($conf->global->DONATION_ART238 >= 1)
{ {
$art238='<input type="checkbox" checked>238 bis du CGI'; $art238='<input type="checkbox" disabled="true" checked>238 bis du CGI';
} }
else else
{ {
$art238='<input type="checkbox">238 bis du CGI'; $art238='<input type="checkbox" disabled="true">238 bis du CGI';
} }
} }
$form = str_replace('__ARTICLE238__',$art238,$form); $form = str_replace('__ARTICLE238__',$art238,$form);
@ -207,11 +207,11 @@ class html_cerfafr extends ModeleDon
if (preg_match('/fr/i',$outputlangs->defaultlang)) { if (preg_match('/fr/i',$outputlangs->defaultlang)) {
if ($conf->global->DONATION_ART885 >= 1) if ($conf->global->DONATION_ART885 >= 1)
{ {
$art885='<input type="checkbox" checked>885-0 V bis du CGI'; $art885='<input type="checkbox" disabled="true" checked>885-0 V bis du CGI';
} }
else else
{ {
$art885='<input type="checkbox">885-0 V bis du CGI'; $art885='<input type="checkbox" disabled="true">885-0 V bis du CGI';
} }
} }
$form = str_replace('__ARTICLE885__',$art885,$form); $form = str_replace('__ARTICLE885__',$art885,$form);

View File

@ -154,8 +154,11 @@ abstract class ModelNumRefExpedition
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 1 if OK -1 if KO * @return int 1 if OK -1 if KO
* @deprecated Use the new function generateDocument of Expedition class * @deprecated Use the new function generateDocument of Expedition class
* @see Expedition::generateDocument()
*/ */
function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -156,9 +156,12 @@ abstract class ModeleNumRefFactures
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* @deprecated Use the new function generateDocument of Facture class * @deprecated Use the new function generateDocument of Facture class
* @see Facture::generateDocument()
*/ */
function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -156,9 +156,12 @@ abstract class ModeleNumRefDeliveryOrder
* @param Translate $outputlangs objet lang a utiliser pour traduction * @param Translate $outputlangs objet lang a utiliser pour traduction
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Livraison class * @deprecated Use the new function generateDocument of Livraison class
* @see Livraison::generateDocument()
*/ */
function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='') function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='')
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs); return $object->generateDocument($modele, $outputlangs);
} }

View File

@ -153,6 +153,11 @@ class mailing_fraise extends MailingTargets
*/ */
function add_to_target($mailing_id,$filtersarray=array()) function add_to_target($mailing_id,$filtersarray=array())
{ {
// Deprecation warning
if ($filtersarray) {
dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING);
}
global $langs,$_POST; global $langs,$_POST;
$langs->load("members"); $langs->load("members");
$langs->load("companies"); $langs->load("companies");

View File

@ -162,7 +162,7 @@ class modCategorie extends DolibarrModules
$this->export_enabled[$r]='$conf->adherent->enabled'; $this->export_enabled[$r]='$conf->adherent->enabled';
$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:adherent:nom','p.lastname'=>'Text','p.firstname'=>'Text'); $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
$this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
@ -213,7 +213,6 @@ class modCategorie extends DolibarrModules
$this->export_TypeFields_array[$r] = array ( $this->export_TypeFields_array[$r] = array (
'u.label' => "Text", 'u.label' => "Text",
'u.description' => "Text", 'u.description' => "Text",
'p.rowid' => 'List:contact:lastname',
'p.lastname' => 'Text', 'p.lastname' => 'Text',
'p.firstname' => 'Text', 'p.firstname' => 'Text',
's.nom'=>"Text", 's.nom'=>"Text",

View File

@ -67,50 +67,49 @@ class modDon extends DolibarrModules
$this->config_page_url = array("donation.php@don"); $this->config_page_url = array("donation.php@don");
// Constants // Constants
$this->const = array (); $this->const = array();
$r=0;
$this->const[0] = array ( $this->const[$r][0] = "DON_ADDON_MODEL";
"DON_ADDON_MODEL", $this->const[$r][1] = "chaine";
"chaine", $this->const[$r][2] = "html_cerfafr";
"html_cerfafr", $this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons';
"Nom du gestionnaire de generation de recu de dons", $this->const[$r][4] = 0;
"0"
); $r++;
$this->const[1] = array ( $this->const[$r][0] = "DONATION_ART200";
"DONATION_ART200", $this->const[$r][1] = "yesno";
"yesno", $this->const[$r][2] = "0";
"0", $this->const[$r][3] = 'Option Française - Eligibilité Art200 du CGI';
"Option Française - Eligibilité Art200 du CGI", $this->const[$r][4] = 0;
"0"
); $r++;
$this->const[2] = array ( $this->const[$r][0] = "DONATION_ART238";
"DONATION_ART238", $this->const[$r][1] = "yesno";
"yesno", $this->const[$r][2] = "0";
"0", $this->const[$r][3] = 'Option Française - Eligibilité Art238 bis du CGI';
"Option Française - Eligibilité Art238 bis du CGI", $this->const[$r][4] = 0;
"0"
); $r++;
$this->const[3] = array ( $this->const[$r][0] = "DONATION_ART885";
"DONATION_ART885", $this->const[$r][1] = "yesno";
"yesno", $this->const[$r][2] = "0";
"0", $this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI';
"Option Française - Eligibilité Art885-0 V bis du CGI", $this->const[$r][4] = 0;
"0"
); $r++;
$this->const[4] = array ( $this->const[$r][0] = "DONATION_MESSAGE";
"DONATION_MESSAGE", $this->const[$r][1] = "chaine";
"chaine", $this->const[$r][2] = "Thank you";
"Thank you", $this->const[$r][3] = 'Message affiché sur le récépissé de versements ou dons';
"Message affiché sur le récépissé de versements ou dons", $this->const[$r][4] = 0;
"0"
); $r++;
$this->const[5] = array ( $this->const[$r][0] = "DONATION_ACCOUNTINGACCOUNT";
"DONATION_ACCOUNTINGACCOUNT", $this->const[$r][1] = "chaine";
"chaine", $this->const[$r][2] = "7581";
"7581", $this->const[$r][3] = 'Compte comptable de remise des versements ou dons';
"Compte comptable de remise des versements ou dons", $this->const[$r][4] = 0;
"0"
);
// Boxes // Boxes
$this->boxes = array(); $this->boxes = array();
@ -153,8 +152,8 @@ class modDon extends DolibarrModules
global $conf; global $conf;
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][4]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][4]."','donation',".$conf->entity.")", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','donation',".$conf->entity.")",
); );
return $this->_init($sql,$options); return $this->_init($sql,$options);

View File

@ -279,10 +279,13 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_label[$r]='Factures fournisseurs et lignes de facture';
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label',
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product'); 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product',
'p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object // Add extra fields object
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
@ -362,6 +365,7 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facture_fourn_det as fd'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facture_fourn_det as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object';
@ -374,10 +378,13 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Factures fournisseurs et reglements'; $this->export_label[$r]='Factures fournisseurs et reglements';
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_permission[$r]=array(array("fournisseur","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment',
'p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number',
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); 'p.datep'=>'Date','p.num_paiement'=>'Number','project.ref'=>'Text','project.title'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment',
'p.datep'=>'payment','p.num_paiement'=>'payment','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object // Add extra fields object
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
@ -420,6 +427,7 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid';
@ -432,14 +440,17 @@ class modFournisseur extends DolibarrModules
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; $this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
$this->export_icon[$r]='order'; $this->export_icon[$r]='order';
$this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_permission[$r]=array(array("fournisseur","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL))
{ {
unset($this->export_fields_array['f.date_approve2']); unset($this->export_fields_array['f.date_approve2']);
unset($this->export_fields_array['ua2.login']); unset($this->export_fields_array['ua2.login']);
} }
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:product:label',
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product',
'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object // Add extra fields object
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'"; $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'";
@ -520,6 +531,7 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,';

View File

@ -99,6 +99,13 @@ class modGravatar extends DolibarrModules
//$r++; //$r++;
// Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
// );
$r=0;
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;

View File

@ -153,9 +153,12 @@ abstract class ModeleNumRefProjects
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Project class * @deprecated Use the new function generateDocument of Project class
* @see Project::generateDocument()
*/ */
function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -154,9 +154,12 @@ abstract class ModeleNumRefTask
* @param HookManager $hookmanager Hook manager instance * @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Task class * @deprecated Use the new function generateDocument of Task class
* @see Task::generateDocument()
*/ */
function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }

View File

@ -157,9 +157,12 @@ abstract class ModeleNumRefPropales
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of Propal class * @deprecated Use the new function generateDocument of Propal class
* @see Propal::generateDocument()
*/ */
function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -151,9 +151,12 @@ abstract class ModeleNumRefSuppliersOrders
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int 0 if KO, 1 if OK
* @deprecated Use the new function generateDocument of CommandeFournisseur class * @deprecated Use the new function generateDocument of CommandeFournisseur class
* @see CommandeFournisseur::generateDocument()
*/ */
function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -61,6 +61,7 @@ abstract class DolibarrTriggers
* Error reported by the trigger * Error reported by the trigger
* @var string * @var string
* @deprecated Use $this->errors * @deprecated Use $this->errors
* @see errors
*/ */
public $error = ''; public $error = '';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concpt.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concpt.pro>
* 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 * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -227,7 +227,6 @@ llxHeader('',$langs->trans("CronAdd"));
if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute')
{ {
$head=cron_prepare_head($object); $head=cron_prepare_head($object);
print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
} }
elseif ($action=='create') elseif ($action=='create')
{ {
@ -292,6 +291,8 @@ if (($action=="create") || ($action=="edit"))
print '<input type="hidden" name="action" value="add">'."\n"; print '<input type="hidden" name="action" value="add">'."\n";
} }
dol_fiche_head('');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'; print '<tr><td width="30%">';
@ -474,7 +475,9 @@ if (($action=="create") || ($action=="edit"))
print '</table>'; print '</table>';
print '<div align="center"><br>'; dol_fiche_end();
print '<div align="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">'; print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
@ -482,12 +485,15 @@ if (($action=="create") || ($action=="edit"))
print "</form>\n"; print "</form>\n";
}else { }
else
{
/* /*
* view Template * view card
*/ */
dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
// box add_jobs_box // box add_jobs_box
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -572,6 +578,17 @@ if (($action=="create") || ($action=="edit"))
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'; print '<tr><td>';
print $langs->trans('Active')."</td><td>";
print yn($object->status);
print "</td></tr>";
print '</table>';
print '<br>';
print '<table class="border" width="100%">';
print '<tr><td width="30%">';
print $langs->trans('CronDtLastLaunch')."</td><td>"; print $langs->trans('CronDtLastLaunch')."</td><td>";
if(!empty($object->datelastrun)) {print dol_print_date($object->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');} if(!empty($object->datelastrun)) {print dol_print_date($object->datelastrun,'dayhourtext');} else {print $langs->trans('CronNone');}
print "</td></tr>"; print "</td></tr>";
@ -598,7 +615,6 @@ if (($action=="create") || ($action=="edit"))
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
@ -633,7 +649,9 @@ if (($action=="create") || ($action=="edit"))
else { else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.'">'.$langs->trans("CronExecute").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.'">'.$langs->trans("CronExecute").'</a>';
} }
print '<br><br></div>'; print '</div>';
print '<br>';
} }

View File

@ -26,6 +26,8 @@ require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("admin");
$langs->load("cron");
// Security check // Security check
if (!$user->rights->cron->read) accessforbidden(); if (!$user->rights->cron->read) accessforbidden();

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.srouceforge.net> * Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.srouceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -165,6 +165,7 @@ print '<input type="hidden" name="status" value="'.$status.'" >';
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$arg_url='&page='.$page.'&status='.$status.'&search_label='.$search_label; $arg_url='&page='.$page.'&status='.$status.'&search_label='.$search_label;
print_liste_field_titre($langs->trans("ID"),$_SERVER["PHP_SELF"],"t.rowid","",$arg_url,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CronLabel"),$_SERVER["PHP_SELF"],"t.label","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronLabel"),$_SERVER["PHP_SELF"],"t.label","",$arg_url,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CronTask"),'','',"",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronTask"),'','',"",$arg_url,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CronDtStart"),$_SERVER["PHP_SELF"],"t.datestart","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronDtStart"),$_SERVER["PHP_SELF"],"t.datestart","",$arg_url,'',$sortfield,$sortorder);
@ -176,11 +177,11 @@ print_liste_field_titre($langs->trans("CronNbRun"),$_SERVER["PHP_SELF"],"t.nbrun
print_liste_field_titre($langs->trans("CronLastResult"),$_SERVER["PHP_SELF"],"t.lastresult","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronLastResult"),$_SERVER["PHP_SELF"],"t.lastresult","",$arg_url,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVER["PHP_SELF"],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("CronLastOutput"),$_SERVER["PHP_SELF"],"t.lastoutput","",$arg_url,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Enabled"),$_SERVER["PHP_SELF"],"t.status","",$arg_url,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Enabled"),$_SERVER["PHP_SELF"],"t.status","",$arg_url,'align="center"',$sortfield,$sortorder);
print '<td></td>'; print_liste_field_titre('');
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>&nbsp;</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">'; print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">';
print '</td>'; print '</td>';
@ -201,7 +202,6 @@ print '<input class="liste_titre" type="image" src="'.img_picto($langs->trans("S
print '&nbsp; '; print '&nbsp; ';
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 '<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 '</td>';
print '</tr>'; print '</tr>';
@ -218,16 +218,26 @@ if (count($object->lines) > 0)
print '<tr class="'.$style.'">'; print '<tr class="'.$style.'">';
print '<td>'; print '<td>';
if(!empty($line->label)) { print '<a href="'.DOL_URL_ROOT.'/cron/card.php?id='.$line->id.'">';
print img_picto('', 'object_cron').' ';
print $line->id;
print '</a>';
print '</td>';
print '<td>';
if (! empty($line->label))
{
print '<a href="'.DOL_URL_ROOT.'/cron/card.php?id='.$line->id.'">'.$line->label.'</a>'; print '<a href="'.DOL_URL_ROOT.'/cron/card.php?id='.$line->id.'">'.$line->label.'</a>';
} }
else { else
{
print $langs->trans('CronNone'); print $langs->trans('CronNone');
} }
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($line->jobtype=='method') { if ($line->jobtype=='method')
{
print $langs->trans('CronModule').':'.$line->module_name.'<BR>'; print $langs->trans('CronModule').':'.$line->module_name.'<BR>';
print $langs->trans('CronClass').':'. $line->classesname.'<BR>'; print $langs->trans('CronClass').':'. $line->classesname.'<BR>';
print $langs->trans('CronObject').':'. $line->objectname.'<BR>'; print $langs->trans('CronObject').':'. $line->objectname.'<BR>';
@ -279,20 +289,23 @@ if (count($object->lines) > 0)
if(!empty($line->lastoutput)) {print dol_trunc(nl2br($line->lastoutput),100);} else {print $langs->trans('CronNone');} if(!empty($line->lastoutput)) {print dol_trunc(nl2br($line->lastoutput),100);} else {print $langs->trans('CronNone');}
print '</td>'; print '</td>';
// Status
print '<td align="center">'; print '<td align="center">';
print yn($line->status); print yn($line->status);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
if ($user->rights->cron->delete) { if ($user->rights->cron->delete)
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&status=".$status."&action=delete\" title=\"".$langs->trans('CronDelete')."\">".img_delete()."</a> &nbsp;"; {
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&status=".$status."&action=delete\" title=\"".dol_escape_htmltag($langs->trans('CronDelete'))."\">".img_picto($langs->trans('CronDelete'),'delete')."</a> &nbsp;";
} else { } else {
print "<a href=\"#\" title=\"".$langs->trans('NotEnoughPermissions')."\">".img_delete()."</a> &nbsp; "; print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'), 'delete')."</a> &nbsp; ";
} }
if ($user->rights->cron->execute) { if ($user->rights->cron->execute)
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&status=".$status."&action=execute\" title=\"".$langs->trans('CronExecute')."\">".img_picto('',"play")."</a>"; {
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$line->id."&status=".$status."&action=execute\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'),"play")."</a>";
} else { } else {
print "<a href=\"#\" title=\"".$langs->trans('NotEnoughPermissions')."\">".img_picto('',"execute")."</a>"; print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'),"execute")."</a>";
} }
print '</td>'; print '</td>';
@ -301,7 +314,7 @@ if (count($object->lines) > 0)
} }
else else
{ {
print '<tr><td colspan="8">'.$langs->trans('CronNoJobs').'</td></tr>'; print '<tr><td colspan="9">'.$langs->trans('CronNoJobs').'</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -386,7 +386,7 @@ if (is_resource($handle))
{ {
print '&nbsp;'; print '&nbsp;';
print '</td><td align="center">'; print '</td><td align="center">';
print '<a href="dons.php?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
print '</td>'; print '</td>';
} }

View File

@ -388,16 +388,18 @@ if (! empty($id) && $action == 'edit')
$hselected='card'; $hselected='card';
$head = donation_prepare_head($object); $head = donation_prepare_head($object);
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">'; print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="amount" value="'.$object->amount.'">'; print '<input type="hidden" name="amount" value="'.$object->amount.'">';
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
print '<table class="border" width="100%">';
// Ref // Ref
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">'; print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
print $object->getNomUrl(); print $object->getNomUrl();
@ -468,7 +470,7 @@ if (! empty($id) && $action == 'edit')
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 1, 0, 1); $formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 0, 1, 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -482,11 +484,11 @@ if (! empty($id) && $action == 'edit')
print "</table>\n"; print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print "</form>\n"; print "</form>\n";
print "</div>\n";
} }
@ -655,7 +657,10 @@ if (! empty($id) && $action != 'edit')
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Project").'</td>'; print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$object->projet.'</td>'; print '<td>';
$object->fetch_projet();
print $object->project->getNomUrl(4);
print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -63,6 +63,11 @@ class Don extends CommonObject
var $modelpdf; var $modelpdf;
var $projet; var $projet;
/**
* @deprecated
* @see note_private, note_public
*/
var $commentaire;
/** /**
* Constructor * Constructor

View File

@ -49,6 +49,12 @@ class PaymentDonation extends CommonObject
var $fk_user_creat; var $fk_user_creat;
var $fk_user_modif; var $fk_user_modif;
/**
* @deprecated
* @see amount, amounts
*/
var $total;
/** /**
* Constructor * Constructor
* *

View File

@ -163,7 +163,6 @@ if (GETPOST("action") == 'create')
$total = $don->amount; $total = $don->amount;
print_fiche_titre($langs->trans("DoPayment")); print_fiche_titre($langs->trans("DoPayment"));
print "<br>\n";
if ($mesg) if ($mesg)
{ {
@ -176,6 +175,8 @@ if (GETPOST("action") == 'create')
print '<input type="hidden" name="chid" value="'.$chid.'">'; print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">'; print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head();
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">'; print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Donation").'</td>'; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Donation").'</td>';
@ -232,7 +233,7 @@ if (GETPOST("action") == 'create')
print '</table>'; print '</table>';
print '<br>'; dol_fiche_end();
/* /*
* Autres charges impayees * Autres charges impayees

View File

@ -77,7 +77,21 @@ class Expedition extends CommonObject
var $trueSize; var $trueSize;
var $date_delivery; // Date delivery planed var $date_delivery; // Date delivery planed
var $date_expedition; // Date delivery real /**
* @deprecated
* @see date_shipping
*/
var $date;
/**
* @deprecated
* @see date_shipping
*/
var $date_expedition;
/**
* Effective delivery date
* @var int
*/
public $date_shipping;
var $date_creation; var $date_creation;
var $date_valid; var $date_valid;
@ -459,8 +473,8 @@ class Expedition extends CommonObject
$this->statut = $obj->fk_statut; $this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date = $this->db->jdate($obj->date_expedition); // TODO obsolete $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO obsolete $this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address; $this->fk_delivery_address = $obj->fk_address;
@ -783,10 +797,11 @@ class Expedition extends CommonObject
$orderline = new OrderLine($this->db); $orderline = new OrderLine($this->db);
$orderline->fetch($id); $orderline->fetch($id);
$fk_product = $orderline->fk_product;
if (! empty($orderline->fk_product)) if (! empty($conf->stock->enabled) && ! empty($orderline->fk_product))
{ {
$fk_product = $orderline->fk_product;
if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
{ {
$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); $this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
@ -1708,9 +1723,10 @@ class ExpeditionLigne
// From llx_commandedet or llx_propaldet // From llx_commandedet or llx_propaldet
var $qty_asked; var $qty_asked;
var $libelle; // Label produit public $product_ref;
var $product_desc; // Description produit public $product_label;
var $ref; public $product_desc;
// Invoicing // Invoicing
var $remise_percent; var $remise_percent;
@ -1720,6 +1736,24 @@ class ExpeditionLigne
var $total_localtax1; // Total Local tax 1 var $total_localtax1; // Total Local tax 1
var $total_localtax2; // Total Local tax 2 var $total_localtax2; // Total Local tax 2
public $fk_origin_line;
// Deprecated
/**
* @deprecated
* @see fk_origin_line
*/
var $origin_line_id;
/**
* @deprecated
* @see product_ref
*/
var $ref;
/**
* @deprecated
* @see product_label
*/
var $libelle;
/** /**
* Constructor * Constructor

View File

@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings'));
<td align="right"><?php echo $langs->trans("Status"); ?></td> <td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr> </tr>
<?php <?php
$total=0;
$var=true; $var=true;
foreach($linkedObjectBlock as $object) foreach($linkedObjectBlock as $object)
{ {

View File

@ -37,22 +37,17 @@ if (! defined('EURO')) define('EURO',chr(128));
// Define syslog constants // Define syslog constants
if (! defined('LOG_DEBUG')) if (! defined('LOG_DEBUG'))
{ {
if (function_exists("define_syslog_variables")) if (! function_exists("syslog")) {
{ // For PHP versions without syslog (like running on Windows OS)
define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized define('LOG_EMERG',0);
} define('LOG_ALERT',1);
else define('LOG_CRIT',2);
{ define('LOG_ERR',3);
// Pour PHP sans syslog (comme sous Windows) define('LOG_WARNING',4);
define('LOG_EMERG',0); define('LOG_NOTICE',5);
define('LOG_ALERT',1); define('LOG_INFO',6);
define('LOG_CRIT',2); define('LOG_DEBUG',7);
define('LOG_ERR',3); }
define('LOG_WARNING',4);
define('LOG_NOTICE',5);
define('LOG_INFO',6);
define('LOG_DEBUG',7);
}
} }
// End of common declaration part // End of common declaration part

View File

@ -55,6 +55,7 @@ class CommandeFournisseur extends CommonOrder
/** /**
* TODO: Remove * TODO: Remove
* @deprecated * @deprecated
* @see product_ref
*/ */
var $ref; var $ref;
var $product_ref; var $product_ref;
@ -78,8 +79,13 @@ class CommandeFournisseur extends CommonOrder
var $total_localtax2; // Total Local tax 2 var $total_localtax2; // Total Local tax 2
var $total_ttc; var $total_ttc;
var $source; var $source;
/**
* @deprecated
* @see note_private, note_public
*/
var $note; var $note;
var $note_public; public $note_private;
public $note_public;
var $model_pdf; var $model_pdf;
var $fk_project; var $fk_project;
var $cond_reglement_id; var $cond_reglement_id;
@ -2465,6 +2471,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
* Supplier ref * Supplier ref
* @var string * @var string
* @deprecated Use ref_supplier * @deprecated Use ref_supplier
* @see ref_supplier
*/ */
public $ref_fourn; public $ref_fourn;

View File

@ -58,12 +58,9 @@ class FactureFournisseur extends CommonInvoice
var $type = self::TYPE_STANDARD; var $type = self::TYPE_STANDARD;
/** /**
* Check constants for more info: * Supplier invoice status
* - STATUS_DRAFT
* - STATUS_VALIDATED
* - STATUS_PAID
* - STATUS_ABANDONED
* @var int * @var int
* @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED
*/ */
var $statut; var $statut;
//! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant) //! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
@ -85,7 +82,11 @@ class FactureFournisseur extends CommonInvoice
var $total_localtax1; var $total_localtax1;
var $total_localtax2; var $total_localtax2;
var $total_ttc; var $total_ttc;
var $note; // deprecated /**
* @deprecated
* @see note_private, note_public
*/
var $note;
var $note_private; var $note_private;
var $note_public; var $note_public;
var $propalid; var $propalid;
@ -100,7 +101,10 @@ class FactureFournisseur extends CommonInvoice
* @var SupplierInvoiceLine[] * @var SupplierInvoiceLine[]
*/ */
public $lines = array(); public $lines = array();
var $fournisseur; // deprecated /**
* @deprecated
*/
var $fournisseur;
//Incorterms //Incorterms
var $fk_incoterms; var $fk_incoterms;
@ -1896,9 +1900,17 @@ class SupplierInvoiceLine extends CommonObjectLine
var $oldline; var $oldline;
/**
* @deprecated
* @see product_ref
*/
public $ref; public $ref;
public $product_ref; public $product_ref;
public $ref_supplier; public $ref_supplier;
/**
* @deprecated
* @see label
*/
public $libelle; public $libelle;
public $product_desc; public $product_desc;
@ -1906,8 +1918,10 @@ class SupplierInvoiceLine extends CommonObjectLine
* Unit price before taxes * Unit price before taxes
* @var float * @var float
* @deprecated Use $subprice * @deprecated Use $subprice
* @see subprice
*/ */
public $pu_ht; public $pu_ht;
public $subprice;
/** /**
* Unit price included taxes * Unit price included taxes
@ -1919,8 +1933,10 @@ class SupplierInvoiceLine extends CommonObjectLine
* Total VAT amount * Total VAT amount
* @var float * @var float
* @deprecated Use $total_tva instead * @deprecated Use $total_tva instead
* @see total_tva
*/ */
public $tva; public $tva;
public $total_tva;
/** /**
* Id of the corresponding supplier invoice * Id of the corresponding supplier invoice
@ -1932,7 +1948,7 @@ class SupplierInvoiceLine extends CommonObjectLine
* Product label * Product label
* @var string * @var string
*/ */
var $label; // deprecated var $label;
/** /**
* Description of the line * Description of the line

View File

@ -42,7 +42,11 @@ class ProductFournisseur extends Product
var $product_fourn_price_id; // id of ligne product-supplier var $product_fourn_price_id; // id of ligne product-supplier
var $id; // product id var $id; // product id
var $fourn_ref; // deprecated /**
* @deprecated
* @see ref_supplier
*/
var $fourn_ref;
var $delivery_time_days; var $delivery_time_days;
var $ref_supplier; // ref supplier (can be set by get_buyprice) var $ref_supplier; // ref supplier (can be set by get_buyprice)
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
@ -161,6 +165,7 @@ class ProductFournisseur extends Product
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0) function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0)
{ {
global $conf, $langs; global $conf, $langs;
//global $mysoc;
// Clean parameter // Clean parameter
if (empty($qty)) $qty=0; if (empty($qty)) $qty=0;
@ -348,7 +353,8 @@ class ProductFournisseur extends Product
if ($obj) if ($obj)
{ {
$this->product_fourn_price_id = $rowid; $this->product_fourn_price_id = $rowid;
$this->fourn_ref = $obj->ref_fourn; $this->fourn_ref = $obj->ref_fourn; // deprecated
$this->ref_supplier = $obj->ref_fourn;
$this->fourn_price = $obj->price; $this->fourn_price = $obj->price;
$this->fourn_charges = $obj->charges; $this->fourn_charges = $obj->charges;
$this->fourn_qty = $obj->quantity; $this->fourn_qty = $obj->quantity;

View File

@ -39,6 +39,7 @@ print_titre($langs->trans('RelatedSupplierOrders'));
<td align="right"><?php echo $langs->trans("Status"); ?></td> <td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr> </tr>
<?php <?php
$total=0;
$var=true; $var=true;
foreach($linkedObjectBlock as $object) foreach($linkedObjectBlock as $object)
{ {

View File

@ -1508,7 +1508,16 @@ if ($action == 'create')
$langs->load('orders'); $langs->load('orders');
$txt=$langs->trans("SupplierOrder"); $txt=$langs->trans("SupplierOrder");
} }
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1);
//We check if Origin document has already an invoice attached to it
$objectsrc->fetchObjectLinked($originid,'','','invoice_supplier');
$cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']);
if ($cntinvoice>=1)
{
setEventMessage('WarningBillExist','warnings');
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
}
echo '</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->country_code=='ES') if ($mysoc->country_code=='ES')

View File

@ -40,6 +40,7 @@ print_titre($langs->trans("RelatedSupplierInvoices"));
<td align="right"><?php echo $langs->trans("Status"); ?></td> <td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr> </tr>
<?php <?php
$total=0;
$var=true; $var=true;
foreach($linkedObjectBlock as $object) foreach($linkedObjectBlock as $object)
{ {

View File

@ -38,6 +38,10 @@ class Holiday extends CommonObject
var $error; var $error;
var $errors=array(); var $errors=array();
/**
* @deprecated
* @see id
*/
var $rowid; var $rowid;
var $ref; var $ref;

View File

@ -98,36 +98,36 @@ ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL
ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author; ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author;
-- Qual -- Qual
UPDATE llx_const SET name = 'ACCOUNTING_MODE' WHERE name = 'COMPTA_MODE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MODE')__ WHERE __DECRYPT('name')__ = 'COMPTA_MODE';
UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_CUSTOMER' WHERE name = 'COMPTA_ACCOUNT_CUSTOMER'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_CUSTOMER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_CUSTOMER';
UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUPPLIER' WHERE name = 'COMPTA_ACCOUNT_SUPPLIER'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUPPLIER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_SUPPLIER';
UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_BUY_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_BUY_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_SOLD_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_SOLD_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_BUY_ACCOUNT' WHERE name = 'COMPTA_SERVICE_BUY_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_BUY_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT' WHERE name = 'COMPTA_SERVICE_SOLD_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_SOLD_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_VAT_ACCOUNT' WHERE name = 'COMPTA_VAT_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_VAT_BUY_ACCOUNT' WHERE name = 'COMPTA_VAT_BUY_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_BUY_ACCOUNT';
-- Compatibility with module Accounting Expert -- Compatibility with module Accounting Expert
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_MODELCSV' WHERE name = 'ACCOUNTINGEX_MODELCSV'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_MODELCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MODELCSV';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_SEPARATORCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SEPARATORCSV';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DATE' WHERE name = 'ACCOUNTINGEX_EXP_DATE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DATE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DATE';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_PIECE' WHERE name = 'ACCOUNTINGEX_EXP_PIECE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_PIECE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_PIECE';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT' WHERE name = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_GLOBAL_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_LABEL' WHERE name = 'ACCOUNTINGEX_EXP_LABEL'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_LABEL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_LABEL';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_AMOUNT' WHERE name = 'ACCOUNTINGEX_EXP_AMOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_AMOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_AMOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DEVISE' WHERE name = 'ACCOUNTINGEX_EXP_DEVISE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DEVISE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DEVISE';
UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUSPENSE' WHERE name = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUSPENSE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE';
UPDATE llx_const SET name = 'ACCOUNTING_SELL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SELL_JOURNAL'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SELL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SELL_JOURNAL';
UPDATE llx_const SET name = 'ACCOUNTING_PURCHASE_JOURNAL' WHERE name = 'ACCOUNTINGEX_PURCHASE_JOURNAL'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PURCHASE_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_PURCHASE_JOURNAL';
UPDATE llx_const SET name = 'ACCOUNTING_SOCIAL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SOCIAL_JOURNAL'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SOCIAL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SOCIAL_JOURNAL';
UPDATE llx_const SET name = 'ACCOUNTING_MISCELLANEOUS_JOURNAL' WHERE name = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MISCELLANEOUS_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL';
UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' WHERE name = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_TRANSFER_CASH')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH';
UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_GACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_GACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_GACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_GACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_AACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_AACCOUNT'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_AACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_AACCOUNT';
UPDATE llx_const SET name = 'ACCOUNTING_LIMIT_LIST_VENTILATION' WHERE name = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIMIT_LIST_VENTILATION')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION';
UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_TODO' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_TODO')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO';
UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_DONE' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE'; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_DONE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE';
-- Drop old table -- Drop old table
DROP TABLE llx_compta; DROP TABLE llx_compta;
@ -1133,9 +1133,9 @@ ALTER TABLE llx_c_email_templates ADD UNIQUE INDEX uk_c_email_templates(entity,
ALTER TABLE llx_c_email_templates ADD INDEX idx_type(type_template); ALTER TABLE llx_c_email_templates ADD INDEX idx_type(type_template);
-- Remove OSC module -- Remove OSC module
DELETE FROM llx_const WHERE name = 'MAIN_MODULE_BOUTIQUE'; DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_MODULE_BOUTIQUE';
DELETE FROM llx_const WHERE name = 'OSC_DB_HOST'; DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'OSC_DB_HOST';
DELETE FROM llx_menu WHERE module = 'boutique'; DELETE FROM llx_menu WHERE __DECRYPT('module')__ = 'boutique';
-- Add option always editable on extrafield -- Add option always editable on extrafield
ALTER TABLE llx_extrafields ADD alwayseditable INTEGER DEFAULT 0 AFTER pos; ALTER TABLE llx_extrafields ADD alwayseditable INTEGER DEFAULT 0 AFTER pos;
@ -1181,4 +1181,5 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ
ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL; ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL;
INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',0,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0'; -- This constant is for compatibility if user come from 3.6 or lower. Must not be enabled on 3.7.0 or +
INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT __ENCRYPT('PRODUCT_USE_OLD_PATH_FOR_PHOTO')__,__ENCRYPT('1')__,'chaine','Use old path for products images',1,0 FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_VERSION_LAST_INSTALL' AND __DECRYPT('value')__ < '3.7.0';

View File

@ -32,6 +32,8 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2
ALTER TABLE llx_societe_rib ADD COLUMN rum varchar(32) after default_rib; ALTER TABLE llx_societe_rib ADD COLUMN rum varchar(32) after default_rib;
ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) default 'FRST' after rum; ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) default 'FRST' after rum;
ALTER TABLE llx_cronjob ADD COLUMN entity integer DEFAULT 0;
ALTER TABLE llx_cronjob MODIFY COLUMN params text NULL;
-- Loan -- Loan
create table llx_loan create table llx_loan
@ -155,12 +157,12 @@ ALTER TABLE llx_facturedet ADD COLUMN situation_percent real;
ALTER TABLE llx_facturedet ADD COLUMN fk_prev_id integer; ALTER TABLE llx_facturedet ADD COLUMN fk_prev_id integer;
-- Convert SMTP config to main entity, so new entities don't get the old values -- Convert SMTP config to main entity, so new entities don't get the old values
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SENDMODE"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_SENDMODE";
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTP_PORT"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_SMTP_PORT";
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTP_SERVER"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_SMTP_SERVER";
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTPS_ID"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_SMTPS_ID";
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_SMTPS_PW"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_SMTPS_PW";
UPDATE llx_const SET entity = 1 WHERE entity = 0 AND name = "MAIN_MAIL_EMAIL_TLS"; UPDATE llx_const SET entity = __ENCRYPT('1')__ WHERE __DECRYPT('entity')__ = 0 AND __DECRYPT('name')__ = "MAIN_MAIL_EMAIL_TLS";
create table llx_bank_account_extrafields create table llx_bank_account_extrafields

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