Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop#2

This commit is contained in:
lmarcouiller 2021-10-12 13:10:59 +02:00
commit 0100cb4192
6 changed files with 17 additions and 15 deletions

View File

@ -3637,22 +3637,19 @@ abstract class CommonObject
$origin = 'order_supplier';
}
$targettype = $this->element;
$parameters = array('sourcetype'=>$sourcetype, 'sourceid'=>$sourceid, 'targettype'=>$targettype, 'targetid'=>$targetid);
// Hook for explicitly set the targettype if it must be differtent than $this->element
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
if (!empty($hookmanager->resArray['sourcetype'])) $sourcetype = $hookmanager->resArray['sourcetype'];
}
// Elements of the core modules which have `$module` property but may to which we don't want to prefix module part to the element name for finding the linked object in llx_element_element.
// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization');
// Add module part to target type if object has $module property and isn't in core modules.
$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
$parameters = array('targettype'=>$targettype);
// Hook for explicitly set the targettype if it must be differtent than $this->element
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
}
$this->db->begin();
$error = 0;

View File

@ -1232,7 +1232,7 @@ class FormTicket
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : '');
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
print '</td></tr>';

View File

@ -238,9 +238,10 @@ class ConferenceOrBooth extends ActionComm
* @param string $ref Ref
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param int $loadresources 1=Load also resources
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '')
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
{
global $dolibarr_main_url_root, $conf, $langs;

View File

@ -382,7 +382,9 @@ class Mos extends DolibarrApi
if (!$error && $value["fk_warehouse"] > 0) {
// Record stock movement
$id_product_batch = 0;
$stockmove->origin = $this->mo;
$stockmove->setOrigin($this->mo->element, $this->mo->id);
if ($qtytoprocess >= 0) {
$moline = new MoLine($this->db);
$moline->fk_mo = $this->mo->id;

View File

@ -211,7 +211,8 @@ if (empty($reshook)) {
if (!$error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) {
// Record stock movement
$id_product_batch = 0;
$stockmove->origin = $object;
$stockmove->setOrigin($object->element, $object->id);
if ($qtytoprocess >= 0) {
$idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement);
} else {

View File

@ -109,7 +109,7 @@ if ($action == 'cancel_record' && $permissiontoadd) {
if ($action == 'update' && !empty($user->rights->stock->mouvement->creer)) {
$stockmovment = new MouvementStock($db);
$stockmovment->origin = $object;
$stockmovment->setOrigin($object->element, $object->id);
$db->begin();
@ -117,6 +117,7 @@ if ($action == 'update' && !empty($user->rights->stock->mouvement->creer)) {
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);