Fix: action must always be provided as value can be change during actions
This commit is contained in:
parent
1c4ca9b335
commit
5e32fc70ad
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$contact = $GLOBALS['objcanvas']->control->object;
|
$contact = $GLOBALS['objcanvas']->control->object;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->
|
<!-- BEGIN PHP TEMPLATE CONTACTCARD_VIEW.TPL.PHP DEFAULT -->
|
||||||
@ -98,7 +97,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
|
|||||||
<td><?php echo $this->control->tpl['email']; ?></td>
|
<td><?php echo $this->control->tpl['email']; ?></td>
|
||||||
<?php if ($this->control->tpl['nb_emailing']) { ?>
|
<?php if ($this->control->tpl['nb_emailing']) { ?>
|
||||||
<td nowrap><?php echo $langs->trans("NbOfEMailingsReceived"); ?></td>
|
<td nowrap><?php echo $langs->trans("NbOfEMailingsReceived"); ?></td>
|
||||||
<td><a href="<?php echo DOL_URL_ROOT.'/comm/mailing/liste.php?filteremail='.urlencode($this->control->tpl['email']); ?>"><?php echo $this->control->tpl['nb_emailing']; ?></a></td>
|
<td><?php echo $this->control->tpl['nb_emailing']; ?></td>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<td colspan="2"> </td>
|
<td colspan="2"> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@ -249,10 +249,12 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->old_name='';
|
$object->old_name='';
|
||||||
$object->old_firstname='';
|
$object->old_firstname='';
|
||||||
|
$action = 'view';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error=$object->error; $errors=$object->errors;
|
$error=$object->error; $errors=$object->errors;
|
||||||
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,7 +279,7 @@ if ($socid > 0)
|
|||||||
$objsoc->fetch($socid);
|
$objsoc->fetch($socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
{
|
{
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
// When used with CANVAS
|
// When used with CANVAS
|
||||||
@ -288,7 +290,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
|
|||||||
$object->fetch($id); // For use with "pure canvas" (canvas that contains templates only)
|
$object->fetch($id); // For use with "pure canvas" (canvas that contains templates only)
|
||||||
}
|
}
|
||||||
$objcanvas->assign_values($action, $id); // Set value for templates
|
$objcanvas->assign_values($action, $id); // Set value for templates
|
||||||
$objcanvas->display_canvas(); // Show template
|
$objcanvas->display_canvas($action); // Show template
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -50,9 +50,9 @@ class Canvas
|
|||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $DB Database handler
|
||||||
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
|
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
|
||||||
*/
|
*/
|
||||||
function __construct($DB, $actiontype='view')
|
function __construct($db, $actiontype='view')
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->actiontype = $actiontype;
|
$this->actiontype = $actiontype;
|
||||||
if ($this->actiontype == 'add') $this->actiontype='create';
|
if ($this->actiontype == 'add') $this->actiontype='create';
|
||||||
@ -128,11 +128,11 @@ class Canvas
|
|||||||
*
|
*
|
||||||
* @return int 0=Canvas template file does not exist, 1=Canvas template file exists
|
* @return int 0=Canvas template file does not exist, 1=Canvas template file exists
|
||||||
*/
|
*/
|
||||||
function displayCanvasExists()
|
function displayCanvasExists($action)
|
||||||
{
|
{
|
||||||
if (empty($this->template_dir)) return 0;
|
if (empty($this->template_dir)) return 0;
|
||||||
//print $this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php';
|
|
||||||
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php')) return 1;
|
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,12 +142,12 @@ class Canvas
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function display_canvas()
|
function display_canvas($action)
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs, $user, $canvas;
|
global $db, $conf, $langs, $user, $canvas;
|
||||||
global $form, $formfile;
|
global $form, $formfile;
|
||||||
|
|
||||||
include($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php'); // Include native PHP template
|
include($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php'); // Include native PHP template
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -661,7 +661,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
|||||||
$object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only)
|
$object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only)
|
||||||
}
|
}
|
||||||
$objcanvas->assign_values($action, $id, $ref); // Set value for templates
|
$objcanvas->assign_values($action, $id, $ref); // Set value for templates
|
||||||
$objcanvas->display_canvas(); // Show template
|
$objcanvas->display_canvas($action); // Show template
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -468,7 +468,7 @@ $formcompany = new FormCompany($db);
|
|||||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||||
|
|
||||||
|
|
||||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
{
|
{
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
// When used with CANVAS
|
// When used with CANVAS
|
||||||
@ -479,7 +479,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
|
|||||||
$object->fetch($socid); // For use with "pure canvas" (canvas that contains templates only)
|
$object->fetch($socid); // For use with "pure canvas" (canvas that contains templates only)
|
||||||
}
|
}
|
||||||
$objcanvas->assign_values($action, $socid); // Set value for templates
|
$objcanvas->assign_values($action, $socid); // Set value for templates
|
||||||
$objcanvas->display_canvas(); // Show template
|
$objcanvas->display_canvas($action); // Show template
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user