diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 0c9de556d7e..453b45f59b3 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -226,9 +226,13 @@ class Members extends DolibarrApi
// If there is no error, update() returns the number of affected rows
// so if the update is a no op, the return value is zero.
if($member->update(DolibarrApiAccess::$user) >= 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php
index 8e545e6d784..6e793d7229d 100644
--- a/htdocs/adherents/class/api_memberstypes.class.php
+++ b/htdocs/adherents/class/api_memberstypes.class.php
@@ -204,9 +204,13 @@ class MembersTypes extends DolibarrApi
// If there is no error, update() returns the number of affected rows
// so if the update is a no op, the return value is zero.
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index 2cdf7a59ff3..60a243e6d90 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -193,9 +193,13 @@ class Subscriptions extends DolibarrApi
}
if ($subscription->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index 5c85cddfaee..66ab13bc8fb 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -101,7 +101,7 @@ class DolibarrApi
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
unset($object->linkedObjects);
- unset($object->lines); // should be ->lines
+ unset($object->lignes); // we don't want lignes, we want only ->lines
unset($object->fields);
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 323b0430f26..530ecd1deeb 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -184,7 +184,7 @@ class BlockedLog
*/
public function setObjectData(&$object, $action, $amounts)
{
- global $user, $mysoc;
+ global $langs, $user, $mysoc;
// Generic fields
diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php
index edbc4fa68ce..ddf0495bcc1 100644
--- a/htdocs/categories/class/api_categories.class.php
+++ b/htdocs/categories/class/api_categories.class.php
@@ -217,10 +217,14 @@ class Categories extends DolibarrApi
$this->category->$field = $value;
}
- if($this->category->update(DolibarrApiAccess::$user))
+ if ($this->category->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get ($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index b8f5bddc4e3..70efeccead3 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -77,8 +77,6 @@ class AdvanceTargetingMailing extends CommonObject
2 => $langs->trans("StatusProspect2"),
3 => $langs->trans("StatusProspect3")
);
-
- return 1;
}
/**
diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
index f5f0e085ccd..c7f425f8f7a 100644
--- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
@@ -1,20 +1,19 @@
-*
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
/**
* \file comm/mailing/class/html.formadvtragetemaling.class.php
@@ -50,31 +49,31 @@ class FormAdvTargetEmailing extends Form
*/
function multiselectProspectionStatus($selected_array = array(), $htmlname = 'cust_prospect_status') {
global $conf, $langs;
- $options_array = array ();
+ $options_array = array();
$sql = "SELECT code, label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel";
$sql .= " WHERE active > 0";
$sql .= " ORDER BY sortorder";
- dol_syslog ( get_class ( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG );
- $resql = $this->db->query ( $sql );
+ dol_syslog ( get_class( $this ) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG );
+ $resql = $this->db->query( $sql );
if ($resql) {
- $num = $this->db->num_rows ( $resql );
+ $num = $this->db->num_rows( $resql );
$i = 0;
while ( $i < $num ) {
- $obj = $this->db->fetch_object ( $resql );
+ $obj = $this->db->fetch_object( $resql );
- $level = $langs->trans ( $obj->code );
+ $level = $langs->trans( $obj->code );
if ($level == $obj->code)
- $level = $langs->trans ( $obj->label );
- $options_array [$obj->code] = $level;
+ $level = $langs->trans( $obj->label );
+ $options_array[$obj->code] = $level;
$i ++;
}
} else {
- dol_print_error ( $this->db );
+ dol_print_error($this->db);
}
- return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
+ return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
}
/**
@@ -211,11 +210,12 @@ class FormAdvTargetEmailing extends Form
*
* @return string HTML combo
*/
- function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array()) {
-
- if (is_array ( $sqlqueryparam )) {
- $options_array=array();
+ function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(), $selected_array = array())
+ {
+ $options_array=array();
+ if (is_array($sqlqueryparam))
+ {
$param_list = array_keys ( $sqlqueryparam );
$InfoFieldList = explode ( ":", $param_list [0] );
@@ -251,8 +251,6 @@ class FormAdvTargetEmailing extends Form
}
// $sql.= ' WHERE entity = '.$conf->entity;
- $options_array = array();
-
dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index 36a5c9a780d..adf1140e004 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -149,6 +149,7 @@ class Proposals extends DolibarrApi
{
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
+ $i = 0;
while ($i < $min)
{
$obj = $db->fetch_object($result);
@@ -272,7 +273,7 @@ class Proposals extends DolibarrApi
$request_data->product_type,
$request_data->rang,
$request_data->special_code,
- $fk_parent_line,
+ $request_data->fk_parent_line,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
@@ -374,25 +375,25 @@ class Proposals extends DolibarrApi
* @throws 404
*/
function deleteLine($id, $lineid) {
- if(! DolibarrApiAccess::$user->rights->propal->creer) {
+ if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
- }
+ }
- $result = $this->propal->fetch($id);
- if( ! $result ) {
- throw new RestException(404, 'Proposal not found');
- }
+ $result = $this->propal->fetch($id);
+ if( ! $result ) {
+ throw new RestException(404, 'Proposal not found');
+ }
- if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
- throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
- }
+ if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
+ throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
+ }
- $request_data = (object) $request_data;
- $updateRes = $this->propal->deleteline($lineid);
- if ($updateRes > 0) {
- return $this->get($id);
- }
- return false;
+ $updateRes = $this->propal->deleteline($lineid);
+ if ($updateRes > 0) {
+ return $this->get($id);
+ }
+
+ return false;
}
/**
@@ -421,10 +422,14 @@ class Proposals extends DolibarrApi
$this->propal->$field = $value;
}
- if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
+ if ($this->propal->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 6ae8d6b5648..d9a5f7fdfd2 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1455,6 +1455,93 @@ class Propal extends CommonObject
}
}
+ /**
+ * Update database
+ *
+ * @param User $user User that modify
+ * @param int $notrigger 0=launch triggers after, 1=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ function update(User $user, $notrigger=0)
+ {
+ $error=0;
+
+ // Clean parameters
+ if (isset($this->ref)) $this->ref=trim($this->ref);
+ if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client);
+ if (isset($this->note) || isset($this->note_private)) $this->note_private=(isset($this->note_private) ? trim($this->note_private) : trim($this->note));
+ if (isset($this->note_public)) $this->note_public=trim($this->note_public);
+ if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
+ if (isset($this->import_key)) $this->import_key=trim($this->import_key);
+
+ // Check parameters
+ // Put here code to add control on parameters values
+
+ // Update request
+ $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
+
+ $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
+ $sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").",";
+ $sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
+ $sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
+ $sql.= " datep=".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null').",";
+ $sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
+ $sql.= " tva=".(isset($this->total_tva)?$this->total_tva:"null").",";
+ $sql.= " localtax1=".(isset($this->total_localtax1)?$this->total_localtax1:"null").",";
+ $sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").",";
+ $sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
+ $sql.= " total=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
+ $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
+ $sql.= " fk_user_author=".(isset($this->user_author_id)?$this->user_author_id:"null").",";
+ $sql.= " fk_user_valid=".(isset($this->user_valid)?$this->user_valid:"null").",";
+ $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
+ $sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
+ $sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
+ $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
+ $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
+ $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";
+ $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
+
+ $sql.= " WHERE rowid=".$this->id;
+
+ $this->db->begin();
+
+ dol_syslog(get_class($this)."::update", LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if (! $resql) {
+ $error++; $this->errors[]="Error ".$this->db->lasterror();
+ }
+
+ if (! $error)
+ {
+ if (! $notrigger)
+ {
+ // Call trigger
+ $result=$this->call_trigger('PROPAL_MODIFY', $user);
+ if ($result < 0) $error++;
+ // End call triggers
+ }
+ }
+
+ // Commit or rollback
+ if ($error)
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+ else
+ {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+
/**
* Load array lines
*
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 7070ea71b49..91ef86670aa 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -413,16 +413,20 @@ class Orders extends DolibarrApi
$this->commande->$field = $value;
}
- // Update availability
- if (!empty($this->commande->availability_id)) {
- if ($this->commande->availability($this->commande->availability_id) < 0)
- throw new RestException(400, 'Error while updating availability');
- }
+ // Update availability
+ if (!empty($this->commande->availability_id)) {
+ if ($this->commande->availability($this->commande->availability_id) < 0)
+ throw new RestException(400, 'Error while updating availability');
+ }
- if ($this->commande->update(DolibarrApiAccess::$user, 1, '', '', 'update'))
+ if ($this->commande->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index f1fdb31cf69..0da039a1a88 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -191,9 +191,13 @@ class BankAccounts extends DolibarrApi
}
if ($account->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php
index 441deb729f0..04f17985f4d 100644
--- a/htdocs/contrat/class/api_contracts.class.php
+++ b/htdocs/contrat/class/api_contracts.class.php
@@ -483,10 +483,14 @@ class Contracts extends DolibarrApi
$this->contract->$field = $value;
}
- if($this->contract->update(DolibarrApiAccess::$user, 0))
+ if ($this->contract->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f1bef8c9271..37aaf0fc13b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -391,7 +391,7 @@ abstract class CommonObject
/**
* Return full name (civility+' '+name+' '+lastname)
*
- * @param Translate $langs Language object for translation of civility
+ * @param Translate $langs Language object for translation of civility (used only if option is 1)
* @param int $option 0=No option, 1=Add civility
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @param int $maxlen Maximum length
diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php
index e89f4e35cdc..07250466fc0 100644
--- a/htdocs/expensereport/class/api_expensereports.class.php
+++ b/htdocs/expensereport/class/api_expensereports.class.php
@@ -378,7 +378,6 @@ class ExpenseReports extends DolibarrApi
*
* @return int
*/
- /*
function put($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
throw new RestException(401);
@@ -397,12 +396,15 @@ class ExpenseReports extends DolibarrApi
$this->expensereport->$field = $value;
}
- if($this->expensereport->update(DolibarrApiAccess::$user))
+ if ($this->expensereport->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
- */
/**
* Delete Expense Report
@@ -480,6 +482,24 @@ class ExpenseReports extends DolibarrApi
);
}*/
+ /**
+ * Clean sensible object datas
+ *
+ * @param object $object Object to clean
+ * @return array Array of cleaned object properties
+ */
+ function _cleanObjectDatas($object) {
+
+ $object = parent::_cleanObjectDatas($object);
+
+ unset($object->barcode_type);
+ unset($object->barcode_type_code);
+ unset($object->barcode_type_label);
+ unset($object->barcode_type_coder);
+
+ return $object;
+ }
+
/**
* Validate fields before create or update object
*
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index b203275fe2c..796be33104f 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -38,7 +38,7 @@ class ExpenseReport extends CommonObject
var $fk_element = 'fk_expensereport';
var $picto = 'trip';
- var $lignes=array();
+ var $lines=array();
public $date_debut;
@@ -1934,7 +1934,7 @@ class ExpenseReport extends CommonObject
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
- // calcul de tous les totaux de la ligne
+ // calcul total of line
//$total_ttc = price2num($qty*$value_unit, 'MT');
$tx_tva = $vatrate / 100;
@@ -2565,7 +2565,7 @@ class ExpenseReportLine
$this->db->begin();
- // Mise a jour ligne en base
+ // Update line in database
$sql = "UPDATE ".MAIN_DB_PREFIX."expensereport_det SET";
$sql.= " comments='".$this->db->escape($this->comments)."'";
$sql.= ",value_unit=".$this->value_unit;
diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php
index f6364eb0544..a8928a044a8 100644
--- a/htdocs/projet/class/api_projects.class.php
+++ b/htdocs/projet/class/api_projects.class.php
@@ -435,7 +435,7 @@ class Projects extends DolibarrApi
$this->project->$field = $value;
}
- if($this->project->update(DolibarrApiAccess::$user, 0) > 0)
+ if($this->project->update(DolibarrApiAccess::$user) >= 0)
{
return $this->get($id);
}
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index fc006706d81..d5215ef8106 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -440,7 +440,7 @@ class Tasks extends DolibarrApi
$this->task->$field = $value;
}
- if($this->task->update(DolibarrApiAccess::$user, 0) > 0)
+ if ($this->task->update(DolibarrApiAccess::$user) > 0)
{
return $this->get($id);
}
diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php
index f2190326847..0145fd5eead 100644
--- a/htdocs/user/class/api_users.class.php
+++ b/htdocs/user/class/api_users.class.php
@@ -216,10 +216,14 @@ class Users extends DolibarrApi
$this->useraccount->$field = $value;
}
- if ($this->useraccount->update(DolibarrApiAccess::$user, 1))
+ if ($this->useraccount->update(DolibarrApiAccess::$user) > 0)
+ {
return $this->get($id);
-
- return false;
+ }
+ else
+ {
+ throw new RestException(500, $this->task->error);
+ }
}
/**
diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php
index aaba882cc87..1d0e4fbf616 100644
--- a/test/phpunit/CommandeTest.php
+++ b/test/phpunit/CommandeTest.php
@@ -165,13 +165,38 @@ class CommandeTest extends PHPUnit_Framework_TestCase
return $localobject;
}
+ /**
+ * testCommandeUpdate
+ *
+ * @param Object $localobject Commande
+ * @return Commande
+ *
+ * @depends testCommandeFetch
+ * The depends says test is run only if previous is ok
+ */
+ public function testCommandUpdate($localobject)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject->note_private='New note private after update';
+ $result=$localobject->update($user);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." id=".$id." result=".$result."\n";
+ return $localobject;
+ }
+
/**
* testCommandeValid
*
* @param Object $localobject Order
- * @return void
+ * @return Commande
*
- * @depends testCommandeFetch
+ * @depends testCommandUpdate
* The depends says test is run only if previous is ok
*/
public function testCommandeValid($localobject)
@@ -193,7 +218,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
* testCommandeCancel
*
* @param Object $localobject Order
- * @return void
+ * @return Commande
*
* @depends testCommandeValid
* The depends says test is run only if previous is ok
@@ -217,7 +242,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
* testCommandeOther
*
* @param Object $localobject Order
- * @return void
+ * @return int Order id
*
* @depends testCommandeCancel
* The depends says test is run only if previous is ok
diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php
index 52d6509d6f6..3d45673074a 100644
--- a/test/phpunit/PropalTest.php
+++ b/test/phpunit/PropalTest.php
@@ -142,7 +142,7 @@ class PropalTest extends PHPUnit_Framework_TestCase
* testPropalFetch
*
* @param int $id Id of object
- * @return void
+ * @return Propal
*
* @depends testPropalCreate
* The depends says test is run only if previous is ok
@@ -164,14 +164,39 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
- * testPropalAddLine
+ * testPropalUpdate
*
- * @param int $localobject Proposal
- * @return void
+ * @param Propal $localobject Proposal
+ * @return Propal
*
* @depends testPropalFetch
* The depends says test is run only if previous is ok
*/
+ public function testPropalUpdate($localobject)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject->note_private='New note private after update';
+ $result=$localobject->update($user);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." id=".$id." result=".$result."\n";
+ return $localobject;
+ }
+
+ /**
+ * testPropalAddLine
+ *
+ * @param Propal $localobject Proposal
+ * @return Propal
+ *
+ * @depends testPropalUpdate
+ * The depends says test is run only if previous is ok
+ */
public function testPropalAddLine($localobject)
{
global $conf,$user,$langs,$db;
@@ -191,8 +216,8 @@ class PropalTest extends PHPUnit_Framework_TestCase
/**
* testPropalValid
*
- * @param Proposal $localobject Proposal
- * @return Proposal
+ * @param Propal $localobject Proposal
+ * @return Propal
*
* @depends testPropalAddLine
* The depends says test is run only if previous is ok
@@ -215,7 +240,7 @@ class PropalTest extends PHPUnit_Framework_TestCase
/**
* testPropalOther
*
- * @param Proposal $localobject Proposal
+ * @param Propal $localobject Proposal
* @return int
*
* @depends testPropalValid