Merge branch 'bug-1555' of github.com:marcosgdf/dolibarr into
marcosgdf-bug-1555 Conflicts: ChangeLog
This commit is contained in:
commit
ef99de4e84
@ -28,6 +28,7 @@ Fix: SQL injection.
|
|||||||
Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated
|
Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated
|
||||||
Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them
|
Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them
|
||||||
Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored
|
Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored
|
||||||
|
Fix: [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger
|
||||||
|
|
||||||
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
|
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
|
||||||
Fix: Hide title of event when agenda module disabled.
|
Fix: Hide title of event when agenda module disabled.
|
||||||
|
|||||||
@ -1053,7 +1053,6 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save a new position (field rang) for details lines.
|
* Save a new position (field rang) for details lines.
|
||||||
* You can choose to set position for lines with already a position or lines without any position defined.
|
* You can choose to set position for lines with already a position or lines without any position defined.
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -796,6 +796,59 @@ class Product extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an accountancy code for a product.
|
||||||
|
* Also calls PRODUCT_MODIFY trigger when modified
|
||||||
|
*
|
||||||
|
* @param string $type It can be 'buy' or 'sell'
|
||||||
|
* @param string $value Accountancy code
|
||||||
|
* @return int <0 KO >0 OK
|
||||||
|
*/
|
||||||
|
public function setAccountancyCode($type, $value)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if ($type == 'buy') {
|
||||||
|
$field = 'accountancy_code_buy';
|
||||||
|
} elseif ($type == 'sell') {
|
||||||
|
$field = 'accountancy_code_sell';
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ";
|
||||||
|
$sql.= "$field = '".$this->db->escape($value)."'";
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($resql) {
|
||||||
|
global $user, $langs, $conf;
|
||||||
|
|
||||||
|
// Call triggers
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('PRODUCT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
if ($result < 0) {
|
||||||
|
$this->errors=$interface->errors;
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
$this->$field = $value;
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load array this->multilangs
|
* Load array this->multilangs
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
|
||||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -122,20 +122,18 @@ if (empty($reshook))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setaccountancy_code_buy')
|
if ($action == 'setaccountancy_code_buy') {
|
||||||
{
|
|
||||||
$result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
|
$result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
|
||||||
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
||||||
else $object->accountancy_code_buy=GETPOST('accountancy_code_buy');
|
|
||||||
$action="";
|
$action="";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setaccountancy_code_sell')
|
if ($action == 'setaccountancy_code_sell')
|
||||||
{
|
{
|
||||||
$result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
|
$result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
|
||||||
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
|
||||||
else $object->accountancy_code_sell=GETPOST('accountancy_code_sell');
|
$action="";
|
||||||
$action="";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a product or service
|
// Add a product or service
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user