Merge branch 'develop' into api_rest

Conflicts:
	htdocs/user/card.php
	htdocs/user/class/user.class.php
This commit is contained in:
jfefe 2015-06-15 14:29:34 +02:00
commit 190ee35e86
523 changed files with 11687 additions and 8015 deletions

View File

@ -128,7 +128,7 @@ script:
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
- cat upgrade370380.log # - cat upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
# - cat upgrade370380-2.log # - cat upgrade370380-2.log
- cd ../.. - cd ../..

View File

@ -41,14 +41,38 @@ Dolibarr better:
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are - Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'" "addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
- All fields "fk_societe" were renamed into "fk_soc". - All fields "fk_societe" were renamed into "fk_soc".
- Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType
***** ChangeLog for 3.7.2 compared to 3.7.1 *****
FIX [ bug #2855 ] Wrong translation key in localtax report page
FIX [ bug #1852 ] JS error when editing a customer order line
FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form
***** 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.
@ -236,8 +260,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.
@ -279,6 +303,7 @@ Dolibarr better:
- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
- Fix: [ bug #2542 ] Contracts store localtax preferences - Fix: [ bug #2542 ] Contracts store localtax preferences
- Fix: Bad permission assignments for stock movements actions - Fix: Bad permission assignments for stock movements actions
- Fix: [ bug #2891 ] Category hooks do not work
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@ -453,6 +478,10 @@ Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a projec
Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref
Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null
Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error
Fix: [ bug #2976 ] "Report" tab is the current tab but it is not marked as selected by the UI
Fix: [ bug #2861 ] Undefined variable $res when migrating
Fix: [ bug #2837 ] Product list table column header does not match column body
Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
***** ChangeLog for 3.5.6 compared to 3.5.5 ***** ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973 Fix: Avoid missing class error for fetch_thirdparty method #1973

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

@ -8,7 +8,7 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step. beta version of Dolibarr, step by step.
- Check all files are commited. - Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php - Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Update version number with x.y.z-w in build/debian/changelog - Update version number with x.y.z-w in build/debian/changelog
- Commit all changes. - Commit all changes.
@ -29,7 +29,7 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step. complete release of Dolibarr, step by step.
- Check all files are commited. - Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version number with x.y.z in htdocs/filefunc.inc.php - Update version number with x.y.z in htdocs/filefunc.inc.php
- Update version number with x.y.z in build/debian/changelog - Update version number with x.y.z in build/debian/changelog
- Commit all changes. - Commit all changes.

View File

@ -3,7 +3,7 @@
This is a quick tutorial: This is a quick tutorial:
* Install ansible: * Install ansible:
> apt-get install > apt-get install ansible
* Add ip of server to manage into * Add ip of server to manage into
/etc/ansible/hosts /etc/ansible/hosts

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

@ -49,7 +49,7 @@ then
if [ -d $reflang ] if [ -d $reflang ]
then then
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
echo $dirshort est une langue alternative de $reflang echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done

View File

@ -0,0 +1,12 @@
# This is an example of multitail setup file you can use to analyze dolibarr log files.
# Usage: multitail -cS dolibarr documents/dolibarr.log
colorscheme:dolibarr
bright:1
cs_re:yellow,red:.*EMERG.*
cs_re:white,red:.*ALERT.*
cs_re:green,red:.*CRIT.*
cs_re:red:.*ERR.*
cs_re:white,yellow:.*WARNING.*
cs_re:green,yellow:.*NOTICE.*
cs_re:green:.*INFO.*
cs_re:white:.*DEBUG.*

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

@ -2,6 +2,7 @@
/* 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
@ -22,89 +23,126 @@
* \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';
/** /**
* Class Skeleton_Class
*
* Put here description of your 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 * Constructor
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct( DoliDB $db )
{ {
$this->db = $db; $this->db = $db;
return 1; return 1;
} }
/** /**
* Create object into database * Create object into database
* *
* @param User $user User that creates * @param User $user User that creates
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger=0) public function create( User $user, $notrigger = false )
{ {
global $conf, $langs; dol_syslog( __METHOD__, LOG_DEBUG );
$error = 0; $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) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) {
$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.
@ -116,45 +154,45 @@ class Skeleton_Class extends CommonObject
} }
// 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 * Load object in memory from the database
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref * @param string $ref Ref
*
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function fetch($id,$ref='') public function fetch( $id, $ref = null )
{ {
global $langs; dol_syslog( __METHOD__, LOG_DEBUG );
$sql = "SELECT";
$sql.= " t.rowid,"; $sql = 'SELECT';
$sql.= " t.field1,"; $sql .= ' t.rowid,';
$sql.= " t.field2"; $sql .= ' t.field1,';
//... $sql .= ' t.field2';
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; //...
if ($ref) $sql.= " WHERE t.ref = '".$ref."'"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
else $sql.= " WHERE t.rowid = ".$id; if (null !== $ref) {
$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 ); $numrows = $this->db->num_rows( $resql );
if ($numrows) if ($numrows) {
{
$obj = $this->db->fetch_object( $resql ); $obj = $this->db->fetch_object( $resql );
$this->id = $obj->rowid; $this->id = $obj->rowid;
@ -164,11 +202,15 @@ class Skeleton_Class extends CommonObject
} }
$this->db->free( $resql ); $this->db->free( $resql );
return ($numrows?1:0); if ($numrows) {
return 1;
} else {
return 0;
} }
else } else {
{ $this->errors[] = 'Error ' . $this->db->lasterror();
$this->error="Error ".$this->db->lasterror(); dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
return - 1; return - 1;
} }
} }
@ -181,40 +223,39 @@ class Skeleton_Class extends CommonObject
* @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 = 'SELECT';
$sql.= " t.field1,"; $sql .= ' t.rowid,';
$sql.= " t.field2"; $sql .= ' t.field1,';
$sql .= ' t.field2';
//... //...
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t"; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'mytable as t';
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count( $filter ) > 0) { if (count( $filter ) > 0) {
foreach ($filter as $key => $value) { foreach ($filter as $key => $value) {
//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape( $value ) . '%\'';
} }
} }
if (count( $sqlwhere ) > 0) { if (count( $sqlwhere ) > 0) {
$sql .= ' WHERE ' . implode( ' AND ', $sqlwhere ); $sql .= ' WHERE ' . implode( ' AND ', $sqlwhere );
} }
$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset); $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit( $limit + 1, $offset );
$this->lines = array(); $this->lines = array();
dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
$resql = $this->db->query( $sql ); $resql = $this->db->query( $sql );
if ($resql) if ($resql) {
{
$num = $this->db->num_rows( $resql ); $num = $this->db->num_rows( $resql );
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object( $resql )) {
{
$line = new Skeleton_ClassLine(); $line = new Skeleton_ClassLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -227,51 +268,65 @@ class Skeleton_Class extends CommonObject
$this->db->free( $resql ); $this->db->free( $resql );
return $num; return $num;
} } else {
else $this->errors[] = 'Error ' . $this->db->lasterror();
{ dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
$this->error="Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
return - 1; return - 1;
} }
} }
/** /**
* Update object into database * Update object into database
* *
* @param User $user User that modifies * @param User $user User that modifies
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger=0) public function update( User $user, $notrigger = false )
{ {
global $conf, $langs;
$error = 0; $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) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
}
if (! $error && ! $notrigger) if (!$error && !$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 calls a trigger. // want this action calls a trigger.
@ -282,37 +337,35 @@ class Skeleton_Class extends CommonObject
} }
// 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 1; return 1;
} }
} }
/** /**
* Delete object in database * Delete object in database
* *
* @param User $user User that deletes * @param User $user User that deletes
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger=0) public function delete( User $user, $notrigger = false )
{ {
global $conf, $langs; dol_syslog( __METHOD__, LOG_DEBUG );
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
if (! $error) if (!$error) {
{ 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 calls a trigger. // want this action calls a trigger.
@ -323,51 +376,51 @@ class Skeleton_Class extends CommonObject
} }
} }
if (! $error) if (!$error) {
{ $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= ' WHERE rowid=' . $this->id;
$sql.= " WHERE rowid=".$this->id;
dol_syslog(__METHOD__);
$resql = $this->db->query( $sql ); $resql = $this->db->query( $sql );
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
}
} }
// 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 1; 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 );
global $user;
$error = 0; $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 );
// Reset object
$object->id = 0; $object->id = 0;
$object->statut=0;
// Clear fields // Clear fields
// ... // ...
@ -376,39 +429,31 @@ class Skeleton_Class extends CommonObject
$result = $object->create( $user ); $result = $object->create( $user );
// Other options // Other options
if ($result < 0) if ($result < 0) {
{
$this->error=$object->error;
$error ++; $error ++;
} $this->errors = $object->errors;
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';
@ -417,9 +462,21 @@ class Skeleton_Class extends CommonObject
} }
/**
* 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

@ -352,8 +352,9 @@ if ($id && (empty($action) || $action == 'view'))
// Example 2 : Adding links to objects // Example 2 : Adding links to objects
// The class must extends CommonObject class to have this method available //$somethingshown=$form->showLinkedObjectBlock($object);
//$somethingshown=$object->showLinkedObjectBlock(); //$linktoelem = $form->showLinkToObjectBlock($object);
//if ($linktoelem) print '<br>'.$linktoelem;
} }

View File

@ -314,7 +314,7 @@ foreach($filesToProcess as $fileToProcess)
continue; continue;
} }
// String exists in both files and does not match // String exists in both files and value into alternative language differs from main language but also from english files
if ( if (
(! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key] (! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key]) && ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])

View File

@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
$error=0;
// Langs // Langs
$langs->load("bills"); $langs->load("bills");
$langs->load("accountancy"); $langs->load("accountancy");
@ -67,11 +69,11 @@ if ($action == 'add')
if ($res == 0) { if ($res == 0) {
} else { } else {
if ($res == - 3) { if ($res == - 3) {
$_error = 1; $error = 1;
$action = "create"; $action = "create";
} }
if ($res == - 4) { if ($res == - 4) {
$_error = 2; $error = 2;
$action = "create"; $action = "create";
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-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
@ -206,34 +206,40 @@ if ($action == 'create') {
print '<input type="hidden" name="action" value="confirm_create">' . "\n"; print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n"; print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>'; print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>'; print '<td>' . $next_num_mvt . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>'; print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>'; print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>'; print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>'; print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>'; print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>'; print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>'; print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>'; print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>';
print '<input type="submit" class="butAction" value="' . $langs->trans("Save") . '">'; dol_fiche_end();
print '<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@ -1,7 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-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
@ -44,7 +44,6 @@ if ($user->societe_id > 0)
/* /*
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
if (! GETPOST('cancel', 'alpha')) if (! GETPOST('cancel', 'alpha'))
{ {
@ -63,6 +62,10 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
} }
} }
/*
* View
*/
llxHeader("", "", "FicheVentilation"); llxHeader("", "", "FicheVentilation");
if ($cancel == $langs->trans("Cancel")) { if ($cancel == $langs->trans("Cancel")) {
@ -108,6 +111,8 @@ if (! empty($id)) {
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup'); print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup');
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref facture // Ref facture
@ -120,13 +125,13 @@ if (! empty($id)) {
print '<tr><td width="20%">' . $langs->trans("Line") . '</td>'; print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
print '<td>' . nl2br($objp->description) . '</td></tr>'; print '<td>' . nl2br($objp->description) . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
print $objp->account_number . '-' . $objp->label;
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br><div class="center">'; dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 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>
* *
@ -172,8 +172,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var;
print '<tr><td>' . length_accountg($row[0]) . '</td>'; print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -43,7 +43,7 @@ $search_facture = GETPOST('search_facture','alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount','alpha');
$search_acount = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)

View File

@ -555,9 +555,9 @@ else
$h=0; $h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal; $head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal;
$head[$h][1] = $langs->trans("Report"); $head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report'; $head[$h][2] = 'card';
dol_fiche_head($head, $hselected); dol_fiche_head($head, 'card', $langs->trans("BankJournal"), 0, 'payment');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">';
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -34,32 +34,33 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
// Langs // Langs
$langs->load("compta");
$langs->load("bills"); $langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$action = GETPOST('action'); $action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
$codeventil = GETPOST('codeventil'); $codeventil = GETPOST('codeventil');
$id = GETPOST('id');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
if (! GETPOST('cancel', 'alpha'))
{ {
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
dol_syslog('accountancy/journal/sellsjournal.php:: $sql=' . $sql); dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (! $resql) {
setEventMessage($db->lasterror(), 'errors'); setEventMessage($db->lasterror(), 'errors');
} }
} else {
header("Location: ./lines.php");
exit();
}
} }
/* /*
@ -78,7 +79,7 @@ $form = new Form($db);
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
if ($_GET["id"]) { if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
$sql .= ", aa.account_number, aa.label"; $sql .= ", aa.account_number, aa.label";
@ -87,11 +88,14 @@ if ($_GET["id"]) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
} }
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
@ -103,7 +107,10 @@ if ($_GET["id"]) {
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="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print_fiche_titre($langs->trans("SuppliersVentilation")); $linkback='<a href="'.DOL_URL_ROOT.'/accountancy/supplier/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('SuppliersVentilation'),$linkback,'title_setup');
dol_fiche_head();
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
@ -119,19 +126,24 @@ if ($_GET["id"]) {
print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>'; print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
print $objp->account_number . '-' . $objp->label;
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="' . $langs->trans("Update") . '"></td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>'; print '</form>';
} else { } else {
print "Error 1"; print "Error";
} }
} else { } else {
print "Error 2"; print "Error";
} }
} else { } else {
print "Error ID incorrect"; print "Error ID incorrect";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -158,8 +158,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var;
print '<tr><td>' . length_accountg($row[0]) . '</td>'; print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -44,7 +44,7 @@ $search_facture = GETPOST('search_facture','alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount','alpha');
$search_acount = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)

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

@ -1045,7 +1045,7 @@ else
{ {
if ($object->photo) print "<br>\n"; if ($object->photo) print "<br>\n";
print '<table class="nobordernopadding">'; print '<table class="nobordernopadding">';
if ($object->photo) print '<tr><td align="center"><input type="checkbox" class="flat" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>'; if ($object->photo) print '<tr><td align="center"><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>'; print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>'; print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
print '</table>'; print '</table>';

View File

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

View File

@ -107,7 +107,7 @@ if ($sall)
foreach ($scrit as $crit) foreach ($scrit as $crit)
{ {
$sql.=" AND ("; $sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR "; if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR ";
$sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'"; $sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'"; $sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')"; $sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')";
@ -115,7 +115,7 @@ if ($sall)
} }
if ($type > 0) if ($type > 0)
{ {
$sql.=" AND t.rowid=".$type; $sql.=" AND t.rowid=".$db->escape($type);
} }
if (isset($_GET["statut"]) || isset($_POST["statut"])) if (isset($_GET["statut"]) || isset($_POST["statut"]))
{ {

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);
@ -383,7 +385,7 @@ if ($action == 'edit' || $action == 'updateedit')
} }
else else
{ {
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">'; print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.jpg">';
} }
print '</td></tr></table>'; print '</td></tr></table>';
print '</td></tr>'; print '</td></tr>';
@ -420,7 +422,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr '.$bc[$var].'><td><label for="legal_form">'.$langs->trans("JuridicalStatus").'</label></td><td>'; print '<tr '.$bc[$var].'><td><label for="legal_form">'.$langs->trans("JuridicalStatus").'</label></td><td>';
if ($mysoc->country_code) if ($mysoc->country_code)
{ {
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,$mysoc->country_code); print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'legal_form');
} }
else else
{ {
@ -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>';
@ -769,7 +777,7 @@ else
} }
else else
{ {
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">'; print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.jpg">';
} }
print '</td></tr></table>'; print '</td></tr></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

@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25,0,26); $taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,24,0,22,20,18,21,0,15,0,25,0,26);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();
@ -832,7 +832,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
// Line for title // Line for title
print '<tr class="liste_titre">'; print '<tr class="liste_titre nohover">';
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles

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,8 +282,6 @@ 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 // Show bugtrack link
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
@ -288,13 +289,12 @@ if ($action == 'edit') // Edit
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; 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 // Show bugtrack link
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>"; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print "</tr>"; print "</tr>";
}
// Message login // Message login
$var=!$var; $var=!$var;

View File

@ -121,7 +121,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
$pathtodelete=$listofpaths[$keytodelete]; $pathtodelete=$listofpaths[$keytodelete];
$filetodelete=$listofnames[$keytodelete]; $filetodelete=$listofnames[$keytodelete];
$result = dol_delete_file($pathtodelete,1); $result = dol_delete_file($pathtodelete,1);
if ($result >= 0) if ($result)
{ {
setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); setEventMessage($langs->trans("FileWasRemoved"), $filetodelete);

View File

@ -53,7 +53,9 @@ print '<br><br>';
// Show logo // Show logo
print '<div class="center"><div class="logo_setup"></div></div>'; //print '<div class="center"><div class="logo_setup"></div></div>';
print '<center><div class="logo_setup"></div></center>'; // For a reason I don't know, the div class="center does not works, we must keep the <center>
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -89,7 +89,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf
// If (file that is not logfile) or (if logfile with option logfile) // If (file that is not logfile) or (if logfile with option logfile)
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile') if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
{ {
$count+=dol_delete_file($filesarray[$key]['fullname']); $count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0);
} }
} }
} }

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;
/** /**
@ -46,22 +46,14 @@ class DolibarrApiAccess implements iAuthenticate
// @codingStandardsIgnoreStart // @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 +66,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))
{ {
@ -115,8 +108,13 @@ class DolibarrApiAccess implements iAuthenticate
return in_array(static::$role, (array) static::$requires) || static::$role == 'admin'; return in_array(static::$role, (array) static::$requires) || static::$role == 'admin';
} }
// @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 '';
} }
@ -128,6 +126,7 @@ class DolibarrApiAccess implements iAuthenticate
* @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)
{ {

View File

@ -102,7 +102,7 @@ print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
print $form->select_thirdparty($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',0,array(),1); print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,0,1,array(),0);
print '</td></tr>'; print '</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2015 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
* 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
@ -41,8 +42,10 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
//header("Content-type: text/html; charset=UTF-8"); //header("Content-type: text/html; charset=UTF-8");
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
$search = GETPOST("code", "alpha");
// Search from criteria // Search from criteria
if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at least if (dol_strlen($search) >= 0) // If search criteria is on char length at least
{ {
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx"; $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
@ -54,11 +57,15 @@ if (dol_strlen($_GET["code"]) >= 0) // If search criteria is on char length at l
// Add criteria on ref/label // Add criteria on ref/label
if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) if (! empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{ {
$sql.= " AND (p.ref LIKE '".$_GET['code']."%' OR p.label LIKE '".$_GET['code']."%')"; $sql.= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($search)."%'";
$sql.= ")";
} }
else else
{ {
$sql.= " AND (p.ref LIKE '%".$_GET['code']."%' OR p.label LIKE '%".$_GET['code']."%')"; $sql.= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'";
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$db->escape($search)."%'";
$sql.= ")";
} }
$sql.= " ORDER BY label"; $sql.= " ORDER BY label";

View File

@ -1,5 +1,6 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2015 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
* 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
@ -59,8 +60,8 @@ function afficheDonnees(aId, aTexte) {
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage // aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode) { function verifResultat(aCible, aCode, iLimit = 1) {
if (aCode != '') { if (aCode != '' && aCode.length >= iLimit) {
if (texte = file ('facturation_dhtml.php?code='+escape(aCode))) { if (texte = file ('facturation_dhtml.php?code='+escape(aCode))) {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 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
* 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
@ -43,8 +44,8 @@ $langs->load("cashdesk");
<!-- Affichage de la reference et de la designation --> <!-- Affichage de la reference et de la designation -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>" <td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');" onchange="javascript: setSource('REF');"
onkeyup="javascript: verifResultat('resultats_dhtml', this.value);" onkeyup="javascript: verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value);" onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/> onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
</td> </td>
<td class="select_design"> <td class="select_design">

View File

@ -65,6 +65,10 @@ $object = new Categorie($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/* /*
* Actions * Actions
*/ */

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
* *
@ -479,8 +548,9 @@ 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,27 +562,20 @@ 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 .= " (fk_categorie, fk_" . $this->MAP_CAT_FK[$type] . ")";
$sql .= " VALUES (" . $this->id . ", " . $obj->id . ")"; $sql .= " VALUES (" . $this->id . ", " . $obj->id . ")";
dol_syslog(get_class($this).'::add_type', LOG_DEBUG); dol_syslog(get_class($this).'::add_type', LOG_DEBUG);
@ -596,8 +659,9 @@ 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))
@ -654,39 +720,30 @@ 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, ...)
* *
@ -817,14 +850,25 @@ class Categorie extends CommonObject
* 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
* mode (0, 1, 2, ...) is deprecated.
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree. * @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. * @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, ...)
@ -837,7 +881,7 @@ class Categorie extends CommonObject
$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,37 +1215,35 @@ class Categorie extends CommonObject
} }
/** /**
* Return list of categories (id or instances) linked to element of id $id and type $type * Return list of categories (object instances or labels) 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.
* @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 * @return mixed Array of category objects or < 0 if KO
*/ */
function containing($id,$type,$mode='object') function containing($id,$type,$mode='object')
{ {
$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'; {
} else if ($type == '1' || $type == 'supplier') { dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
$typeid=self::TYPE_SUPPLIER; $table='soc'; $type='fournisseur'; // We want to reverse lookup
} else if ($type == '2' || $type == 'customer') { $map_type = array_flip($this->MAP_ID);
$typeid=self::TYPE_CUSTOMER; $table='soc'; $type='societe'; $type = $map_type[$type];
} 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);
$res = $this->db->query($sql); $res = $this->db->query($sql);
if ($res) if ($res)
{ {
@ -1241,18 +1283,25 @@ 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)
{ {

View File

@ -56,6 +56,9 @@ $object = new Categorie($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/* /*
* Actions * Actions
*/ */

View File

@ -64,6 +64,9 @@ $type=$object->type;
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard'));
/* /*
* Actions * Actions
*/ */

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 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -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';
@ -151,7 +151,7 @@ if ($action == 'add')
exit; exit;
} }
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters // Clean parameters
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
@ -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'], true);
$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;
@ -671,19 +671,19 @@ if ($action == 'create')
} }
// Assigned to // Assigned to
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
$listofuserid=array(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
$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');
@ -727,7 +727,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
$form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1); $form->select_contacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
@ -739,7 +739,7 @@ if ($action == 'create')
// Projet associe // Projet associe
$langs->load("projects"); $langs->load("projects");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'; print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
if ($numproject==0) if ($numproject==0)
@ -768,7 +768,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90); $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90);
$doleditor->Create(); $doleditor->Create();
@ -915,7 +915,7 @@ if ($id > 0)
} }
// Assigned to // Assigned to
print '<tr><td class="nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">'; print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
$listofuserid=array(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
@ -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');
@ -968,7 +968,7 @@ if ($id > 0)
// Contact // Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">'; print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
$form->select_contacts($object->socid, $object->contactid,'contactid',1); $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
} }
@ -981,7 +981,7 @@ if ($id > 0)
// Projet associe // Projet associe
$langs->load("project"); $langs->load("project");
print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
if ($numprojet==0) if ($numprojet==0)
{ {
@ -1004,7 +1004,7 @@ if ($id > 0)
} }
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
@ -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);
@ -1168,7 +1168,7 @@ if ($id > 0)
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
if ($object->fk_project) if ($object->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -1192,7 +1192,7 @@ if ($id > 0)
} }
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print dol_htmlentitiesbr($object->note); print dol_htmlentitiesbr($object->note);
print '</td></tr>'; print '</td></tr>';
@ -1267,7 +1267,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1276,7 +1276,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1285,7 +1285,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1294,7 +1294,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

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

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-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) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@ -143,7 +143,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
// Date start // Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
@ -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);
@ -235,7 +235,7 @@ if ($object->id > 0)
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Project").'</td><td colspan="3">';
if ($object->fk_project) if ($object->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -274,7 +274,7 @@ if ($object->id > 0)
} }
print '<tr><td width="30%" nowrap>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
@ -294,7 +294,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -303,7 +303,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -312,7 +312,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -321,7 +321,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

View File

@ -1709,10 +1709,12 @@ if ($action == 'create')
$somethingshown = $formfile->show_documents('askpricesupplier', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); $somethingshown = $formfile->show_documents('askpricesupplier', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
/* // Linked object block
* Linked object block $somethingshown = $form->showLinkedObjectBlock($object);
*/
$somethingshown = $object->showLinkedObjectBlock(); // Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object);
//if ($linktoelem) print '<br>'.$linktoelem;
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
@ -1736,7 +1738,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
@ -1762,7 +1764,7 @@ if ($action == 'create')
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
} }

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

@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -140,7 +141,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 +469,14 @@ if ($id > 0)
print '</div></td></tr>'; print '</div></td></tr>';
} }
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
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');
@ -640,7 +643,6 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Go back to draft // Go back to draft
if ($action == 'modif' && $user->rights->propal->creer) if ($action == 'modif' && $user->rights->propal->creer)
{ {
@ -1257,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();
@ -1341,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">';
@ -1445,13 +1448,20 @@ if ($action == 'create')
} }
print '</td></tr>'; print '</td></tr>';
// Model // Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects");
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("DefaultModel") . '</td>'; print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
print '<td colspan="2">'; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
$liste = ModelePDFPropales::liste_modeles($db); 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 $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>';
print "</td></tr>"; print '</tr>';
}
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
@ -1463,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)
{
$formproject = new FormProjets($db);
$projectid = 0;
if ($origin == 'project')
$projectid = ($originid ? $originid : 0);
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">'; 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>";
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); // Public note
if ($numprojet == 0) { print '<tr>';
$langs->load("projects"); print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>'; print '<td valign="top" colspan="2">';
$note_public = '';
if (is_object($objectsrc)) // Take value from source object
{
$note_public = $objectsrc->note_public;
} }
print '</td>'; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print '</tr>'; print $doleditor->Create(1);
// Private note
if (empty($user->societe_id))
{
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
$note_private = '';
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object
{
$note_private = $objectsrc->note_private;
}
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
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
@ -2281,10 +2307,13 @@ if ($action == 'create')
$somethingshown = $formfile->show_documents('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); $somethingshown = $formfile->show_documents('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
/* // Linked object block
* Linked object block $somethingshown = $form->showLinkedObjectBlock($object);
*/
$somethingshown = $object->showLinkedObjectBlock(); // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object);
if ($linktoelem) print '<br>'.$linktoelem;
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// print '</td><td valign="top" width="50%">'; // print '</td><td valign="top" width="50%">';
@ -2311,7 +2340,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
@ -2336,7 +2365,7 @@ if ($action == 'create')
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
} }

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);
$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_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

@ -56,6 +56,7 @@ $search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha'); $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_author=GETPOST('search_author','alpha'); $search_author=GETPOST('search_author','alpha');
$search_product_category=GETPOST('search_product_category','int');
$search_town=GETPOST('search_town','alpha'); $search_town=GETPOST('search_town','alpha');
$viewstatut=$db->escape(GETPOST('viewstatut')); $viewstatut=$db->escape(GETPOST('viewstatut'));
$object_statut=$db->escape(GETPOST('propal_statut')); $object_statut=$db->escape(GETPOST('propal_statut'));
@ -91,6 +92,7 @@ if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both
$search_societe=''; $search_societe='';
$search_montant_ht=''; $search_montant_ht='';
$search_author=''; $search_author='';
$search_product_category='';
$search_town=''; $search_town='';
$year=''; $year='';
$month=''; $month='';
@ -145,14 +147,15 @@ if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
if (! $sall) $sql = 'SELECT'; $sql = 'SELECT';
else $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,'; $sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,';
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login'; $sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
// We'll need this table joined to the select in order to filter by sale // We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -190,7 +193,8 @@ if ($search_montant_ht != '')
if ($sall) { if ($sall) {
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall); $sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
} }
if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if ($viewstatut <> '') if ($viewstatut <> '')
{ {
$sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; $sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
@ -223,7 +227,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
} }
//print $sql;
$sql.= $db->plimit($limit + 1,$offset); $sql.= $db->plimit($limit + 1,$offset);
$result=$db->query($sql); $result=$db->query($sql);
@ -265,15 +269,28 @@ if ($result)
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
{ {
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; '; $moreforfilter.='</div>';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) if ($user->rights->societe->client->voir || $socid)
{ {
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1); $moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
} }
if (! empty($moreforfilter)) if (! empty($moreforfilter))
{ {

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">';
@ -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

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 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>
@ -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
*/ */
@ -2298,10 +2305,13 @@ if ($action == 'create' && $user->rights->commande->creer)
$delallowed = $user->rights->commande->supprimer; $delallowed = $user->rights->commande->supprimer;
$somethingshown = $formfile->show_documents('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); $somethingshown = $formfile->show_documents('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
/* // Linked object block
* Linked object block $somethingshown = $form->showLinkedObjectBlock($object);
*/
$somethingshown = $object->showLinkedObjectBlock(); // Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object);
//if ($linktoelem) print '<br>'.$linktoelem;
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// print '</td><td valign="top" width="50%">'; // print '</td><td valign="top" width="50%">';
@ -2324,7 +2334,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
@ -2349,7 +2358,7 @@ if ($action == 'create' && $user->rights->commande->creer)
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
} }

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

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 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>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -177,7 +177,7 @@ $form->select_comptes($account_to,'account_to',0,'',1);
print "</td>\n"; print "</td>\n";
print "<td>"; print "<td>";
$form->select_date($dateo,'','','','','add'); $form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
print "</td>\n"; print "</td>\n";
print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>'; print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>';
print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>'; print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>';

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

@ -3,7 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
@ -1759,10 +1759,8 @@ if (empty($reshook))
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action = ''; $action = '';
} }
} }
@ -1856,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');
@ -2082,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() {
@ -2105,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);
@ -2115,7 +2118,8 @@ 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)
@ -2123,36 +2127,32 @@ if ($action == 'create')
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 '</td></tr>' . "\n"; print '</div></div>';
// Next situation invoice // Next situation invoice
$opt = $form->load_situation_invoices(GETPOST('originid'), $socid); $opt = $form->selectSituationInvoices(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); $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
print $desc; print $desc;
print '</td></tr>' . "\n"; print '</div></div>';
} }
// 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() {
@ -2160,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';
@ -2172,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))
@ -2193,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() {
@ -2214,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)
@ -2227,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">';
@ -2235,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)
@ -2295,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>';
} }
@ -2322,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';
@ -2339,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
@ -2353,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>';
@ -2420,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">';
@ -2479,7 +2481,7 @@ if ($action == 'create')
// Button "Create Draft" // Button "Create Draft"
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">'; print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp; &nbsp; &nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">'; print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
@ -3521,7 +3523,7 @@ if ($action == 'create')
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%" height="18" class="nodrag nodrop">'; print '<tr width="100%" class="nodrag nodrop">';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>'; print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
@ -3774,77 +3776,10 @@ if ($action == 'create')
$somethingshown = $formfile->numoffiles; $somethingshown = $formfile->numoffiles;
// Linked object block // Linked object block
$somethingshown = $object->showLinkedObjectBlock(); $somethingshown = $form->showLinkedObjectBlock($object);
$linktoelem=''; // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
if (! empty($conf->commande->enabled))
{
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#orderlist").toggle();
jQuery("#linktoorder").toggle();
});
});
</script>
';
print '<div id="orderlist" style="display:none">';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
$sql .= ", " . MAIN_DB_PREFIX . "commande as c";
$sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . '';
$resqlorderlist = $db->query($sql);
if ($resqlorderlist)
{
$num = $db->num_rows($resqlorderlist);
$i = 0;
print '<br><form action="" method="POST" name="LinkedOrder">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("RefCustomer") . '</td>';
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
print '<td align="left">' . $langs->trans("Company") . '</td>';
print '</tr>';
while ($i < $num)
{
$objp = $db->fetch_object($resqlorderlist);
if ($objp->socid == $soc->id) {
$var = ! $var;
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value=' . $objp->rowid . '>';
print '<td align="center">' . $objp->ref . '</td>';
print '<td>' . $objp->ref_client . '</td>';
print '<td>' . price($objp->total_ht) . '</td>';
print '<td>' . $objp->name . '</td>';
print '</td>';
print '</tr>';
}
$i ++;
}
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
print '</form>';
$db->free($resqlorderlist);
} else {
dol_print_error($db);
}
print '</div>';
}
// Show link to elements
if ($linktoelem) print '<br>'.$linktoelem; if ($linktoelem) print '<br>'.$linktoelem;
// Link for paypal payment // Link for paypal payment
@ -3886,7 +3821,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
@ -3911,7 +3846,7 @@ if ($action == 'create')
dol_print_error($db, $result); dol_print_error($db, $result);
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname']; $file = $fileparams['fullname'];
} }
@ -3919,6 +3854,8 @@ if ($action == 'create')
print_titre($langs->trans($titreform)); print_titre($langs->trans($titreform));
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
dol_fiche_head();
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
@ -3990,7 +3927,7 @@ if ($action == 'create')
print $formmail->get_form(); print $formmail->get_form();
print '<br>'; dol_fiche_end();
} }
} }

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;
@ -3203,7 +3215,7 @@ class Facture extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
$response->label=$langs->trans("CustomerBillsUnpaid"); $response->label=$langs->trans("CustomerBillsUnpaid");
$response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1';
$response->img=img_object($langs->trans("Bills"),"bill"); $response->img=img_object($langs->trans("Bills"),"bill");
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
@ -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

@ -84,6 +84,8 @@ class FactureStats extends Stats
$this->where.=" AND f.fk_soc = ".$this->socid; $this->where.=" AND f.fk_soc = ".$this->socid;
} }
if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid; if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid;
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2)";
else $this->where.= " AND f.type IN (0,1,2,3)";
} }
@ -206,7 +208,7 @@ class FactureStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where; $sql.= " WHERE ".$this->where;
$sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid"; $sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
$sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";

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

@ -6,6 +6,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 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>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* 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
@ -129,6 +130,8 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="facid" value="'.$object->id.'">'; print '<input type="hidden" name="facid" value="'.$object->id.'">';
dol_fiche_head();
$rowspan=4; $rowspan=4;
if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
@ -139,7 +142,7 @@ if ($action == 'create')
// Third party // Third party
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->client->getNomUrl(1,'customer').'</td>'; print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->client->getNomUrl(1,'customer').'</td>';
print '<td>'; print '<td>';
//print $langs->trans("NotePrivate"); print $langs->trans("Comment");
print '</td></tr>'; print '</td></tr>';
// Title // Title
@ -371,10 +374,15 @@ if ($action == 'create')
print '</select>'; print '</select>';
print '</td></tr>'; print '</td></tr>';
} }
print '<tr><td colspan="3" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print "</form>\n";
print "</table>\n"; print "</table>\n";
dol_fiche_end();
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
} }
else else
{ {
@ -432,7 +440,7 @@ else
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>"; print '<tr><td>'.$langs->trans("Comment").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>";
print "</table>"; print "</table>";

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* *
* 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
@ -88,6 +89,9 @@ $search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int'); $day = GETPOST('day','int');
$month = GETPOST('month','int'); $month = GETPOST('month','int');
$year = GETPOST('year','int'); $year = GETPOST('year','int');
$day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$filtre = GETPOST('filtre'); $filtre = GETPOST('filtre');
// Security check // Security check
@ -213,6 +217,19 @@ else if ($year > 0)
{ {
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
} }
if ($month_lim > 0)
{
if ($year_lim > 0 && empty($day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'";
else if ($year_lim > 0 && ! empty($day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'";
else
$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$month_lim."'";
}
else if ($year_lim > 0)
{
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'";
}
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0) if ($search_user > 0)
{ {
@ -322,7 +339,11 @@ if ($resql)
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5); $formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="left">&nbsp;</td>'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>'; print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>'; print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre" align="right">&nbsp;</td>'; print '<td class="liste_titre" align="right">&nbsp;</td>';

View File

@ -275,7 +275,7 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s
{ {
$arrayofinclusion=array(); $arrayofinclusion=array();
foreach($_POST['toGenerate'] as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); foreach($_POST['toGenerate'] as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/');
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC); $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// liste les fichiers // liste les fichiers
$files = array(); $files = array();

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

@ -775,7 +775,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php"><span class="badge">'.$num.'</span></a></td>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status=1"><span class="badge">'.$num.'</span></a></td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.$langs->trans("AmountHT").'</td>'; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("Received").'</td>'; print '<td align="right">'.$langs->trans("Received").'</td>';

View File

@ -109,7 +109,7 @@ $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code); $nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded"); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");

View File

@ -129,7 +129,7 @@ $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); $nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$prevyear=$year_start; $prevquarter=$q; $prevyear=$year_start; $prevquarter=$q;
@ -161,7 +161,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
if ($conf->global->$calc==2) // Invoice for goods, payment for services if ($conf->global->$calc==2) // Invoice for goods, payment for services
{ {
$nom=$langs->trans($local==1?"LT1ReportByQuartersInInputOutputMode":"LT2ReportByQuartersInInputOutputMode"); $nom=$langs->trans($local==1?"LT1ReportByQuartersInInputOutputMode":"LT2ReportByQuartersInInputOutputMode");
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT'.$local.'Rec"); $calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$prevyear=$year_start; $prevquarter=$q; $prevyear=$year_start; $prevquarter=$q;

View File

@ -403,6 +403,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">'; print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">'; print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Third party // Third party
@ -462,6 +464,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</table>'; print '</table>';
dol_fiche_end();
/* /*
* List of unpaid invoices * List of unpaid invoices
*/ */

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

@ -0,0 +1,136 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/compta/salaries/document.php
* \ingroup salaries
* \brief Page of linked files onto salaries
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("other");
$langs->load("salaries");
$langs->load("companies");
$id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', $id, '');
// Get parameters
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new PaymentSalary($db);
$object->fetch($id, $ref);
$upload_dir = $conf->salaries->dir_output.'/'.dol_sanitizeFileName($object->id);
$modulepart='salaries';
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
* View
*/
$form = new Form($db);
llxHeader("","",$langs->trans("SalaryPayment"));
if ($object->id)
{
$object->fetch_thirdparty();
$head=salaries_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), 0, 'payment');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/salaries/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
// Societe
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
$modulepart = 'salaries';
$permission = $user->rights->salaries->write;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
print $langs->trans("ErrorUnknown");
}
llxFooter();
$db->close();

View File

@ -501,7 +501,7 @@ if ($id > 0)
} }
// Emettre paiement // Emettre paiement
if ($object->paye == 0 && ((price2num($object->amount) < 0 && round($resteapayer) < 0) || (price2num($object->amount) > 0 && round($resteapayer) > 0)) && $user->rights->tax->charges->creer) if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer)
{ {
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a>"; print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a>";
} }

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

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("users"); $langs->load("users");
$langs->load("other"); $langs->load("other");
@ -201,7 +202,11 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++; if ($ret < 0)
{
$error++;
$action = 'create';
}
if (! GETPOST("lastname")) if (! GETPOST("lastname"))
{ {
@ -216,6 +221,16 @@ if (empty($reshook))
{ {
$error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors)); $error++; $errors=array_merge($errors,($object->error?array($object->error):$object->errors));
$action = 'create'; $action = 'create';
} else {
// Categories association
$contcats = GETPOST( 'contcats', 'array' );
if (!empty( $contcats )) {
$cat = new Categorie( $db );
foreach ($contcats as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
} }
} }
@ -309,8 +324,22 @@ if (empty($reshook))
$result = $object->update($contactid, $user); $result = $object->update($contactid, $user);
if ($result > 0) if ($result > 0) {
{ // Categories association
// First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_contact';
$sql .= ' WHERE fk_socpeople = ' . $object->id;
$db->query( $sql );
// Then we add the associated categories
$categories = GETPOST( 'contcats', 'array' );
if (!empty( $categories )) {
$cat = new Categorie( $db );
foreach ($categories as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
$object->old_lastname=''; $object->old_lastname='';
$object->old_firstname=''; $object->old_firstname='';
$action = 'view'; $action = 'view';
@ -576,6 +605,15 @@ else
print $form->selectarray('priv',$selectarray,(GETPOST("priv",'alpha')?GETPOST("priv",'alpha'):$object->priv),0); print $form->selectarray('priv',$selectarray,(GETPOST("priv",'alpha')?GETPOST("priv",'alpha'):$object->priv),0);
print '</td></tr>'; print '</td></tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td><td colspan="3">';
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, 'parent', null, null, 1 );
print $form->multiselectarray( 'contcats', $cate_arbo, GETPOST( 'contcats', 'array' ), null, null, null,
null, '90%' );
print "</td></tr>";
}
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="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
@ -815,6 +853,20 @@ else
print $object->getLibStatut(4); print $object->getLibStatut(4);
print '</td></tr>'; print '</td></tr>';
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . fieldLabel( 'Categories', 'contcats' ) . '</td>';
print '<td colspan="3">';
$cate_arbo = $form->select_all_categories( Categorie::TYPE_CONTACT, null, null, null, null, 1 );
$c = new Categorie( $db );
$cats = $c->containing( $object->id, Categorie::TYPE_CONTACT );
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray( 'contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' );
print "</td></tr>";
}
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="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
@ -1039,6 +1091,15 @@ else
print $object->getLibStatut(4); print $object->getLibStatut(4);
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'contact', 1 );
print '</td></tr>';
}
// Other attributes // Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); $parameters=array('socid'=>$socid, 'colspan' => ' colspan="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
@ -1101,18 +1162,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)
{ {
@ -1122,6 +1179,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
@ -629,6 +645,13 @@ class Contact extends CommonObject
} }
} }
// Retreive all extrafield for contact
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
return 1; return 1;
} }
else else
@ -895,6 +918,11 @@ class Contact extends CommonObject
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowContact") . '</u>'; $label = '<u>' . $langs->trans("ShowContact") . '</u>';
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs); $label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
//if ($this->cibility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
$label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',array($this->phone_pro,$this->phone_mobile,$this->phone_perso));
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';

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

@ -159,7 +159,7 @@ else
if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")";
} }
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_firstlast_only) { if ($search_firstlast_only) {
@ -256,11 +256,11 @@ if ($result)
{ {
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param ='&begin='.htmlspecialchars($begin).'&view='.htmlspecialchars($view).'&userid='.htmlspecialchars($userid).'&contactname='.htmlspecialchars($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.htmlspecialchars($type).'&view='.htmlspecialchars($view).'&search_lastname='.htmlspecialchars($search_lastname).'&search_firstname='.htmlspecialchars($search_firstname).'&search_societe='.htmlspecialchars($search_societe).'&search_email='.htmlspecialchars($search_email);
if (!empty($search_categ)) $param.='&search_categ='.$search_categ; if (!empty($search_categ)) $param.='&search_categ='.htmlspecialchars($search_categ);
if ($search_status != '') $param.='&amp;search_status='.$search_status; if ($search_status != '') $param.='&amp;search_status='.htmlspecialchars($search_status);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".htmlspecialchars($search_priv);
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
@ -269,7 +269,7 @@ if ($result)
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="view" value="'.$view.'">'; print '<input type="hidden" name="view" value="'.htmlspecialchars($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -317,36 +317,36 @@ if ($result)
// Ligne des champs de filtres // Ligne des champs de filtres
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_lastname" size="9" value="'.$search_lastname.'">'; print '<input class="flat" type="text" name="search_lastname" size="9" value="'.dol_escape_htmltag($search_lastname).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_firstname" size="9" value="'.$search_firstname.'">'; print '<input class="flat" type="text" name="search_firstname" size="9" value="'.dol_escape_htmltag($search_firstname).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_poste" size="9" value="'.$search_poste.'">'; print '<input class="flat" type="text" name="search_poste" size="9" value="'.dol_escape_htmltag($search_poste).'">';
print '</td>'; print '</td>';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_societe" size="9" value="'.$search_societe.'">'; print '<input class="flat" type="text" name="search_societe" size="9" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.$search_phonepro.'">'; print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.dol_escape_htmltag($search_phonepro).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.$search_phonemob.'">'; print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.dol_escape_htmltag($search_phonemob).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_fax" size="8" value="'.$search_fax.'">'; print '<input class="flat" type="text" name="search_fax" size="8" value="'.dol_escape_htmltag($search_fax).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_email" size="8" value="'.$search_email.'">'; print '<input class="flat" type="text" name="search_email" size="8" value="'.dol_escape_htmltag($search_email).'">';
print '</td>'; print '</td>';
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_skype" size="8" value="'.$search_skype.'">'; print '<input class="flat" type="text" name="search_skype" size="8" value="'.dol_escape_htmltag($search_skype).'">';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';

View File

@ -823,10 +823,8 @@ else if ($action == 'remove_file' && $user->rights->contrat->creer) {
$upload_dir = $conf->contrat->dir_output; $upload_dir = $conf->contrat->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
} }
} }
@ -1873,10 +1871,13 @@ else
$somethingshown = $formfile->show_documents('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); $somethingshown = $formfile->show_documents('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
/* // Linked object block
* Linked object block $somethingshown = $form->showLinkedObjectBlock($object);
*/
$somethingshown=$object->showLinkedObjectBlock(); // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object);
if ($linktoelem) print '<br>'.$linktoelem;
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

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

@ -100,7 +100,8 @@ $sql.= ", ".MAIN_DB_PREFIX."contrat as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
$sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$db->escape($socid);
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_name) { if ($search_name) {
$sql .= natural_search('s.nom', $search_name); $sql .= natural_search('s.nom', $search_name);
@ -154,9 +155,10 @@ if ($resql)
} }
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$param='&amp;search_contract='.$search_contract;
$param.='&amp;search_name='.$search_name; $param='&search_contract='.$search_contract;
$param.='&amp;search_ref_supplier='.$search_ref_supplier; $param.='&search_name='.$search_name;
$param.='&search_ref_supplier='.$search_ref_supplier;
$param.='&search_sale=' .$search_sale; $param.='&search_sale=' .$search_sale;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
@ -175,13 +177,13 @@ if ($resql)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="3" name="search_contract" value="'.$search_contract.'">'; print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">'; print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.$search_name.'">'; print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011-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
@ -148,7 +148,21 @@ if ($action == 'add')
} }
} }
$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params,(GETPOST('alwayseditable')?1:0)); $result=$extrafields->addExtraField(
GETPOST('attrname'),
GETPOST('label'),
GETPOST('type'),
GETPOST('pos'),
$extrasize,
$elementtype,
(GETPOST('unique')?1:0),
(GETPOST('required')?1:0),
$default_value,
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved')); setEventMessage($langs->trans('SetupSaved'));
@ -285,7 +299,20 @@ if ($action == 'update')
$params['options'][$key] = $value; $params['options'][$key] = $value;
} }
} }
$result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params,(GETPOST('alwayseditable')?1:0)); $result=$extrafields->update(
GETPOST('attrname'),
GETPOST('label'),
GETPOST('type'),
$extrasize,
$elementtype,
(GETPOST('unique')?1:0),
(GETPOST('required')?1:0),
$pos,
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
);
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved')); setEventMessage($langs->trans('SetupSaved'));

View File

@ -37,7 +37,7 @@
class CMailFile class CMailFile
{ {
var $subject; // Topic: Subject of email var $subject; // Topic: Subject of email
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@mydomain.com>' or 'John Doe <myemail@mydomain.com>' or '<myemail+trackingid@mydomain.com>') var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>')
// Sender: Who send the email ("Sender" has sent emails on behalf of "From"). // Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain. // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
// Return-Path: Email where to send bounds. // Return-Path: Email where to send bounds.
@ -387,7 +387,7 @@ class CMailFile
// If Windows, sendmail_from must be defined // If Windows, sendmail_from must be defined
if (isset($_SERVER["WINDIR"])) if (isset($_SERVER["WINDIR"]))
{ {
if (empty($this->addr_from)) $this->addr_from = 'robot@mydomain.com'; if (empty($this->addr_from)) $this->addr_from = 'robot@example.com';
@ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2)); @ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2));
} }

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);
@ -525,9 +545,9 @@ abstract class CommonObject
* Return array with list of possible values for type of contacts * Return array with list of possible values for type of contacts
* *
* @param string $source 'internal', 'external' or 'all' * @param string $source 'internal', 'external' or 'all'
* @param string $order Sort order by : 'code' or 'rowid' * @param string $order Sort order by 'code' or 'rowid'
* @param string $option 0=Return array id->label, 1=Return array code->label * @param int $option 0=Return array id->label, 1=Return array code->label
* @param string $activeonly 0=all status of contact, 1=only the active * @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1) * @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/ */
@ -541,7 +561,7 @@ abstract class CommonObject
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE tc.element='".$this->element."'"; $sql.= " WHERE tc.element='".$this->element."'";
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active type if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'"; if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'";
if (! empty($code)) $sql.= " AND tc.code='".$code."'"; if (! empty($code)) $sql.= " AND tc.code='".$code."'";
$sql.= " ORDER by tc.".$order; $sql.= " ORDER by tc.".$order;
@ -626,12 +646,12 @@ abstract class CommonObject
} }
/** /**
* Charge le contact d'id $id dans this->contact * Load object contact with id=$this->contactid into $this->contact
* *
* @param int $contactid Id du contact. Use this->contactid if empty. * @param int $contactid Id du contact. Use this->contactid if empty.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_contact($contactid='') function fetch_contact($contactid=null)
{ {
if (empty($contactid)) $contactid=$this->contactid; if (empty($contactid)) $contactid=$this->contactid;
@ -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;
@ -864,7 +888,7 @@ abstract class CommonObject
* @param int $id To force other object id (should not be used) * @param int $id To force other object id (should not be used)
* @param string $format Data format ('text', 'date'). 'text' is used if not defined * @param string $format Data format ('text', 'date'). 'text' is used if not defined
* @param string $id_field To force rowid field name. 'rowid' is used it not defined * @param string $id_field To force rowid field name. 'rowid' is used it not defined
* @param string $user Update last update fields also if user object provided * @param User|string $user Update last update fields also if user object provided
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='') function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
@ -1642,6 +1666,7 @@ abstract class CommonObject
* @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)
{ {
@ -1655,10 +1680,10 @@ abstract class CommonObject
* @param int $exclspec >0 = Exclude special product (product_type=9) * @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object. * @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object. * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object and for this, we need seller object.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='') function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null)
{ {
global $conf; global $conf;
@ -2555,87 +2580,18 @@ abstract class CommonObject
// TODO: All functions here must be redesigned and moved as they are not business functions but output functions // TODO: All functions here must be redesigned and moved as they are not business functions but output functions
// -------------------- // --------------------
/* This is to show linked object block */
/** /**
* Show linked object block * Show linked object block.
* TODO Move this into html.class.php
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
* *
* @return int * @return int <0 if KO, >0 if OK
* @deprecated 3.8 Use instead $form->shoLinkedObjectBlock($object)
*/ */
function showLinkedObjectBlock() function showLinkedObjectBlock()
{ {
global $conf,$langs,$hookmanager; global $form;
global $bc; return $form->showLinkedObjectBlock($this);
$this->fetchObjectLinked();
// Bypass the default method
$hookmanager->initHooks(array('commonobject'));
$parameters=array();
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$this,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
$num = count($this->linkedObjects);
foreach($this->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$element = $regs[1];
$subelement = $regs[2];
$tplpath = $element.'/'.$subelement;
} }
// To work with non standard path
if ($objecttype == 'facture') {
$tplpath = 'compta/'.$element;
if (empty($conf->facture->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'propal') {
$tplpath = 'comm/'.$element;
if (empty($conf->propal->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'askpricesupplier') {
$tplpath = 'comm/'.$element;
if (empty($conf->askpricesupplier->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
$tplpath = 'expedition';
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'delivery') {
$tplpath = 'livraison';
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
}
else if ($objecttype == 'invoice_supplier') {
$tplpath = 'fourn/facture';
}
else if ($objecttype == 'order_supplier') {
$tplpath = 'fourn/commande';
}
global $linkedObjectBlock;
$linkedObjectBlock = $objects;
// Output template part (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl'));
foreach($dirtpls as $reldir)
{
$res=@include dol_buildpath($reldir.'/linkedobjectblock.tpl.php');
if ($res) break;
}
}
return $num;
}
}
/* This is to show add lines */ /* This is to show add lines */
@ -2684,9 +2640,9 @@ abstract class CommonObject
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
* *
* @param string $action Action code * @param string $action Action code
* @param string $seller Object of seller third party * @param Societe $seller Object of seller third party
* @param string $buyer Object of buyer third party * @param Societe $buyer Object of buyer third party
* @param string $selected Object line selected * @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @return void * @return void
*/ */
@ -2805,9 +2761,9 @@ abstract class CommonObject
* @param int $num Number of line (0) * @param int $num Number of line (0)
* @param int $i I * @param int $i I
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param string $seller Object of seller third party * @param Societe $seller Object of seller third party
* @param string $buyer Object of buyer third party * @param Societe $buyer Object of buyer third party
* @param string $selected Object line selected * @param int $selected Object line selected
* @param object $extrafieldsline Object of extrafield line attribute * @param object $extrafieldsline Object of extrafield line attribute
* @return void * @return void
*/ */
@ -3083,222 +3039,18 @@ abstract class CommonObject
} }
/**
* get Margin info
*
* @param string $force_price True of not
* @return mixed Array with info
*/
function getMarginInfos($force_price=false)
{
global $conf;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$marginInfos = array(
'pa_products' => 0,
'pv_products' => 0,
'margin_on_products' => 0,
'margin_rate_products' => '',
'mark_rate_products' => '',
'pa_services' => 0,
'pv_services' => 0,
'margin_on_services' => 0,
'margin_rate_services' => '',
'mark_rate_services' => '',
'pa_total' => 0,
'pv_total' => 0,
'total_margin' => 0,
'total_margin_rate' => '',
'total_mark_rate' => ''
);
foreach($this->lines as $line) {
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
$product = new ProductFournisseur($this->db);
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
$line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
$line->pa_ht += $product->fourn_unitcharges;
}
// si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente
if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) {
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
}
// calcul des marges
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
$marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_products'] += $pv - $pa;
}
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
$marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_services'] += $pv - $pa;
}
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
}
}
else {
$type=$line->product_type?$line->product_type:$line->fk_product_type;
if ($type == 0) { // product
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_products'] += $pa;
$marginInfos['pv_products'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_products'] += $pv - $pa;
}
elseif ($type == 1) { // service
$pa = $line->qty * $line->pa_ht;
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
$marginInfos['pa_services'] += $pa;
$marginInfos['pv_services'] += $pv;
$marginInfos['pa_total'] += $pa;
$marginInfos['pv_total'] += $pv;
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($pv < 0)
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
else
$marginInfos['margin_on_services'] += $pv - $pa;
}
}
}
if ($marginInfos['pa_products'] > 0)
$marginInfos['margin_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pa_products'];
if ($marginInfos['pv_products'] > 0)
$marginInfos['mark_rate_products'] = 100 * $marginInfos['margin_on_products'] / $marginInfos['pv_products'];
if ($marginInfos['pa_services'] > 0)
$marginInfos['margin_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pa_services'];
if ($marginInfos['pv_services'] > 0)
$marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services'];
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
if ($marginInfos['pv_total'] < 0)
$marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']);
else
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
if ($marginInfos['pa_total'] > 0)
$marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total'];
if ($marginInfos['pv_total'] > 0)
$marginInfos['total_mark_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pv_total'];
return $marginInfos;
}
/** /**
* Show the array with all margin infos * Show the array with all margin infos
* *
* @param string $force_price Force price * @param boolean $force_price Force price
* @return void * @return void
* @deprecated 3.8 Load FormMargin class and make a direct call to displayMarginInfos
*/ */
function displayMarginInfos($force_price=false) function displayMarginInfos($force_price=false)
{ {
global $langs, $conf, $user; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
$formmargin=new FormMargin($this->db);
if (! empty($user->societe_id)) return; $formmargin->displayMarginInfos($this, $force_price);
if (! $user->rights->margins->liretous) return;
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
$marginInfo = $this->getMarginInfos($force_price);
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
{
print $langs->trans('ShowMarginInfos').' : ';
$hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW'];
print '<span id="showMarginInfos" class="linkobject '.(!empty($hidemargininfos)?'':'hideobject').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
print '<span id="hideMarginInfos" class="linkobject '.(!empty($hidemargininfos)?'hideobject':'').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
print '<script>$(document).ready(function() {
$("span#showMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 0); $(".margininfos").show(); $("span#showMarginInfos").addClass("hideobject"); $("span#hideMarginInfos").removeClass("hideobject");})});
$("span#hideMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 1); $(".margininfos").hide(); $("span#hideMarginInfos").addClass("hideobject"); $("span#showMarginInfos").removeClass("hideobject");})});
});</script>';
if (!empty($hidemargininfos)) print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
}
print '<table class="nobordernopadding margintable" width="100%">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans('Margins').'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans('SellingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1")
print '<td class="liste_titre" align="right">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td class="liste_titre" align="right">'.$langs->trans('CostPrice').'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans('Margin').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td class="liste_titre" align="right">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td class="liste_titre" align="right">'.$langs->trans('MarkRate').'</td>';
print '</tr>';
if (! empty($conf->product->enabled))
{
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="impair">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td align="right">'.price($marginInfo['pv_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_products'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
if (! empty($conf->service->enabled))
{
print '<tr class="pair">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td align="right">'.price($marginInfo['pv_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_services'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
{
print '<tr class="impair">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td align="right">'.price($marginInfo['pv_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['pa_total'], null, null, null, null, $rounding).'</td>';
print '<td align="right">'.price($marginInfo['total_margin'], null, null, null, null, $rounding).'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right">'.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'</td>';
print '</tr>';
}
print '</table>';
} }
@ -3726,7 +3478,7 @@ abstract class CommonObject
{ {
$attributeKey = substr($key,8); // Remove 'options_' prefix $attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey]; $attributeType = $extrafields->attribute_type[$attributeKey];
$attributeSize = $extrafields->attribute_size[$attributeKey]; //$attributeSize = $extrafields->attribute_size[$attributeKey]; Not required to insert an extrafield value. Only used for definition.
$attributeLabel = $extrafields->attribute_label[$attributeKey]; $attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey]; $attributeParam = $extrafields->attribute_param[$attributeKey];
switch ($attributeType) switch ($attributeType)
@ -3771,6 +3523,7 @@ abstract class CommonObject
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
$this->db->query($sql_del); $this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {
@ -3825,7 +3578,7 @@ abstract class CommonObject
* *
* @return string * @return string
*/ */
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='')
{ {
global $_POST, $conf; global $_POST, $conf;
@ -3956,14 +3709,15 @@ abstract class CommonObject
* 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

@ -404,7 +404,7 @@ class Conf
$this->css = "/theme/".$this->theme."/style.css.php"; $this->css = "/theme/".$this->theme."/style.css.php";
// conf->email_from = email pour envoi par dolibarr des mails automatiques // conf->email_from = email pour envoi par dolibarr des mails automatiques
$this->email_from = "robot@domain.com"; $this->email_from = "robot@example.com";
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;
// conf->notification->email_from = email pour envoi par Dolibarr des notifications // conf->notification->email_from = email pour envoi par Dolibarr des notifications

View File

@ -91,7 +91,14 @@ class dolprintIPP
} }
} }
// Getting Jobs // Getting Jobs
$ipp->getJobs(false,0,'completed',false); try {
$ipp->getJobs(false,0,'completed',false); // May return errors if setup not correct
}
catch(Exception $e)
{
print $e->getMessage();
}
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>Id</td>"; print "<td>Id</td>";
@ -102,8 +109,10 @@ class dolprintIPP
print "<td>Cancel</td>"; print "<td>Cancel</td>";
print "</tr>\n"; print "</tr>\n";
$jobs = $ipp->jobs_attributes; $jobs = $ipp->jobs_attributes;
$var = True; $var = true;
//print '<pre>'.print_r($jobs,true).'</pre>'; //print '<pre>'.print_r($jobs,true).'</pre>';
if (is_array($jobs))
{
foreach ($jobs as $value) foreach ($jobs as $value)
{ {
$var=!$var; $var=!$var;
@ -116,6 +125,7 @@ class dolprintIPP
print '<td>'.$value->job_uri->_value0.'</td>'; print '<td>'.$value->job_uri->_value0.'</td>';
print '</tr>'; print '</tr>';
} }
}
print "</table>"; print "</table>";
} }

View File

@ -39,7 +39,7 @@ class ExtraFields
var $attribute_type; var $attribute_type;
// Tableau contenant le nom des champs en clef et le label de ces champs en value // Tableau contenant le nom des champs en clef et le label de ces champs en value
var $attribute_label; var $attribute_label;
// Tableau contenant le nom des champs en clef et la taille de ces champs en value // Tableau contenant le nom des champs en clef et la taille/longueur max de ces champs en value
var $attribute_size; var $attribute_size;
// Tableau contenant le nom des choix en clef et la valeur de ces choix en value // Tableau contenant le nom des choix en clef et la valeur de ces choix en value
var $attribute_choice; var $attribute_choice;
@ -124,6 +124,7 @@ class ExtraFields
if (empty($label)) return -1; if (empty($label)) return -1;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
// Create field into database except for separator type which is not stored in database // Create field into database except for separator type which is not stored in database
if ($type != 'separate') if ($type != 'separate')
@ -169,6 +170,7 @@ class ExtraFields
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0) private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0)
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -248,6 +250,7 @@ class ExtraFields
global $conf; global $conf;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
// Clean parameters // Clean parameters
if (empty($pos)) $pos=0; if (empty($pos)) $pos=0;
@ -308,6 +311,7 @@ class ExtraFields
function delete($attrname, $elementtype='member') function delete($attrname, $elementtype='member')
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -342,6 +346,7 @@ class ExtraFields
global $conf; global $conf;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
@ -389,6 +394,7 @@ class ExtraFields
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='') function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='')
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -486,6 +492,8 @@ class ExtraFields
// Clean parameters // Clean parameters
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
if (empty($list)) $list=0; if (empty($list)) $list=0;
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
@ -570,6 +578,7 @@ class ExtraFields
if ( empty($elementtype) ) return array(); if ( empty($elementtype) ) return array();
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$array_name_label=array(); $array_name_label=array();

View File

@ -116,9 +116,9 @@ class HookManager
* @param array $parameters Array of parameters * @param array $parameters Array of parameters
* @param Object $object Object to use hooks on * @param Object $object Object to use hooks on
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 means KO. * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint.
* Can also return some values into an array ->results. * All types can also return some values into an array ->results.
* $this->error or this->errors are also defined by class called by this function if error. * $this->error or this->errors are also defined by class called by this function if error.
*/ */
function executeHooks($method, $parameters=false, &$object='', &$action='') function executeHooks($method, $parameters=false, &$object='', &$action='')
@ -135,6 +135,7 @@ class HookManager
array( array(
'addMoreActionsButtons', 'addMoreActionsButtons',
'addStatisticLine', 'addStatisticLine',
'deleteFile',
'doActions', 'doActions',
'formCreateThirdpartyOptions', 'formCreateThirdpartyOptions',
'formObjectOptions', 'formObjectOptions',
@ -147,7 +148,7 @@ class HookManager
'formatEvent' 'formatEvent'
) )
)) $hooktype='addreplace'; )) $hooktype='addreplace';
// Deprecated hook types // Deprecated hook types ('returnvalue')
if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks. if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks.
if ($method == 'insertExtraFields') if ($method == 'insertExtraFields')
{ {
@ -195,7 +196,7 @@ class HookManager
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
} }
// Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
else else
{ {
// TODO. this should be done into the method of hook by returning nothing // TODO. this should be done into the method of hook by returning nothing

File diff suppressed because it is too large Load Diff

View File

@ -105,6 +105,10 @@ class FormAdmin
} }
$out.= '</select>'; $out.= '</select>';
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname);
return $out; return $out;
} }

View File

@ -210,6 +210,7 @@ class FormCompany
* @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department * @param string $htmlname Id of department
* @return string String with HTML select * @return string String with HTML select
* @see select_country
*/ */
function select_state($selected='',$country_codeid=0, $htmlname='state_id') function select_state($selected='',$country_codeid=0, $htmlname='state_id')
{ {
@ -234,7 +235,7 @@ class FormCompany
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">'; if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat minwidth300" name="'.$htmlname.'">';
if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; if ($country_codeid) $out.= '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
@ -277,13 +278,17 @@ class FormCompany
} }
} }
if (! empty($htmlname)) $out.= '</select>'; if (! empty($htmlname)) $out.= '</select>';
if (! empty($htmlname) && $user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if (! empty($htmlname) && $user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
return $out; return $out;
} }
@ -418,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='')
{ {
@ -431,9 +437,10 @@ class FormCompany
* @param string $selected Preselected code of juridical type * @param string $selected Preselected code of juridical type
* @param int $country_codeid 0=list for all countries, otherwise list only country requested * @param int $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list * @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_juridicalstatus($selected='', $country_codeid=0, $filter='') function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code')
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$langs->load("dict"); $langs->load("dict");
@ -454,7 +461,7 @@ class FormCompany
if ($resql) if ($resql)
{ {
$out.= '<div id="particulier2" class="visible">'; $out.= '<div id="particulier2" class="visible">';
$out.= '<select class="flat" name="forme_juridique_code" id="legal_form">'; $out.= '<select class="flat minwidth200" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -488,7 +495,7 @@ class FormCompany
// Show break when we are in multi country mode // Show break when we are in multi country mode
if (empty($country_codeid) && $val['country_code']) if (empty($country_codeid) && $val['country_code'])
{ {
$out.= '<option value="0">----- '.$val['country']." -----</option>\n"; $out.= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n";
$country=$val['country']; $country=$val['country'];
} }
} }
@ -507,7 +514,12 @@ 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
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
$out.= '</div>'; $out.= '</div>';
} }
else else

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;
@ -684,7 +689,7 @@ class FormFile
$out=''; $out='';
$this->numoffiles=0; $this->numoffiles=0;
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir).'.pdf','/'), '\.meta$|\.png$'); $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$');
// For ajax treatment // For ajax treatment
$out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n"; $out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n";
@ -713,7 +718,7 @@ class FormFile
$mime=dol_mimetype($relativepath,'',0); $mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) $out.= ' target="_blank"'; if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
$out.= '>'; $out.= '>';
$out.= img_pdf($file["name"],2); $out.= img_mime($relativepath, $file["name"]);
$out.= '</a>'."\n"; $out.= '</a>'."\n";
$this->numoffiles++; $this->numoffiles++;

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;

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