mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix: works on edit in place with external modules
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@@ -134,6 +134,14 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||
if (! $error)
|
||||
{
|
||||
if (! is_object($object)) $object = new GenericObject($db);
|
||||
|
||||
// Specific for add_object_linked()
|
||||
// TODO add a function for variable treatment
|
||||
$object->ext_fk_element = $newvalue;
|
||||
$object->ext_element = $ext_element;
|
||||
$object->fk_element = $fk_element;
|
||||
$object->element = $element;
|
||||
|
||||
$ret=$object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
|
||||
if ($ret > 0)
|
||||
{
|
||||
|
||||
@@ -1654,6 +1654,30 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all links between an object $this
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function deleteObjectLinked()
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
||||
$sql.= " WHERE fk_target = ".$this->id;
|
||||
$sql.= " AND targettype = '".$this->element."'";
|
||||
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked error=".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set statut of an object
|
||||
*
|
||||
@@ -2069,19 +2093,19 @@ abstract class CommonObject
|
||||
if ($objecttype == 'facture') {
|
||||
$tplpath = 'compta/'.$element;
|
||||
}
|
||||
if ($objecttype == 'propal') {
|
||||
else if ($objecttype == 'propal') {
|
||||
$tplpath = 'comm/'.$element;
|
||||
}
|
||||
if ($objecttype == 'shipping') {
|
||||
else if ($objecttype == 'shipping') {
|
||||
$tplpath = 'expedition';
|
||||
}
|
||||
if ($objecttype == 'delivery') {
|
||||
else if ($objecttype == 'delivery') {
|
||||
$tplpath = 'livraison';
|
||||
}
|
||||
if ($objecttype == 'invoice_supplier') {
|
||||
else if ($objecttype == 'invoice_supplier') {
|
||||
$tplpath = 'fourn/facture';
|
||||
}
|
||||
if ($objecttype == 'order_supplier') {
|
||||
else if ($objecttype == 'order_supplier') {
|
||||
$tplpath = 'fourn/commande';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user