forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -191,12 +191,12 @@ if ($result > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
$records=$ldap->getAttribute($dn,$search);
|
||||
$records = $ldap->getAttribute($dn,$search);
|
||||
|
||||
//print_r($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
|
||||
@@ -605,7 +605,7 @@ if ($mode != 'marketplace')
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu)
|
||||
if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu))
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ if (empty($conf->global->MAIN_MODULE_API))
|
||||
exit;
|
||||
}
|
||||
|
||||
use \Luracast\Restler\Defaults;
|
||||
|
||||
$api = new DolibarrApi($db);
|
||||
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\Restler;
|
||||
use Luracast\Restler\RestException;
|
||||
use Luracast\Restler\Defaults;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||
|
||||
@@ -55,7 +55,6 @@ if (empty($conf->global->MAIN_MODULE_API))
|
||||
exit;
|
||||
}
|
||||
|
||||
use \Luracast\Restler\Defaults;
|
||||
|
||||
$api = new DolibarrApi($db);
|
||||
|
||||
|
||||
@@ -478,9 +478,20 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ORDER_SETDRAFT',$user);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->statut=self::STATUS_DRAFT;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -761,6 +761,8 @@ class FactureRec extends CommonInvoice
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
$prodids = array();
|
||||
$num_prods = 0;
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
|
||||
|
||||
@@ -170,12 +170,12 @@ if ($result > 0)
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info,1);
|
||||
$search = "(".$object->_load_ldap_dn($info,2).")";
|
||||
$records=$ldap->getAttribute($dn,$search);
|
||||
$records = $ldap->getAttribute($dn,$search);
|
||||
|
||||
//var_dump($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
|
||||
@@ -823,7 +823,7 @@ class Ldap
|
||||
*
|
||||
* @param string $dn DN entry key
|
||||
* @param string $filter Filter
|
||||
* @return int|false|array <0 or false if KO, array if OK
|
||||
* @return int|array <0 or false if KO, array if OK
|
||||
*/
|
||||
function getAttribute($dn,$filter)
|
||||
{
|
||||
@@ -848,7 +848,7 @@ class Ldap
|
||||
{
|
||||
$this->ldapErrorCode = -1;
|
||||
$this->ldapErrorText = "Couldn't find entry";
|
||||
return false; // Couldn't find entry...
|
||||
return 0; // Couldn't find entry...
|
||||
}
|
||||
|
||||
// Get values
|
||||
@@ -856,7 +856,7 @@ class Ldap
|
||||
{
|
||||
$this->ldapErrorCode = ldap_errno($this->connection);
|
||||
$this->ldapErrorText = ldap_error($this->connection);
|
||||
return false; // No matching attributes
|
||||
return 0; // No matching attributes
|
||||
}
|
||||
|
||||
// Return an array containing the attributes.
|
||||
|
||||
@@ -2778,7 +2778,7 @@ function dol_print_error($db='',$error='',$errors=null)
|
||||
if (empty($msg)) continue;
|
||||
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
|
||||
{
|
||||
$out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ;
|
||||
$out.="<b>".$langs->trans("Message").":</b> ".dol_escape_htmltag($msg)."<br>\n" ;
|
||||
}
|
||||
else // Mode CLI
|
||||
{
|
||||
|
||||
@@ -119,6 +119,7 @@ class InterfaceDemo extends DolibarrTriggers
|
||||
case 'ORDER_CANCEL':
|
||||
case 'ORDER_SENTBYMAIL':
|
||||
case 'ORDER_CLASSIFY_BILLED':
|
||||
case 'ORDER_SETDRAFT':
|
||||
case 'LINEORDER_INSERT':
|
||||
case 'LINEORDER_UPDATE':
|
||||
case 'LINEORDER_DELETE':
|
||||
@@ -258,6 +259,9 @@ class InterfaceDemo extends DolibarrTriggers
|
||||
case 'SHIPPING_MODIFY':
|
||||
case 'SHIPPING_VALIDATE':
|
||||
case 'SHIPPING_SENTBYMAIL':
|
||||
case 'SHIPPING_BILLED':
|
||||
case 'SHIPPING_CLOSED':
|
||||
case 'SHIPPING_REOPEN':
|
||||
case 'SHIPPING_DELETE':
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
break;
|
||||
|
||||
@@ -1801,6 +1801,10 @@ class Expedition extends CommonObject
|
||||
function setClosed()
|
||||
{
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
|
||||
@@ -1809,11 +1813,27 @@ class Expedition extends CommonObject
|
||||
{
|
||||
// TODO: Add option/checkbox to set order billed if 100% of order is shipped
|
||||
$this->statut=2;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SHIPPING_CLOSED',$user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1825,6 +1845,9 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
function set_billed()
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=2, billed=1'; // TODO Update only billed
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
@@ -1834,11 +1857,27 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$this->statut=2;
|
||||
$this->billed=1;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SHIPPING_BILLED',$user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1851,6 +1890,10 @@ class Expedition extends CommonObject
|
||||
function reOpen()
|
||||
{
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut=1';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
|
||||
@@ -1859,11 +1902,27 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$this->statut=1;
|
||||
$this->billed=0;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SHIPPING_REOPEN',$user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
} else {
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_print_error($this->db);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ if ($result > 0)
|
||||
//var_dump($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
|
||||
@@ -181,12 +181,12 @@ if ($result > 0)
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info,1);
|
||||
$search = "(".$object->_load_ldap_dn($info,2).")";
|
||||
$records=$ldap->getAttribute($dn,$search);
|
||||
$records = $ldap->getAttribute($dn,$search);
|
||||
|
||||
//print_r($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user