diff --git a/ChangeLog b/ChangeLog
index 46126bc4951..12b56483a88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -197,14 +197,14 @@ Dolibarr better:
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service
-- Fix: amarok is a bugged theme making dolidroid failed. We swith to eldy automatically with dolidroid.
- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
+- Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid.
- Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php
-- Fix: withdrawal create error if in the same month are deleted previus withdrawals.
+- Fix: withdrawal create error if in the same month are deleted previous withdrawals.
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
-- Fix: [ bug #1804 ] SQL error when sending email without addresee
+- Fix: [ bug #1804 ] SQL error when sending email without address
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
- Fix: [ bug #1796 ] Unable to use numeration modules from an external module
@@ -212,18 +212,22 @@ Dolibarr better:
- Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount
- Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme
- Fix: Tracking number not visible on shipment pdf
-- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase
+- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL database
- Fix: [ bug #1819 ] SQL error when searching for an invoice payment
- Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
+- Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL
+- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object
+- Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php
+- Fix: [ bug #1830 ] Salaries payment only allows checking accounts
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
- Fix: bug 1588 : relative discount.
-- Fix: label of input method not tranlated.
-- Fix: box of customer and propsects were not correctly disabled.
+- Fix: label of input method not translated.
+- Fix: box of customer and prospects were not correctly disabled.
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
- Fix: Civility & birthdate wasn't save into adherent module.
-- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
+- Fix: webservice Thirdparty parameter lastname for individual creation is now lastname and not ref
- Fix: Chars - is no more allowed into value for code for extra fields.
- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
@@ -251,14 +255,14 @@ For users:
- Fix: Iban was used instead of Bic into SEPA file.
- Fix: Must unaccent strings into SEPA file.
- Fix: Extrafield feature select from table should try to translate multiple column when not needed
-- Fix: cents for indian ruppes are calle paisa and paise.
+- Fix: cents for indian ruppes are called paisa and paise.
- Fix: Invoices payments may be older than invoices.
- Fix: Withdrawal total amount is double
- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
- Fix: Web service categorie WDSL declaration is correct
- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined
- Fix: Category creation failed and no message output
-- Fix: Lanf for Payment Type
+- Fix: Lang for Payment Type
- Fix: PHPCheckstyle 1.5.5
***** ChangeLog for 3.6 compared to 3.5.* *****
@@ -280,12 +284,12 @@ For users:
- New: Improved Opensurvey module:
Added options to disable comments and disable public votes.
Limit dates use calendar popup.
- Description of survey use wysiwig editor.
+ Description of survey use wysiwyg editor.
More information shown on result tab.
Renamed "survey" into "poll" (better translation).
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
- New: The box "balance of bank accounts" show all opened accounts.
-- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public
+- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale representative into public
note of generated documents.
- New: Add warning if supplier payment is higher that due amount.
- New: Increase length of url into bookmark module.
@@ -298,7 +302,7 @@ For users:
- New: Add barcode fields into user database.
- New: Add manager name (ceo, director, president...) into main company information page.
- New: Add field url as product properties.
-- New: More options to create a credit note (can be filled autatically according to remain to pay).
+- New: More options to create a credit note (can be filled automatically according to remain to pay).
- New: Can define custom fields for categories.
- New: Prepare generation of SEPA files into module withdrawal.
- New: [ task #1164 ] Add "Ref. supplier" search box in supplier orders
@@ -315,7 +319,7 @@ For users:
- New: [ task #926 ] Add extrafield feature on order lines.
- New: [ task #927 ] Add extrafield feature on Proposal lines.
- New: [ task #928 ] Add extrafield feature on invoice lines.
-- New: Paypal/paybox email sent after backcall of a payment is now a formated and translated
+- New: Paypal/paybox email sent after backcall of a payment is now a formatted and translated
HTML content. For member subscription renewal, there is also a link to member.
- New: When a subscription is recorded with invoice and payment:
- the document (PDF) of invoice is also generated.
@@ -371,11 +375,11 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
So check that return value is 0 to keep default standard behaviour after hook, or 1 to disable
default standard behaviour.
- Properties "civilite_id" were renamed into "civility_id".
-- Remove add_photo_web() that is ot used anymore by core code.
+- Remove add_photo_web() that is not used anymore by core code.
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
-Fix: Paypal link were broken dur to SSL v3 closed.
+Fix: Paypal link were broken due to SSL v3 closed.
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
Fix: [ bug #1757 ] Sorting breaks product/service statistics
@@ -394,7 +398,7 @@ Fix: Bad days and month reported by function.
Fix: Bad margin calculation.
***** ChangeLog for 3.5.5 compared to 3.5.4 *****
-Fix: Holiday module was broken. Initializaion of amount of holidays failed.
+Fix: Holiday module was broken. Initialization of amount of holidays failed.
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
Fix: Fusion PDF button on unpaid invoice is no more displayed.
Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click).
@@ -429,7 +433,7 @@ Fix: When using option MAIN_MAIL_ALLOW_SENDMAIL_F, a mail was sent to sender.
Fix: Question about warehouse must not be done when module stock is disabled.
Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented
(missing test at some places).
-Fix: Renaming a project with uplaoded files failed.
+Fix: Renaming a project with uploaded files failed.
Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error.
Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin.
Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order.
@@ -450,7 +454,7 @@ Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and
Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler.
Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order.
Fix: [ bug #1454 ] Mention de bas de page erroné
-Fix: Do not display dictionnay for non activated module
+Fix: Do not display dictionary for non activated module
Fix: Link element from element project pages
Fix: [ bug #1509 ] Expedition admin free text & watermark submit error
Fix: [ bug #1349 ] AJAX contact selector does not work fine in Project card
diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index 4dd005fca85..e269bafae6c 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -94,7 +94,6 @@ if ($result)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
- $fiscalyearstatic->ref=$obj->rowid;
$fiscalyearstatic->id=$obj->rowid;
print '
';
// Zip / Town
@@ -609,7 +609,7 @@ else if ($id || $ref)
* @param Object $object Object we want to see categories it can be classified into
* @param int $typeid Type of category (0, 1, 2, 3)
* @param int $socid Id thirdparty
- * @param string $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
+ * @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
* @return int 0
*/
function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index efcee0d756d..1d51ea6f7fb 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -297,7 +297,6 @@ class Categorie extends CommonObject
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
$parameters=array();
- $action='update';
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
@@ -334,7 +333,7 @@ class Categorie extends CommonObject
* Delete a category from database
*
* @param User $user Object user that ask to delete
- * @return void
+ * @return int <0 KO >0 OK
*/
function delete($user)
{
@@ -689,7 +688,9 @@ class Categorie extends CommonObject
*/
function containsObject($type, $object_id)
{
- $field = ''; $classname = ''; $category_table = ''; $object_table = '';
+ $field = '';
+ $category_table = '';
+
if ($type == 'product') {
$field = 'product';
}
@@ -726,7 +727,7 @@ class Categorie extends CommonObject
/**
* Return childs of a category
*
- * @return void
+ * @return array|int <0 KO, array ok
*/
function get_filles()
{
@@ -1045,7 +1046,7 @@ class Categorie extends CommonObject
* Retourne les categories de premier niveau (qui ne sont pas filles)
*
* @param int $type Type of category
- * @return void
+ * @return array
*/
function get_main_categories($type=null)
{
@@ -1058,7 +1059,7 @@ class Categorie extends CommonObject
*
* @param string $sep Separator
* @param string $url Url
- * @return void
+ * @return array
*/
function print_all_ways($sep = " >> ", $url='')
{
@@ -1088,7 +1089,7 @@ class Categorie extends CommonObject
/**
* Retourne un tableau contenant la liste des categories meres
*
- * @return void
+ * @return int|array <0 KO, array OK
*/
function get_meres()
{
@@ -1123,7 +1124,7 @@ class Categorie extends CommonObject
* Retourne dans un tableau tous les chemins possibles pour arriver a la categorie
* en partant des categories principales, representes par des tableaux de categories
*
- * @return void
+ * @return array
*/
function get_all_ways()
{
@@ -1315,7 +1316,7 @@ class Categorie extends CommonObject
$originImage = $dir . $file['name'];
// Cree fichier en taille origine
- $result=dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
+ dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
if (file_exists($originImage))
{
@@ -1560,8 +1561,6 @@ class Categorie extends CommonObject
*/
function initAsSpecimen()
{
- global $user,$langs,$conf;
-
dol_syslog(get_class($this)."::initAsSpecimen");
// Initialise parametres
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index c54d7d889b2..36a44f4bdda 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -66,7 +66,9 @@ if ($id > 0)
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- if ($object->id) $result = $object->add_photo($upload_dir, $_FILES['userfile']);
+ if ($object->id) {
+ $object->add_photo($upload_dir, $_FILES['userfile']);
+ }
}
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 5cfe1dc7310..81b58727745 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -38,27 +38,67 @@ class ActionComm extends CommonObject
public $table_rowid = 'id';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ /**
+ * Id of the event
+ * @var int
+ */
var $id;
+ /**
+ * Id of the event. Use $id as possible
+ * @var int
+ */
+ public $ref;
+
var $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
var $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set)
var $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set)
var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
+
var $label;
+ /**
+ * @var string
+ * @deprecated Use $label
+ */
+ public $libelle;
+
var $datec; // Date creation record (datec)
var $datem; // Date modification record (tms)
- var $author; // Object user that create action //deprecated
- var $usermod; // Object user that modified action // deprecated
+
+ /**
+ * Object user that create action
+ * @var User
+ * @deprecated
+ */
+ var $author;
+
+ /**
+ * Object user that modified action
+ * @var User
+ * @deprecated
+ */
+ var $usermod;
var $authorid; // Id user that create action
var $usermodid; // Id user that modified action
var $datep; // Date action start (datep)
var $datef; // Date action end (datep2)
- var $durationp = -1; // -1=Unkown duration // deprecated
+
+ /**
+ * @var int -1=Unkown duration
+ * @deprecated
+ */
+ var $durationp = -1;
var $fulldayevent = 0; // 1=Event on full day
- var $punctual = 1; // Milestone // deprecated. Milestone is already event with end date = start date
+
+ /**
+ * Milestone
+ * @var int
+ * @deprecated Milestone is already event with end date = start date
+ */
+ var $punctual = 1;
var $percentage; // Percentage
var $location; // Location
@@ -69,14 +109,41 @@ class ActionComm extends CommonObject
var $userassigned = array(); // Array of user ids
var $userownerid; // Id of user owner
var $userdoneid; // Id of user done
- var $usertodo; // Object user of owner // deprecated
- var $userdone; // Object user that did action // deprecated
+
+ /**
+ * Object user of owner
+ * @var User
+ * @deprecated
+ */
+ var $usertodo;
+
+ /**
+ * Object user that did action
+ * @var User
+ * @deprecated
+ */
+ var $userdone;
var $socid;
var $contactid;
- var $societe; // Company linked to action (optional)
- var $contact; // Contact linked to action (optional)
- var $fk_project; // Id of project (optional)
+
+ /**
+ * Company linked to action (optional)
+ * @var Societe|null
+ */
+ var $societe;
+
+ /**
+ * Contact linked to action (optional)
+ * @var Contact|null
+ */
+ var $contact;
+
+ /**
+ * Id of project (optional)
+ * @var int
+ */
+ var $fk_project;
// Properties for links to other objects
var $fk_element; // Id of record
@@ -96,8 +163,6 @@ class ActionComm extends CommonObject
*/
function __construct($db)
{
- global $langs;
-
$this->db = $db;
$this->societe = new stdClass(); // deprecated
@@ -247,7 +312,6 @@ class ActionComm extends CommonObject
{
if (! is_array($val)) // For backward compatibility when val=id
{
- $tmpid=$val;
$val=array('id'=>$val);
}
@@ -345,12 +409,13 @@ class ActionComm extends CommonObject
$sql.= " c.id as type_id, c.code as type_code, c.libelle,";
$sql.= " s.nom as socname,";
$sql.= " u.firstname, u.lastname as lastname";
- $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
+ $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a ";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
- $sql.= " WHERE a.fk_action=c.id";
- if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id
- else $sql.= " AND a.id=".$id;
+ $sql.= " WHERE ";
+ if ($ref) $sql.= " a.id=".$ref; // No field ref, we use id
+ else $sql.= " a.id=".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -429,9 +494,7 @@ class ActionComm extends CommonObject
*/
function fetch_userassigned()
{
- global $langs;
-
- $sql.="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
+ $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency";
$sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources";
$sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id;
$resql2=$this->db->query($sql);
@@ -901,7 +964,7 @@ class ActionComm extends CommonObject
* @param int $overwritepicto 1=Overwrite picto
* @return string Chaine avec URL
*/
- function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='')
+ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0)
{
global $conf,$langs;
@@ -1164,7 +1227,7 @@ class ActionComm extends CommonObject
*/
function initAsSpecimen()
{
- global $user,$langs,$conf,$user;
+ global $user;
$now=dol_now();
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 77dfea739e1..56465d45fdb 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -99,10 +99,10 @@ class CActionComm
/**
* Return list of event types: array(id=>label) or array(code=>label)
*
- * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
+ * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude
- * @param string $onlyautoornot Group list by auto events or not
+ * @param int $onlyautoornot Group list by auto events or not
* @return mixed Array of all event types if OK, <0 if KO
*/
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php
index 2dd6ea2b125..da062176d13 100644
--- a/htdocs/comm/action/class/ical.class.php
+++ b/htdocs/comm/action/class/ical.class.php
@@ -261,7 +261,7 @@ class ICal
*/
function ical_rrule($value)
{
- $result=aray();
+ $result=array();
$rrule = explode(';',$value);
foreach ($rrule as $line)
{
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 5fa4995a623..ae646e5d2c3 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -1144,7 +1144,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event
- $color=-1; $cssclass=''; $colorindex=-1;
+ $color=-1; $colorindex=-1;
if (in_array($user->id, $keysofuserassigned))
{
$nummytasks++; $cssclass='family_mytasks';
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index b8c913df271..8fd26b52b7f 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -313,7 +313,7 @@ if ($resql)
$actionstatic->id=$obj->id;
$actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label;
- $actionstatic->libelle=$obj->label;
+ $actionstatic->label=$obj->label;
print $actionstatic->getNomUrl(1,28);
print '';
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 5813762aece..335fc491224 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -804,7 +804,7 @@ $db->close();
* @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type
- * @param string $var true or false for alternat style on tr/td
+ * @param bool $var true or false for alternat style on tr/td
* @return void
*/
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false)
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index ac9ff663539..20f627af7d5 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -937,7 +937,7 @@ if ($id > 0)
// Addresses list
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
{
- $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
+ show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
}
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 666ce7e355c..ea0494866a1 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -448,7 +448,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- print "
';
$companystatic->id=$objp->rowid;
$companystatic->name=$objp->name;
diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php
index 75f2399017b..ff129a557e8 100644
--- a/htdocs/comm/mailing/cibles.php
+++ b/htdocs/comm/mailing/cibles.php
@@ -118,8 +118,7 @@ if ($action == 'add')
if (GETPOST('clearlist'))
{
// Chargement de la classe
- $classname = "MailingTargets";
- $obj = new $classname($db);
+ $obj = new MailingTargets($db);
$obj->clear_target($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
@@ -135,8 +134,7 @@ if ($action == 'delete')
{
if (!empty($id))
{
- $classname = "MailingTargets";
- $obj = new $classname($db);
+ $obj = new MailingTargets($db);
$obj->update_nb($id);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index edc6d7bfd94..c01a7795286 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -292,15 +292,15 @@ class Propal extends CommonObject
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*
* @param string $desc Description de la ligne
- * @param double $pu_ht Prix unitaire
- * @param double $qty Quantite
- * @param double $txtva Taux de tva
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu_ht Prix unitaire
+ * @param float $qty Quantite
+ * @param float $txtva Taux de tva
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id du produit/service predefini
- * @param double $remise_percent Pourcentage de remise de la ligne
+ * @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC
- * @param double $pu_ttc Prix unitaire TTC
+ * @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits de type de lignes
* @param int $type Type of line (product, service)
* @param int $rang Position of line
@@ -316,7 +316,7 @@ class Propal extends CommonObject
*
* @see add_product
*/
- function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
+ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
{
global $mysoc;
@@ -473,14 +473,14 @@ class Propal extends CommonObject
* Update a proposal line
*
* @param int $rowid Id de la ligne
- * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
- * @param double $qty Quantity
- * @param double $remise_percent Remise effectuee sur le produit
- * @param double $txtva Taux de TVA
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu Prix unitaire (HT ou TTC selon price_base_type)
+ * @param float $qty Quantity
+ * @param float $remise_percent Remise effectuee sur le produit
+ * @param float $txtva Taux de TVA
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @param string $desc Description
- * @param double $price_base_type HT ou TTC
+ * @param string $price_base_type HT ou TTC
* @param int $info_bits Miscellaneous informations
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
@@ -494,9 +494,9 @@ class Propal extends CommonObject
* @param array $array_option extrafields array
* @return int 0 if OK, <0 if KO
*/
- function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0)
+ function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0)
{
- global $conf,$user,$langs, $mysoc;
+ global $mysoc;
dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@@ -1863,8 +1863,6 @@ class Propal extends CommonObject
*/
function set_draft($user)
{
- global $conf,$langs;
-
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id;
diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php
index dc8501c37ba..97256c840b1 100644
--- a/htdocs/comm/propal/class/propalestats.class.php
+++ b/htdocs/comm/propal/class/propalestats.class.php
@@ -193,8 +193,6 @@ class PropaleStats extends Stats
*/
function getAllByProduct($year)
{
- global $user;
-
$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";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index c28128e81c5..a3ef72bb6ca 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -144,7 +144,9 @@ if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit;
-$sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';
+if (! $sall) $sql = 'SELECT';
+else $sql = 'SELECT DISTINCT';
+$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,';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login';
diff --git a/htdocs/comm/prospect/class/prospect.class.php b/htdocs/comm/prospect/class/prospect.class.php
index 19e56fe2cff..59f284408b8 100644
--- a/htdocs/comm/prospect/class/prospect.class.php
+++ b/htdocs/comm/prospect/class/prospect.class.php
@@ -41,8 +41,6 @@ class Prospect extends Societe
*/
function __construct($db)
{
- global $config;
-
$this->db = $db;
return 0;
@@ -56,7 +54,7 @@ class Prospect extends Societe
*/
function load_state_board()
{
- global $conf, $user;
+ global $user;
$this->nb=array("customers" => 0,"prospects" => 0);
$clause = "WHERE";
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index b0475871458..a68e9d28c19 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -534,7 +534,7 @@ if ($socid > 0)
}
else
{
- print dol_print_error($db);
+ dol_print_error($db);
}
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index d5c6b3f7715..d166398b8fe 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -158,7 +158,6 @@ class Commande extends CommonOrder
}
$obj = new $classname();
- $numref = "";
$numref = $obj->getNextValue($soc,$this);
if ($numref != "")
@@ -1078,19 +1077,19 @@ class Commande extends CommonOrder
* Add an order line into database (linked to product/service or not)
*
* @param string $desc Description of line
- * @param double $pu_ht Unit price (without tax)
- * @param double $qty Quantite
- * @param double $txtva Taux de tva force, sinon -1
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu_ht Unit price (without tax)
+ * @param float $qty Quantite
+ * @param float $txtva Taux de tva force, sinon -1
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id du produit/service predefini
- * @param double $remise_percent Pourcentage de remise de la ligne
+ * @param float $remise_percent Pourcentage de remise de la ligne
* @param int $info_bits Bits de type de lignes
* @param int $fk_remise_except Id remise
* @param string $price_base_type HT or TTC
- * @param double $pu_ttc Prix unitaire TTC
- * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
- * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
+ * @param float $pu_ttc Prix unitaire TTC
+ * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
+ * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
@@ -1284,16 +1283,16 @@ class Commande extends CommonOrder
* $this->client must be loaded
*
* @param int $idproduct Product Id
- * @param double $qty Quantity
- * @param double $remise_percent Product discount relative
- * @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
- * @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
+ * @param float $qty Quantity
+ * @param float $remise_percent Product discount relative
+ * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
+ * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products
*/
- function add_product($idproduct, $qty, $remise_percent=0, $date_start='', $date_end='')
+ function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='')
{
global $conf, $mysoc;
@@ -1691,7 +1690,6 @@ class Commande extends CommonOrder
*/
function loadExpeditions($filtre_statut=-1)
{
- $num=0;
$this->expeditions = array();
$sql = 'SELECT cd.rowid, cd.fk_product,';
@@ -1960,7 +1958,7 @@ class Commande extends CommonOrder
* Set the order date
*
* @param User $user Object user making change
- * @param timestamp $date Date
+ * @param int $date Date
* @return int <0 if KO, >0 if OK
*/
function set_date($user, $date)
@@ -1994,7 +1992,7 @@ class Commande extends CommonOrder
* Set the planned delivery date
*
* @param User $user Objet utilisateur qui modifie
- * @param timestamp $date_livraison Date de livraison
+ * @param int $date_livraison Date de livraison
* @return int <0 si ko, >0 si ok
*/
function set_date_livraison($user, $date_livraison)
@@ -2323,16 +2321,16 @@ class Commande extends CommonOrder
*
* @param int $rowid Id of line to update
* @param string $desc Description de la ligne
- * @param double $pu Prix unitaire
- * @param double $qty Quantity
- * @param double $remise_percent Pourcentage de remise de la ligne
- * @param double $txtva Taux TVA
- * @param double $txlocaltax1 Local tax 1 rate
- * @param double $txlocaltax2 Local tax 2 rate
+ * @param float $pu Prix unitaire
+ * @param float $qty Quantity
+ * @param float $remise_percent Pourcentage de remise de la ligne
+ * @param float $txtva Taux TVA
+ * @param float $txlocaltax1 Local tax 1 rate
+ * @param float $txlocaltax2 Local tax 2 rate
* @param string $price_base_type HT or TTC
* @param int $info_bits Miscellaneous informations on line
- * @param timestamp $date_start Start date of the line
- * @param timestamp $date_end End date of the line
+ * @param int $date_start Start date of the line
+ * @param int $date_end End date of the line
* @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
@@ -2343,7 +2341,7 @@ class Commande extends CommonOrder
* @param array $array_option extrafields array
* @return int < 0 if KO, > 0 if OK
*/
- function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0)
+ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0)
{
global $conf, $mysoc;
@@ -2577,6 +2575,8 @@ class Commande extends CommonOrder
*/
function update_extrafields($user)
{
+ global $hookmanager, $conf;
+
$action='create';
// Actions on extra fields (by external module or standard code)
@@ -3187,7 +3187,7 @@ class Commande extends CommonOrder
*/
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
- global $conf,$user,$langs,$hookmanager;
+ global $conf,$langs;
$langs->load("orders");
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 8374547eaf1..c2fb7330628 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -506,7 +506,7 @@ if ($resql)
}
else
{
- print dol_print_error($db);
+ dol_print_error($db);
}
llxFooter();
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 99458e3aea0..e6a40e1b027 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -697,7 +697,7 @@ if (($action != 'create' && $action != 'add') || !$error)
}
else
{
- print dol_print_error($db);
+ dol_print_error($db);
}
}
diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 87b7d3e62c5..024e21510e1 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -432,7 +432,7 @@ if ($id > 0 || ! empty($ref))
print '
';
diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php
index 69a84831b90..e5d64eb0d9d 100644
--- a/htdocs/compta/dons/class/don.class.php
+++ b/htdocs/compta/dons/class/don.class.php
@@ -450,7 +450,7 @@ class Don extends CommonObject
function delete($rowid)
{
- $this->db-begin();
+ $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 1f54c0b6805..3c194a522d3 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2878,7 +2878,7 @@ if ($action == 'create')
} else {
if ($absolute_creditnote > 0) // If not, link will be added later
{
- if ($object->statut == 0 && $object->type != TYPE_CREDIT_NOTE && $object->type != TYPE_DEPOSIT)
+ if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
print ' (' . $addabsolutediscount . ') ';
else
print '. ';
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index cadce3db632..40ab9119998 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -591,8 +591,7 @@ class FactureRec extends Facture
parent::initAsSpecimen($option);
- $this->usenewprice = 1;
-
+ $this->usenewprice = 1;
}
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 50a68b2c66a..56dc4592632 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -61,6 +61,11 @@ class Facture extends CommonInvoice
//! Id client
var $socid;
//! Objet societe client (to load with fetch_client method)
+
+ /**
+ * Customer
+ * @var Societe
+ */
var $client;
var $author;
var $fk_user_author;
@@ -84,7 +89,10 @@ class Facture extends CommonInvoice
var $total_tva=0;
var $total_ttc=0;
var $revenuestamp;
- var $note; // deprecated
+ /**
+ * @deprecated
+ */
+ var $note;
var $note_private;
var $note_public;
//! 0=draft,
@@ -113,7 +121,10 @@ class Facture extends CommonInvoice
var $fk_account; // Id of bank account
var $fk_bank; // Field to store bank id to use when payment mode is withdraw
var $modelpdf;
- var $products=array(); // deprecated
+ /**
+ * @deprecated
+ */
+ var $products=array();
var $lines=array();
var $line;
var $extraparams=array();
@@ -2003,8 +2014,8 @@ class Facture extends CommonInvoice
* @param double $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id of predefined product/service
* @param double $remise_percent Percent of discount on line
- * @param timestamp $date_start Date start of service
- * @param timestamp $date_end Date end of service
+ * @param int $date_start Date start of service
+ * @param int $date_end Date end of service
* @param int $ventil Code of dispatching into accountancy
* @param int $info_bits Bits de type de lignes
* @param int $fk_remise_except Id discount used
@@ -2185,8 +2196,8 @@ class Facture extends CommonInvoice
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type) (> 0 even for credit note lines)
* @param double $qty Quantity
* @param double $remise_percent Pourcentage de remise de la ligne
- * @param date $date_start Date de debut de validite du service
- * @param date $date_end Date de fin de validite du service
+ * @param int $date_start Date de debut de validite du service
+ * @param int $date_end Date de fin de validite du service
* @param double $txtva VAT Rate
* @param double $txlocaltax1 Local tax 1 rate
* @param double $txlocaltax2 Local tax 2 rate
@@ -3059,7 +3070,7 @@ class Facture extends CommonInvoice
/**
* Supprime une demande de prelevement
*
- * @param Use $user utilisateur creant la demande
+ * @param User $user utilisateur creant la demande
* @param int $did id de la demande a supprimer
* @return int <0 if OK, >0 if KO
*/
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 13190ce6e10..ea945940492 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -326,7 +326,7 @@ if ($action == 'remove_file')
$langs->load("other");
$upload_dir = $diroutputpdf;
$file = $upload_dir . '/' . GETPOST('file');
- $ret=dol_delete_file($file,0,0,0,'');
+ $ret=dol_delete_file($file);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action='';
@@ -484,7 +484,8 @@ if ($resql)
$formmail = new FormMail($db);
print ' ';
- print_fiche_titre($langs->trans("SendRemind"),'','').' ';
+ print_fiche_titre($langs->trans("SendRemind"),'','');
+ print ' ';
$topicmail="MailTopicSendRemindUnpaidInvoices";
$modelmail="facture_relance";
diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php
index 1512d0d39ac..c14c117bfbe 100644
--- a/htdocs/compta/localtax/class/localtax.class.php
+++ b/htdocs/compta/localtax/class/localtax.class.php
@@ -249,10 +249,6 @@ class Localtax extends CommonObject
*/
function delete($user)
{
- global $conf, $langs;
-
- $error=0;
-
// Call trigger
$result=$this->call_trigger('LOCALTAX_DELETE',$user);
if ($result < 0) return -1;
@@ -270,7 +266,6 @@ class Localtax extends CommonObject
return -1;
}
-
return 1;
}
diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php
index 7c34cec1ed4..90d6cbe8599 100644
--- a/htdocs/compta/localtax/clients.php
+++ b/htdocs/compta/localtax/clients.php
@@ -104,7 +104,7 @@ $fsearch.=' ';
$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
$fsearch.=' ';
-$calc=MAIN_INFO_LOCALTAX_CALC.$local;
+$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{
diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php
index b1b4aad7722..612014ac741 100644
--- a/htdocs/compta/localtax/quadri_detail.php
+++ b/htdocs/compta/localtax/quadri_detail.php
@@ -124,7 +124,7 @@ $fsearch.=' ';
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
//$fsearch.=' ';
-$calc=MAIN_INFO_LOCALTAX_CALC.$local;
+$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index 7432a7d14fd..56a00a2f38b 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -317,7 +317,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
if ($(\'#fieldchqemetteur\').val() == \'\')
{
- var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag(MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val();
+ var emetteur = ('.$facture->type.' == 2) ? \''.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'\' : jQuery(\'#thirdpartylabel\').val();
$(\'#fieldchqemetteur\').val(emetteur);
}
}
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index fbf9512e438..4df88871cb9 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -355,7 +355,7 @@ if ($action == 'new')
print $form->select_date($filterdate,'fd',0,0,1,'',1,1);
print '';
print '
';
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index ddda11bb556..23b19c50a6e 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -42,6 +42,8 @@ class RemiseCheque extends CommonObject
//! Numero d'erreur Plage 1024-1279
var $errno;
+ public $statut;
+
/**
* Constructor
*
@@ -275,7 +277,7 @@ class RemiseCheque extends CommonObject
* Supprime la remise en base
*
* @param User $user Utilisateur qui effectue l'operation
- * @return void
+ * @return int
*/
function delete($user='')
{
@@ -293,25 +295,23 @@ class RemiseCheque extends CommonObject
{
$num = $this->db->affected_rows($resql);
- if ($num <> 1)
- {
- $this->errno = -2;
- dol_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)");
- }
+ if ($num <> 1) {
+ $this->errno = -2;
+ dol_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)");
+ }
- if ( $this->errno === 0)
- {
- $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
- $sql.= " SET fk_bordereau = 0";
- $sql.= " WHERE fk_bordereau = '".$this->id."'";
+ if ( $this->errno === 0) {
+ $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
+ $sql.= " SET fk_bordereau = 0";
+ $sql.= " WHERE fk_bordereau = '".$this->id."'";
- $resql = $this->db->query($sql);
- if (!$resql)
- {
- $this->errno = -1028;
- dol_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
- }
- }
+ $resql = $this->db->query($sql);
+ if (!$resql)
+ {
+ $this->errno = -1028;
+ dol_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
+ }
+ }
}
if ($this->errno === 0)
@@ -486,7 +486,7 @@ class RemiseCheque extends CommonObject
* Build document
*
* @param string $model Model name
- * @param Tranlsate $outputlangs Object langs
+ * @param Translate $outputlangs Object langs
* @return int <0 if KO, >0 if OK
*/
function generatePdf($model, $outputlangs)
@@ -703,7 +703,7 @@ class RemiseCheque extends CommonObject
* Set the creation date
*
* @param User $user Object user
- * @param timestamp $date Date creation
+ * @param int $date Date creation
* @return int <0 if KO, >0 if OK
*/
function set_date($user, $date)
@@ -737,7 +737,7 @@ class RemiseCheque extends CommonObject
* Set the number of bordereau
*
* @param User $user Object user
- * @param timestamp $number number of bordereau
+ * @param int $number number of bordereau
* @return int <0 if KO, >0 if OK
*/
function set_number($user, $number)
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index e3ec12af6b5..01b65c0dd47 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -576,7 +576,7 @@ class Paiement extends CommonObject
/**
* Updates the payment date
*
- * @param timestamp $date New date
+ * @param int $date New date
* @return int <0 if KO, 0 if OK
*/
function update_date($date)
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 22e0a078c23..b543cac104a 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -403,7 +403,7 @@ class BonPrelevement extends CommonObject
* Set withdrawal to credited status
*
* @param User $user id of user
- * @param timestamp $date date of action
+ * @param int $date date of action
* @return int >0 if OK, <0 if KO
*/
function set_infocredit($user, $date)
@@ -525,7 +525,7 @@ class BonPrelevement extends CommonObject
* Set withdrawal to transmited status
*
* @param User $user id of user
- * @param timestamp $date date of action
+ * @param int $date date of action
* @param string $method method of transmision to bank
* @return int >0 if OK, <0 if KO
*/
@@ -667,9 +667,9 @@ class BonPrelevement extends CommonObject
{
$obj = $this->db->fetch_object($resql);
- return $obj->nb;
-
$this->db->free($resql);
+
+ return $obj->nb;
}
else
{
@@ -1161,7 +1161,7 @@ class BonPrelevement extends CommonObject
/**
* Delete a notification
*
- * @param User $user notification user
+ * @param int $user notification user
* @param string $action notification action
* @return int >0 if OK, <0 if KO
*/
@@ -1186,7 +1186,7 @@ class BonPrelevement extends CommonObject
* Add a notification
*
* @param DoliDB $db database handler
- * @param User $user notification user
+ * @param int $user notification user
* @param string $action notification action
* @return int 0 if OK, <0 if KO
*/
@@ -1625,7 +1625,7 @@ class BonPrelevement extends CommonObject
* Note: The tag PmtInf is opened here but closed into caller
*
* @param string $configuration conf
- * @param date $ladate Date
+ * @param int $ladate Date
* @param int $nombre 0 or 1
* @param float $total Total
* @param string $CrLf End of line character
diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php
index 581fb3152af..2b71c5c8004 100644
--- a/htdocs/compta/prelevement/class/ligneprelevement.class.php
+++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php
@@ -61,7 +61,7 @@ class LignePrelevement
* Recupere l'objet prelevement
*
* @param int $rowid id de la facture a recuperer
- * @return void
+ * @return void|int
*/
function fetch($rowid)
{
diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php
index d0b467f294b..176a561378b 100644
--- a/htdocs/compta/prelevement/class/rejetprelevement.class.php
+++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php
@@ -71,7 +71,7 @@ class RejetPrelevement
* @param User $user User object
* @param int $id Id
* @param string $motif Motif
- * @param timestamp $date_rejet Date rejet
+ * @param int $date_rejet Date rejet
* @param int $bonid Bon id
* @param int $facturation Facturation
* @return void
@@ -272,7 +272,7 @@ class RejetPrelevement
/**
* Retrieve the list of invoices
*
- * @return void
+ * @return array
*/
private function getListInvoices()
{
@@ -318,7 +318,7 @@ class RejetPrelevement
* Retrieve withdrawal object
*
* @param int $rowid id of invoice to retrieve
- * @return void
+ * @return int
*/
function fetch($rowid)
{
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 8c522df75d4..09469329069 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -558,7 +558,6 @@ if ($conf->salaries->enabled)
$sql.= " WHERE p.entity = ".$conf->entity;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
-
$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$sql.= " ORDER BY u.firstname";
diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php
index 16ef809f713..49c3192fa7f 100644
--- a/htdocs/compta/salaries/card.php
+++ b/htdocs/compta/salaries/card.php
@@ -248,7 +248,7 @@ if ($action == 'create')
if (! empty($conf->banque->enabled))
{
print '
'.$langs->trans("Account").'
';
- $form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
+ $form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant
print '
';
}
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index af8eedb617c..96f55ce34ba 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -69,7 +69,7 @@ class ChargeSociales extends CommonObject
*
* @param int $id Id
* @param string $ref Ref
- * @return void
+ * @return int <0 KO >0 OK
*/
function fetch($id, $ref='')
{
@@ -99,13 +99,14 @@ class ChargeSociales extends CommonObject
$this->paye = $obj->paye;
$this->periode = $this->db->jdate($obj->periode);
+ $this->db->free($resql);
+
return 1;
}
else
{
return 0;
}
- $this->db->free($resql);
}
else
{
@@ -308,6 +309,7 @@ class ChargeSociales extends CommonObject
if ($this->db->num_rows($result))
{
$obj = $this->db->fetch_object($result);
+ $this->db->free($result);
return $obj->amount;
}
else
@@ -315,8 +317,6 @@ class ChargeSociales extends CommonObject
return 0;
}
- $this->db->free($result);
-
}
else
{
@@ -521,8 +521,6 @@ class ChargeSociales extends CommonObject
*/
function initAsSpecimen()
{
- global $user,$langs,$conf;
-
// Initialize parameters
$this->id=0;
$this->ref = 'SPECIMEN';
diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php
index f5d0065e7f3..4b399d65248 100644
--- a/htdocs/compta/tva/quadri.php
+++ b/htdocs/compta/tva/quadri.php
@@ -54,7 +54,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
* @param DoliDB $db Database handler
* @param int $y Year
* @param int $q Year quarter (1-4)
- * @return void
+ * @return array
*/
function tva_coll($db,$y,$q)
{
@@ -122,7 +122,7 @@ function tva_coll($db,$y,$q)
* @param DoliDB $db Database handler object
* @param int $y Year
* @param int $q Year quarter (1-4)
- * @return void
+ * @return array
*/
function tva_paye($db, $y,$q)
{
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index d21642912b2..94147a2904d 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -1003,8 +1003,6 @@ class Contact extends CommonObject
*/
function initAsSpecimen()
{
- global $user,$langs;
-
// Get first id of existing company and save it into $socid
$socid = 0;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1";
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index eb224e0748d..731ad1c6cc1 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -682,7 +682,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contr
// Close all lines
else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer)
{
- $result = $object->cloture($user);
+ $object->cloture($user);
}
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 3cd35db15b5..bb00a5d9838 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -236,7 +236,6 @@ class Contrat extends CommonObject
}
$obj = new $classname();
- $numref = "";
$numref = $obj->getNextValue($soc,$this);
if ( $numref != "")
@@ -1645,11 +1644,11 @@ class Contrat extends CommonObject
// Load $this->lines array
// $this->fetch_lines();
- $newstatut=1;
- foreach($this->lines as $key => $contractline)
- {
- // if ($contractline) // Loop on each service
- }
+// $newstatut=1;
+// foreach($this->lines as $key => $contractline)
+// {
+// // if ($contractline) // Loop on each service
+// }
return 1;
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b886a382b1e..d477265122d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -833,7 +833,7 @@ abstract class CommonObject
* Update a specific field into database
*
* @param string $field Field to update
- * @param mixte $value New value
+ * @param mixed $value New value
* @param string $table To force other table element or element line (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
@@ -2442,7 +2442,7 @@ abstract class CommonObject
* 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 void
+ * @return int
*/
function showLinkedObjectBlock()
{
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index 6dc726b084e..d6e23beac70 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -142,7 +142,7 @@ class DolEditor
*
* @param int $noprint 1=Return HTML string instead of printing it to output
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });"
- * @return void
+ * @return void|string
*/
function Create($noprint=0,$morejs='')
{
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 7453e36d350..947b205e5b0 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -590,7 +590,7 @@ class ExtraFields
* @param string $value Value to show (for date type it must be in timestamp format)
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
- * @return void
+ * @return string
*/
function showInputField($key,$value,$moreparam='',$keyprefix='')
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 53d04b8ab6a..9e417ec6b9a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2836,7 +2836,7 @@ class Form
* @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree.
- * @return void
+ * @return string
* @see select_categories
*/
function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0)
@@ -3615,7 +3615,7 @@ class Form
*
* @param string $selected preselected currency code
* @param string $htmlname name of HTML select list
- * @return void
+ * @return string
*/
function selectCurrency($selected='',$htmlname='currency_id')
{
@@ -3714,7 +3714,7 @@ class Form
* Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle.
* Sinon la TVA proposee par defaut=0. Fin de regle.
* @param bool $options_only Return options only (for ajax treatment)
- * @return void
+ * @return string
*/
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false)
{
@@ -4502,7 +4502,7 @@ class Form
* Return HTML code to output a photo
*
* @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
- * @param Object $object Object containing data to retrieve file name
+ * @param object $object Object containing data to retrieve file name
* @param int $width Width of photo
* @return string HTML code to output photo
*/
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index 413dc3d1544..d2014837373 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -699,7 +699,7 @@ class FormCompany
* @param string $fields Fields
* @param int $fieldsize Field size
* @param int $disableautocomplete 1 To disable autocomplete features
- * @return void
+ * @return string
*/
function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0)
{
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 5bb491adf89..88a5a7522fe 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -603,7 +603,7 @@ class FormOther
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field
- * @return void
+ * @return string
*/
function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
{
@@ -733,7 +733,7 @@ class FormOther
* @param string $selected Preselected value
* @param string $htmlname Nom de la zone select
* @param int $useempty Affiche valeur vide dans liste
- * @return void
+ * @return string
*/
function select_dayofweek($selected='',$htmlname='weekid',$useempty=0)
{
@@ -774,7 +774,7 @@ class FormOther
* @param string $selected Preselected value
* @param string $htmlname Nom de la zone select
* @param int $useempty Affiche valeur vide dans liste
- * @return void
+ * @return string
*/
function select_month($selected='',$htmlname='monthid',$useempty=0)
{
@@ -816,7 +816,7 @@ class FormOther
* @param int $offset Offset
* @param int $invert Invert
* @param string $option Option
- * @return void
+ * @return string
*/
function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='')
{
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index dc844ee3f02..ca0cbab3925 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -801,7 +801,7 @@ class Ldap
*
* @param string $dn DN entry key
* @param string $filter Filter
- * @return int <0 if KO, >0 if OK
+ * @return int|false|array <0 or false if KO, array if OK
*/
function getAttribute($dn,$filter)
{
diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php
index 512aa011d98..bc9f9081a49 100644
--- a/htdocs/core/class/vcard.class.php
+++ b/htdocs/core/class/vcard.class.php
@@ -306,7 +306,7 @@ class vCard
/**
* permet d'obtenir une vcard
*
- * @return void
+ * @return string
*/
function getVCard()
{
diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php
index f9f39a53f7d..b004621a0d2 100644
--- a/htdocs/core/lib/accounting.lib.php
+++ b/htdocs/core/lib/accounting.lib.php
@@ -26,10 +26,10 @@
/**
* Prepare array with list of admin tabs
*
- * @param Object $object Object instance we show card
+ * @param AccountingAccount $object Object instance we show card
* @return array Array of tabs to show
*/
-function admin_accounting_prepare_head($object=null)
+function admin_accounting_prepare_head(AccountingAccount $object=null)
{
global $langs, $conf;
@@ -65,10 +65,10 @@ function admin_accounting_prepare_head($object=null)
/**
* Prepare array with list of tabs
*
- * @param Object $object Accounting account
+ * @param AccountingAccount $object Accounting account
* @return array Array of tabs to show
*/
-function accounting_prepare_head($object)
+function accounting_prepare_head(AccountingAccount $object)
{
global $langs, $conf;
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 8bb98b6cdaa..925f11021fd 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -401,7 +401,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
* @param int $entity Entity to set
* @param int $revertonoff Revert on/off
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant
- * @return void
+ * @return string
*/
function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
{
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index db6b9d5b8aa..001c030305a 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -27,10 +27,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Account $object Object related to tabs
* @return array Array of tabs to show
*/
-function bank_prepare_head($object)
+function bank_prepare_head(Account $object)
{
global $langs, $conf, $user;
$h = 0;
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 9d3a236fb11..cfa5a945841 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -33,10 +33,10 @@
/**
* Return array of tabs to used on pages for third parties cards.
*
- * @param Object $object Object company shown
+ * @param Societe $object Object company shown
* @return array Array of tabs
*/
-function societe_prepare_head($object)
+function societe_prepare_head(Societe $object)
{
global $db, $langs, $conf, $user;
$h = 0;
@@ -546,7 +546,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Database handler
- * @param Object $object Third party object
+ * @param Societe $object Third party object
* @param string $backtopage Url to go once contact is created
* @return void
*/
@@ -769,7 +769,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Database handler
- * @param Object $object Third party object
+ * @param Societe $object Third party object
* @param string $backtopage Url to go once address is created
* @return void
*/
@@ -864,7 +864,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
- * @param Object $object Object third party or member
+ * @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
@@ -1029,7 +1029,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
- * @param Object $object Object third party or member
+ * @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @return mixed Return html part or void if noprint is 1
diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php
index 8d9ba9296a4..3eeca82c993 100644
--- a/htdocs/core/lib/contact.lib.php
+++ b/htdocs/core/lib/contact.lib.php
@@ -25,10 +25,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Contact $object Object related to tabs
* @return array Array of tabs to show
*/
-function contact_prepare_head($object)
+function contact_prepare_head(Contact $object)
{
global $langs, $conf, $user;
diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php
index 6fa99914229..a0cbcda28b4 100644
--- a/htdocs/core/lib/contract.lib.php
+++ b/htdocs/core/lib/contract.lib.php
@@ -25,10 +25,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Contrat $object Object related to tabs
* @return array Array of tabs to show
*/
-function contract_prepare_head($object)
+function contract_prepare_head(Contrat $object)
{
global $langs, $conf;
$h = 0;
diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php
index 2f14b0242d4..6aeaad4d628 100644
--- a/htdocs/core/lib/cron.lib.php
+++ b/htdocs/core/lib/cron.lib.php
@@ -50,10 +50,10 @@ function cronadmin_prepare_head()
/**
* Return array of tabs to used on a cron job
*
- * @param Object $object Object cron
+ * @param Cronjob $object Object cron
* @return array Array of tabs
*/
-function cron_prepare_head($object)
+function cron_prepare_head(Cronjob $object)
{
global $langs, $conf, $user;
$h = 0;
diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php
index 239f36721ee..7ca2aba9db2 100644
--- a/htdocs/core/lib/emailing.lib.php
+++ b/htdocs/core/lib/emailing.lib.php
@@ -24,10 +24,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Mailing $object Object related to tabs
* @return array Array of tabs to show
*/
-function emailing_prepare_head($object)
+function emailing_prepare_head(Mailing $object)
{
global $user, $langs, $conf;
diff --git a/htdocs/core/lib/fiscalyear.lib.php b/htdocs/core/lib/fiscalyear.lib.php
index 5d27760b41f..37266b51495 100644
--- a/htdocs/core/lib/fiscalyear.lib.php
+++ b/htdocs/core/lib/fiscalyear.lib.php
@@ -24,10 +24,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Fiscalyear $object Object related to tabs
* @return array Array of tabs to show
*/
-function fiscalyear_prepare_head($object)
+function fiscalyear_prepare_head(Fiscalyear $object)
{
global $langs, $conf;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 10acc6a8c10..6355a871e8e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -657,7 +657,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
* @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required.
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
- * @return void
+ * @return string
*/
function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0)
{
@@ -786,7 +786,7 @@ function dol_fiche_end($notab=0)
* Return tab footer of a card
*
* @param int $notab 0=Add tab footer, 1=no tab footer
- * @return void
+ * @return string
*/
function dol_get_fiche_end($notab=0)
{
@@ -2593,7 +2593,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar
* @param string $moreattrib Add more attributes on th ("" by defaut)
* @param string $sortfield Current field used to sort
* @param string $sortorder Current sort order
- * @return void
+ * @return string
*/
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="")
{
@@ -2698,7 +2698,7 @@ function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpat
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects
- * @return void
+ * @return string
*/
function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
{
@@ -3167,7 +3167,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
$sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'";
- $sql .= " AND t.taux = ".$tva." AND t.active = 1";
+ $sql .= " AND t.taux = ".((float) $tva)." AND t.active = 1";
dol_syslog("get_localtax", LOG_DEBUG);
$resql=$db->query($sql);
@@ -3239,11 +3239,11 @@ function get_localtax_by_third($local)
* Instead this function must be called when adding a line to get (array of localtax and type) and
* provide it to the function calcul_price_total.
*
- * @param float $vatrate VAT Rate
- * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
- * @param int $buyer Company object
- * @param int $seller Company object
- * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
+ * @param float $vatrate VAT Rate
+ * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
+ * @param Societe $buyer Company object
+ * @param Societe $seller Company object
+ * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
*/
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
{
@@ -3255,7 +3255,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'";
- $sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
+ $sql .= " AND t.taux = ".((float) $vatrate)." AND t.active = 1";
$resql=$db->query($sql);
if ($resql)
@@ -4699,7 +4699,7 @@ function picto_from_langcode($codelang)
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
- * @param Object|null $object Object object
+ * @param object|null $object Object object
* @param array $head Object head
* @param int $h New position to fill
* @param string $type Value for object where objectvalue can be
diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php
index 879478daf8d..19e9f08e94d 100644
--- a/htdocs/core/lib/member.lib.php
+++ b/htdocs/core/lib/member.lib.php
@@ -24,10 +24,10 @@
/**
* Return array head with list of tabs to view object informations
*
- * @param Object $object Member
+ * @param Adherent $object Member
* @return array head
*/
-function member_prepare_head($object)
+function member_prepare_head(Adherent $object)
{
global $langs, $conf, $user;
@@ -155,7 +155,7 @@ function member_admin_prepare_head()
/**
* Return array head with list of tabs to view object stats informations
*
- * @param Object $object Member or null
+ * @param Adherent $object Member or null
* @return array head
*/
function member_stats_prepare_head($object)
diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php
index 24e2e05693a..a6fae1c7b1f 100644
--- a/htdocs/core/lib/memory.lib.php
+++ b/htdocs/core/lib/memory.lib.php
@@ -169,7 +169,7 @@ function dol_getshmopaddress($memoryid)
/**
* Return list of contents of all memory area shared
*
- * @return int 0=Nothing is done, <0 if KO, >0 if OK
+ * @return array
*/
function dol_listshmop()
{
diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php
index 1e0f2f50139..de7e9a93518 100644
--- a/htdocs/core/lib/order.lib.php
+++ b/htdocs/core/lib/order.lib.php
@@ -28,10 +28,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Commande $object Object related to tabs
* @return array Array of tabs to show
*/
-function commande_prepare_head($object)
+function commande_prepare_head(Commande $object)
{
global $langs, $conf, $user;
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php
index 53f54d66f70..18608a55a04 100644
--- a/htdocs/core/lib/prelevement.lib.php
+++ b/htdocs/core/lib/prelevement.lib.php
@@ -28,10 +28,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param BonPrelevement $object Object related to tabs
* @return array Array of tabs to show
*/
-function prelevement_prepare_head($object)
+function prelevement_prepare_head(BonPrelevement $object)
{
global $langs, $conf, $user;
$langs->load("withdrawals");
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index aae464ad17d..9040b59c85e 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -31,10 +31,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param ChargeSociales $object Object related to tabs
* @return array Array of tabs to show
*/
-function tax_prepare_head($object)
+function tax_prepare_head(ChargeSociales $object)
{
global $langs, $conf;
diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php
index 45619b10d6f..33f977bcf34 100644
--- a/htdocs/core/lib/trip.lib.php
+++ b/htdocs/core/lib/trip.lib.php
@@ -24,10 +24,10 @@
/**
* Prepare array with list of tabs
*
- * @param Object $object Object related to tabs
+ * @param Deplacement $object Object related to tabs
* @return array Array of tabs to show
*/
-function trip_prepare_head($object)
+function trip_prepare_head(Deplacement $object)
{
global $langs, $conf;
diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php
index 4dd7d0a81ae..50d53f72c57 100644
--- a/htdocs/core/modules/modProductBatch.class.php
+++ b/htdocs/core/modules/modProductBatch.class.php
@@ -112,8 +112,16 @@ class modProductBatch extends DolibarrModules
*/
function init($options='')
{
+ global $db,$conf;
+
$sql = array();
-
+
+ if(! empty($conf->cashdesk->enabled)) {
+ if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
+ $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
+ }
+ }
+
return $this->_init($sql, $options);
}
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index aaa69ec7f42..723660f1d9c 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -273,7 +273,6 @@ class Cronjob extends CommonObject
*/
function fetch($id)
{
- global $langs;
$sql = "SELECT";
$sql.= " t.rowid,";
@@ -655,15 +654,14 @@ class Cronjob extends CommonObject
*/
function delete($user, $notrigger=0)
{
- global $conf, $langs;
$error=0;
$this->db->begin();
- if (! $error)
- {
- if (! $notrigger)
- {
+// if (! $error)
+// {
+// if (! $notrigger)
+// {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@@ -673,18 +671,18 @@ class Cronjob extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
- }
- }
+// }
+// }
- if (! $error)
- {
+// if (! $error)
+// {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
- }
+// }
// Commit or rollback
if ($error)
@@ -803,12 +801,10 @@ class Cronjob extends CommonObject
/**
* Load object information
*
- * @return void
+ * @return int
*/
function info()
{
- global $langs;
-
$sql = "SELECT";
$sql.= " f.rowid, f.datec, f.tms, f.fk_user_mod, f.fk_user_author";
$sql.= " FROM ".MAIN_DB_PREFIX."cronjob as f";
@@ -849,7 +845,6 @@ class Cronjob extends CommonObject
{
global $langs, $conf;
- $error=0;
$now=dol_now();
$langs->load('cron');
@@ -935,7 +930,6 @@ class Cronjob extends CommonObject
// Create Object for the call module
$object = new $this->objectname($this->db);
- $params_arr = array();
$params_arr = explode(", ",$this->params);
if (!is_array($params_arr))
{
@@ -978,7 +972,6 @@ class Cronjob extends CommonObject
return -1;
}
dol_syslog(get_class($this) . "::run_jobs " . $this->libname . "::" . $this->methodename."(" . $this->params . ");", LOG_DEBUG);
- $params_arr = array();
$params_arr = explode(", ", $this->params);
if (!is_array($params_arr))
{
@@ -1074,8 +1067,6 @@ class Cronjob extends CommonObject
*/
function reprogram_jobs($userlogin)
{
- global $langs, $conf;
-
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 5edd4c3ce11..63fe3d477e4 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -244,8 +244,6 @@ class EcmDirectory // extends CommonObject
*/
function changeNbOfFiles($sign)
{
- global $conf, $langs;
-
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
$sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1";
@@ -320,7 +318,7 @@ class EcmDirectory // extends CommonObject
* Delete object on database and/or on disk
*
* @param User $user User that delete
- * @param int $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented)
+ * @param string $mode 'all'=delete all, 'databaseonly'=only database entry, 'fileonly' (not implemented)
* @return int <0 if KO, >0 if OK
*/
function delete($user, $mode='all')
@@ -329,7 +327,6 @@ class EcmDirectory // extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0;
- $result=0;
if ($mode != 'databaseonly') $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3
diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php
index 58286371941..87b4af190ae 100644
--- a/htdocs/ecm/class/htmlecm.form.class.php
+++ b/htdocs/ecm/class/htmlecm.form.class.php
@@ -51,7 +51,7 @@ class FormEcm
* @param string $select_name Nom formulaire HTML
* @return string String with HTML select
*/
- function select_all_sections($selected='',$select_name='')
+ function select_all_sections($selected=0,$select_name='')
{
global $langs;
$langs->load("ecm");
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 0b02b3ddc29..414e9dccfe0 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1281,18 +1281,19 @@ class CommandeFournisseur extends CommonOrder
/**
* Save a receiving into the tracking table of receiving (commande_fournisseur_dispatch) and add product into stock warehouse.
*
- * @param User $user User object making change
- * @param int $product Id of product to dispatch
- * @param double $qty Qty to dispatch
- * @param int $entrepot Id of warehouse to add product
- * @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
- * @param string $comment Comment for stock movement
- * @param date $eatby eat-by date
- * @param date $sellby sell-by date
- * @param string $batch Lot number
+ * @param User $user User object making change
+ * @param int $product Id of product to dispatch
+ * @param double $qty Qty to dispatch
+ * @param int $entrepot Id of warehouse to add product
+ * @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
+ * @param string $comment Comment for stock movement
+ * @param date $eatby eat-by date
+ * @param date $sellby sell-by date
+ * @param string $batch Lot number
+ * @param int $fk_commandefourndet Id of supplier order line
* @return int <0 if KO, >0 if OK
*/
- function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='')
+ function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet='')
{
global $conf;
$error = 0;
@@ -1315,8 +1316,8 @@ class CommandeFournisseur extends CommonOrder
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch";
- $sql.= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, status, comment, eatby, sellby, batch) VALUES";
- $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."', ".$dispatchstatus.", '".$this->db->escape($comment)."', ";
+ $sql.= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, status, comment, eatby, sellby, batch) VALUES";
+ $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', ";
$sql.= ($eatby?"'".$this->db->idate($eatby)."'":"null").", ".($sellby?"'".$this->db->idate($sellby)."'":"null").", ".($batch?"'".$batch."'":"null");
$sql.= ")";
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 859ab318397..b60914cb7d1 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -81,9 +81,10 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
$qty = "qty_".$reg[1];
$ent = "entrepot_".$reg[1];
$pu = "pu_".$reg[1]; // This is unit price including discount
+ $fk_commandefourndet = "fk_commandefourndet_".$reg[1];
if (GETPOST($ent,'int') > 0)
{
- $result = $commande->dispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"));
+ $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'));
if ($result < 0)
{
setEventMessages($commande->error, $commande->errors, 'errors');
@@ -283,27 +284,28 @@ if ($id > 0 || ! empty($ref))
// Set $products_dispatched with qty dispatech for each product id
$products_dispatched = array();
- $sql = "SELECT cfd.fk_product, sum(cfd.qty) as qty";
+ $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
+ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
$sql.= " WHERE cfd.fk_commande = ".$commande->id;
- $sql.= " GROUP BY cfd.fk_product";
+ $sql.= " GROUP BY l.rowid, cfd.fk_product";
$resql = $db->query($sql);
if ($resql)
{
while ($row = $db->fetch_row($resql))
{
- $products_dispatched[$row[0]] = $row[1];
+ $products_dispatched[$row[0]] = $row[2];
}
$db->free($resql);
}
- $sql = "SELECT l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
- $sql.= " p.ref, p.label, p.tobatch";
+ $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
+ $sql.= " p.ref, p.label, p.tobatch";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
$sql.= " WHERE l.fk_commande = ".$commande->id;
- $sql.= " GROUP BY p.ref, p.label, p.tobatch, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
+ $sql.= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
$sql.= " ORDER BY p.ref, p.label";
$resql = $db->query($sql);
@@ -354,7 +356,7 @@ if ($id > 0 || ! empty($ref))
}
else
{
- $remaintodispatch=($objp->qty - (empty($products_dispatched[$objp->fk_product])?0:$products_dispatched[$objp->fk_product])); // Calculation of dispatched
+ $remaintodispatch=($objp->qty - ((int) $products_dispatched[$objp->rowid])); // Calculation of dispatched
if ($remaintodispatch < 0) $remaintodispatch=0;
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
@@ -409,7 +411,7 @@ if ($id > 0 || ! empty($ref))
print '
';
if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).'';
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index 0a9213a3d73..dc912be4286 100755
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -1160,3 +1160,5 @@ ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_b
-- this update change the old formated url on llx_bank_url
UPDATE llx_bank_url set url = REPLACE( url, 'fiche.php', 'card.php');
+-- Add id commandefourndet in llx_commande_fournisseur_dispatch to correct /fourn/commande/dispatch.php display when several times same product in supplier order
+ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN fk_commandefourndet INT(11) NOT NULL DEFAULT '0' AFTER fk_product;
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
index 0ad1b37b410..789ec3e7a9b 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql
@@ -24,6 +24,7 @@ create table llx_commande_fournisseur_dispatch
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_commande integer,
fk_product integer,
+ fk_commandefourndet integer,
qty float, -- qty
fk_entrepot integer,
fk_user integer,
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index dcef2941d94..20d12072b5e 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1515,6 +1515,7 @@ CashDeskBankAccountForCB= Default account to use to receive payments by credit c
CashDeskDoNotDecreaseStock=Disable stock decrease when a sell is done from Point of Sale (if "no", stock decrease is done for each sell done from POS, whatever is option set into module Stock).
CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease
StockDecreaseForPointOfSaleDisabled=Stock decrease from Point Of Sale disabled
+StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatible with batch management
CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sell from Point Of Sale. So a warehouse is required.
##### Bookmark #####
BookmarkSetup=Bookmark module setup
diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php
index 6e772b09c03..d874e539164 100644
--- a/htdocs/mailmanspip/class/mailmanspip.class.php
+++ b/htdocs/mailmanspip/class/mailmanspip.class.php
@@ -166,7 +166,7 @@ class MailmanSpip
/**
* Fonction qui donne les droits redacteurs dans spip
*
- * @param Object $object Object with data (->firstname, ->lastname, ->email and ->login)
+ * @param object $object Object with data (->firstname, ->lastname, ->email and ->login)
* @return int =0 if KO, >0 if OK
*/
function add_to_spip($object)
@@ -208,7 +208,7 @@ class MailmanSpip
/**
* Fonction qui enleve les droits redacteurs dans spip
*
- * @param Object $object Object with data (->login)
+ * @param object $object Object with data (->login)
* @return int =0 if KO, >0 if OK
*/
function del_to_spip($object)
@@ -247,7 +247,7 @@ class MailmanSpip
/**
* Fonction qui dit si cet utilisateur est un redacteur existant dans spip
*
- * @param Object $object Object with data (->login)
+ * @param object $object Object with data (->login)
* @return int 1=exists, 0=does not exists, -1=error
*/
function is_in_spip($object)
@@ -297,7 +297,7 @@ class MailmanSpip
/**
* Subscribe an email to all mailing-lists
*
- * @param Object $object Object with data (->email, ->pass, ->element, ->type)
+ * @param object $object Object with data (->email, ->pass, ->element, ->type)
* @param array $listes To force mailing-list (string separated with ,)
* @return int <0 if KO, >=0 if OK
*/
@@ -369,7 +369,7 @@ class MailmanSpip
* Unsubscribe an email from all mailing-lists
* Used when a user is resiliated
*
- * @param Object $object Object with data (->email, ->pass, ->element, ->type)
+ * @param object $object Object with data (->email, ->pass, ->element, ->type)
* @param array $listes To force mailing-list (string separated with ,)
* @return int <0 if KO, >=0 if OK
*/
diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php
index 06be3f501fb..68f58e41c34 100644
--- a/htdocs/societe/class/address.class.php
+++ b/htdocs/societe/class/address.class.php
@@ -47,6 +47,11 @@ class Address
var $fax;
var $note;
+ /**
+ * Adresses liees a la societe
+ * @var array
+ */
+ public $lines;
/**
* Constructor
@@ -391,7 +396,7 @@ class Address
*
* @param int $id id de la societe a supprimer
* @param int $socid id third party
- * @return void
+ * @return <0 KO >0 OK
*/
function delete($id,$socid)
{
@@ -403,10 +408,11 @@ class Address
$result = $this->db->query($sql);
- if (!$result)
- {
- print $this->db->error() . ' ' . $sql;
+ if (!$result) {
+ return -1;
}
+
+ return 1;
}
/**
diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php
index 587e50385a6..f089a86aeb6 100644
--- a/htdocs/webservices/server_order.php
+++ b/htdocs/webservices/server_order.php
@@ -690,7 +690,7 @@ function createOrder($authentication,$order)
$newobject->statut=0; // We start with status draft
$newobject->billed=$order['billed'];
$newobject->fk_project=$order['project_id'];
- $newObject->fk_delivery_address=$order['fk_delivery_address'];
+ $newobject->fk_delivery_address=$order['fk_delivery_address'];
$newobject->cond_reglement_id=$order['cond_reglement_id'];
$newobject->demand_reason_id=$order['demand_reason_id'];
$newobject->date_creation=$now;
diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php
index 911b258536c..08eb76b834b 100644
--- a/htdocs/webservices/server_productorservice.php
+++ b/htdocs/webservices/server_productorservice.php
@@ -488,6 +488,12 @@ function createProductOrService($authentication,$product)
$error++; $errorcode='KO'; $errorlabel="You must choose between price or price_net to provide price.";
}
+ if ($product['barcode'] && !$product['barcode_type'])
+ {
+ $errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode.";
+ }
+
+
if (! $error)
{
@@ -509,6 +515,12 @@ function createProductOrService($authentication,$product)
$newobject->price_base_type=$product['price_base_type'];
$newobject->date_creation=$now;
+ if ($product['barcode'])
+ {
+ $newobject->barcode = $product['barcode'];
+ $newobject->barcode_type = $product['barcode_type'];
+ }
+
$newobject->stock_reel=$product['stock_real'];
$newobject->pmp=$product['pmp'];
$newobject->seuil_stock_alert=$product['stock_alert'];
@@ -606,6 +618,11 @@ function updateProductOrService($authentication,$product)
}
+ if ($product['barcode'] && !$product['barcode_type'])
+ {
+ $errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode.";
+ }
+
if (! $error)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@@ -628,6 +645,12 @@ function updateProductOrService($authentication,$product)
$newobject->price_base_type=$product['price_base_type'];
$newobject->date_creation=$now;
+ if ($product['barcode'])
+ {
+ $newobject->barcode = $product['barcode'];
+ $newobject->barcode_type = $product['barcode_type'];
+ }
+
$newobject->stock_reel=$product['stock_real'];
$newobject->pmp=$product['pmp'];
$newobject->seuil_stock_alert=$product['stock_alert'];