mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 10:08:27 +01:00
Fix: works on repair broken features
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
* \file htdocs/comm/propal.php
|
||||
* \ingroup propale
|
||||
* \brief Page of commercial proposals card and list
|
||||
* \version $Id: propal.php,v 1.618 2011/08/10 18:05:49 hregis Exp $
|
||||
* \version $Id: propal.php,v 1.619 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@@ -101,7 +101,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->createFromClone($id,0,GETPOST('socid'));
|
||||
$result=$object->createFromClone($id,0,GETPOST('socid'),$hookmanager);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
@@ -1926,6 +1926,6 @@ else
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/10 18:05:49 $ - $Revision: 1.618 $');
|
||||
llxFooter('$Date: 2011/08/10 19:55:22 $ - $Revision: 1.619 $');
|
||||
|
||||
?>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* \author Rodolphe Qiedeville
|
||||
* \author Eric Seigne
|
||||
* \author Laurent Destailleur
|
||||
* \version $Id: propal.class.php,v 1.111 2011/08/08 01:53:26 eldy Exp $
|
||||
* \version $Id: propal.class.php,v 1.112 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||
@@ -826,7 +826,7 @@ class Propal extends CommonObject
|
||||
* @param socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid,$invertdetail=0,$socid=0)
|
||||
function createFromClone($fromid,$invertdetail=0,$socid=0,$hookmanager=false)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
@@ -836,12 +836,6 @@ class Propal extends CommonObject
|
||||
|
||||
$object=new Propal($this->db);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$object->callHooks('propalcard');
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@@ -906,23 +900,11 @@ class Propal extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Hook for external modules
|
||||
if (! empty($object->hooks))
|
||||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reshook=$hookmanager->executeHooks('createfrom','',$objFrom,$result,$object->element); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* \file htdocs/commande/class/commande.class.php
|
||||
* \ingroup commande
|
||||
* \brief Fichier des classes de commandes
|
||||
* \version $Id: commande.class.php,v 1.121 2011/08/08 01:10:07 eldy Exp $
|
||||
* \version $Id: commande.class.php,v 1.122 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
@@ -769,7 +769,7 @@ class Commande extends CommonObject
|
||||
* @param socid Id of thirdparty
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid,$invertdetail=0,$socid=0)
|
||||
function createFromClone($fromid,$invertdetail=0,$socid=0,$hookmanager=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -777,12 +777,6 @@ class Commande extends CommonObject
|
||||
|
||||
$object=new Commande($this->db);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$object->callHooks('ordercard');
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
@@ -829,22 +823,10 @@ class Commande extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
// Hook of thirdparty module
|
||||
if (! empty($object->hooks))
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reshook=$hookmanager->executeHooks('createfrom','',$objFrom,$result,$object->element); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
@@ -875,7 +857,7 @@ class Commande extends CommonObject
|
||||
* @param invertdetail Reverse sign of amounts for lines
|
||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||
*/
|
||||
function createFromProposal($object,$invertdetail=0)
|
||||
function createFromProposal($object,$invertdetail=0,$hookmanager=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -932,22 +914,10 @@ class Commande extends CommonObject
|
||||
if ($ret > 0)
|
||||
{
|
||||
// Hook of thirdparty module
|
||||
if (! empty($object->hooks))
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($object,$ret,$this->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reshook=$hookmanager->executeHooks('createfrom','',$object,$ret,$this->element); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* \file htdocs/commande/fiche.php
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
* \version $Id: fiche.php,v 1.531 2011/08/10 18:04:58 hregis Exp $
|
||||
* \version $Id: fiche.php,v 1.532 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@@ -85,7 +85,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->createFromClone($id, 0, GETPOST('socid'));
|
||||
$result=$object->createFromClone($id, 0, GETPOST('socid'), $hookmanager);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
@@ -2063,5 +2063,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/10 18:04:58 $ - $Revision: 1.531 $');
|
||||
llxFooter('$Date: 2011/08/10 19:55:22 $ - $Revision: 1.532 $');
|
||||
?>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* \file htdocs/compta/facture.php
|
||||
* \ingroup facture
|
||||
* \brief Page to create/see an invoice
|
||||
* \version $Id: facture.php,v 1.852 2011/08/10 18:04:41 hregis Exp $
|
||||
* \version $Id: facture.php,v 1.853 2011/08/10 19:55:21 hregis Exp $
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
@@ -95,7 +95,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->createFromClone($id);
|
||||
$result=$object->createFromClone($id,0,$hookmanager);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result);
|
||||
@@ -3178,5 +3178,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/10 18:04:41 $ - $Revision: 1.852 $');
|
||||
llxFooter('$Date: 2011/08/10 19:55:21 $ - $Revision: 1.853 $');
|
||||
?>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* \file htdocs/compta/facture/class/facture.class.php
|
||||
* \ingroup facture
|
||||
* \brief Fichier de la classe des factures clients
|
||||
* \version $Id: facture.class.php,v 1.124 2011/08/03 00:46:25 eldy Exp $
|
||||
* \version $Id: facture.class.php,v 1.125 2011/08/10 19:55:21 hregis Exp $
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||
@@ -518,7 +518,7 @@ class Facture extends CommonObject
|
||||
* @param invertdetail Reverse sign of amounts for lines
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid,$invertdetail=0)
|
||||
function createFromClone($fromid,$invertdetail=0,$hookmanager=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -532,12 +532,6 @@ class Facture extends CommonObject
|
||||
$object=new Facture($this->db);
|
||||
$object->fetch($fromid);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && ! empty($conf->hooks_modules))
|
||||
{
|
||||
$object->callHooks('invoicecard');
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$object->id=0;
|
||||
@@ -576,23 +570,11 @@ class Facture extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Hook for external modules
|
||||
if (! empty($object->hooks))
|
||||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reshook=$hookmanager->executeHooks('createfrom','',$objFrom,$result,$object->element); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
@@ -621,7 +603,7 @@ class Facture extends CommonObject
|
||||
* @param object Object source
|
||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||
*/
|
||||
function createFromOrder($object)
|
||||
function createFromOrder($object, $hookmanager=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -675,23 +657,11 @@ class Facture extends CommonObject
|
||||
|
||||
if ($ret > 0)
|
||||
{
|
||||
// Hook for external modules
|
||||
if (! empty($object->hooks))
|
||||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'createfrom'))
|
||||
{
|
||||
$result = $module->createfrom($objFrom,$result,$object->element);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$reshook=$hookmanager->executeHooks('createfrom','',$objFrom,$result,$object->element); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* \file htdocs/compta/facture/fiche-rec.php
|
||||
* \ingroup facture
|
||||
* \brief Page to show predefined invoice
|
||||
* \version $Id: fiche-rec.php,v 1.75 2011/07/31 22:23:13 eldy Exp $
|
||||
* \version $Id: fiche-rec.php,v 1.76 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
@@ -109,12 +109,6 @@ if ($_GET["action"] == 'create')
|
||||
$facture = new Facture($db); // Source invoice
|
||||
$product_static=new Product($db);
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$facture->callHooks('invoicecard');
|
||||
}
|
||||
|
||||
if ($facture->fetch($_GET["facid"]) > 0)
|
||||
{
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
@@ -575,5 +569,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 22:23:13 $ - $Revision: 1.75 $');
|
||||
llxFooter('$Date: 2011/08/10 19:55:22 $ - $Revision: 1.76 $');
|
||||
?>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* \file htdocs/contact/fiche.php
|
||||
* \ingroup societe
|
||||
* \brief Card of a contact
|
||||
* \version $Id: fiche.php,v 1.222 2011/07/31 23:54:12 eldy Exp $
|
||||
* \version $Id: fiche.php,v 1.223 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
@@ -67,43 +67,18 @@ else
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople'); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
}
|
||||
|
||||
// Instantiate hooks of thirdparty module
|
||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||
{
|
||||
$object->callHooks('contactcard');
|
||||
}
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($db);
|
||||
$hookmanager->callHooks(array('contactcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$reshook=0;
|
||||
$reshook=$hookmanager->executeHooks('doActions',$action,$object,$id); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Hook of actions. After that, reshook is 0 if we need to process standard actions, >0 otherwise.
|
||||
if (! empty($object->hooks))
|
||||
{
|
||||
foreach($object->hooks as $hook)
|
||||
{
|
||||
if (! empty($hook['modules']))
|
||||
{
|
||||
foreach($hook['modules'] as $module)
|
||||
{
|
||||
if (method_exists($module,'doActions'))
|
||||
{
|
||||
$resaction+=$module->doActions($object,$action,$id); // object is deprecated, action can be changed by method (to go back to other action for example), id can be changed/set by method (during creation for example)
|
||||
if ($resaction < 0 || ! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
|
||||
{
|
||||
$error=$module->error; $errors=$module->errors;
|
||||
if ($action=='add') $action='create';
|
||||
if ($action=='update') $action='edit';
|
||||
}
|
||||
else $reshook+=$resaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- start deprecated. Use hook to hook actions.
|
||||
// If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature.
|
||||
@@ -973,5 +948,5 @@ else
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 23:54:12 $ - $Revision: 1.222 $');
|
||||
llxFooter('$Date: 2011/08/10 19:55:22 $ - $Revision: 1.223 $');
|
||||
?>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* \file htdocs/core/class/html.formfile.class.php
|
||||
* \ingroup core
|
||||
* \brief File of class to offer components to list and upload files
|
||||
* \version $Id: html.formfile.class.php,v 1.52 2011/08/10 10:55:37 hregis Exp $
|
||||
* \version $Id: html.formfile.class.php,v 1.53 2011/08/10 19:55:22 hregis Exp $
|
||||
*/
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ class FormFile
|
||||
* @param title Title to show on top of form
|
||||
* @param buttonlabel Label on submit button
|
||||
* @param codelang Default language code to use on lang combo box if multilang is enabled
|
||||
* @param hooks Object hook of external modules
|
||||
* @param hookmanager Object hook of external modules
|
||||
* @return int <0 if KO, number of shown files if OK
|
||||
*/
|
||||
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$hookmanager=false)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* \file htdocs/includes/triggers/interface_modWorkflow_WorkflowManager.class.php
|
||||
* \ingroup core
|
||||
* \brief Trigger file for workflows
|
||||
* \version $Id: interface_modWorkflow_WorkflowManager.class.php,v 1.8 2011/07/31 23:29:45 eldy Exp $
|
||||
* \version $Id: interface_modWorkflow_WorkflowManager.class.php,v 1.9 2011/08/10 19:55:21 hregis Exp $
|
||||
*/
|
||||
|
||||
|
||||
@@ -105,7 +105,13 @@ class InterfaceWorkflowManager
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
|
||||
$order = new Commande($this->db);
|
||||
$ret=$order->createFromProposal($object,0);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->callHooks(array('ordercard'));
|
||||
|
||||
$ret=$order->createFromProposal($object,0,$hookmanager);
|
||||
if ($ret < 0) { $this->error=$invoice->error; $this->errors[]=$invoice->error; }
|
||||
return $ret;
|
||||
}
|
||||
@@ -119,7 +125,13 @@ class InterfaceWorkflowManager
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
|
||||
$invoice = new Facture($this->db);
|
||||
$ret=$invoice->createFromOrder($object,0);
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager->callHooks(array('invoicecard'));
|
||||
|
||||
$ret=$invoice->createFromOrder($object,$hookmanager);
|
||||
if ($ret < 0) { $this->error=$invoice->error; $this->errors[]=$invoice->error; }
|
||||
return $ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user