Qual: More robust error code management when a box is renamed.
This commit is contained in:
parent
c0221f6950
commit
75312655f1
@ -294,56 +294,59 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dol_include_once($sourcefile);
|
dol_include_once($sourcefile);
|
||||||
$box=new $boxname($db,$obj->note);
|
if (class_exists($boxname))
|
||||||
|
|
||||||
$enabled=true;
|
|
||||||
if ($box->depends && count($box->depends) > 0)
|
|
||||||
{
|
{
|
||||||
foreach($box->depends as $module)
|
$box=new $boxname($db,$obj->note);
|
||||||
{
|
|
||||||
if (empty($conf->$module->enabled)) $enabled=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($enabled)
|
$enabled=true;
|
||||||
{
|
if ($box->depends && count($box->depends) > 0)
|
||||||
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
{
|
||||||
if (in_array($obj->rowid, $actives))
|
foreach($box->depends as $module)
|
||||||
{
|
{
|
||||||
// La boite est deja activee
|
if (empty($conf->$module->enabled)) $enabled=false;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if ($enabled)
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||||
}
|
if (in_array($obj->rowid, $actives))
|
||||||
else
|
{
|
||||||
{
|
// La boite est deja activee
|
||||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
{
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$logo = $box->boximg;
|
||||||
print '<tr '.$bc[$var].'>';
|
}
|
||||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
else
|
||||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
{
|
||||||
print '<td>' . $sourcefile . '</td>';
|
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||||
|
}
|
||||||
|
|
||||||
// Pour chaque position possible, on affiche un lien
|
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||||
// d'activation si boite non deja active pour cette position
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<td>';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print $form->selectarray("pos",$pos_name);
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||||
print '<input type="hidden" name="boxid" value="'.$obj->rowid.'">';
|
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||||
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
print '<td>' . $sourcefile . '</td>';
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '</tr></form>';
|
// Pour chaque position possible, on affiche un lien
|
||||||
}
|
// d'activation si boite non deja active pour cette position
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectarray("pos",$pos_name);
|
||||||
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="boxid" value="'.$obj->rowid.'">';
|
||||||
|
print ' <input type="submit" class="button" name="button" value="'.$langs->trans("Activate").'">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr></form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -409,36 +412,39 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dol_include_once($sourcefile);
|
dol_include_once($sourcefile);
|
||||||
$box=new $boxname($db,$obj->note);
|
if (class_exists($boxname))
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
$box=new $boxname($db,$obj->note);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
|
||||||
}
|
|
||||||
|
|
||||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
print '<tr '.$bc[$var].'>';
|
{
|
||||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
$logo = $box->boximg;
|
||||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
}
|
||||||
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
else
|
||||||
$hasnext=true;
|
{
|
||||||
$hasprevious=true;
|
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||||
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
}
|
||||||
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
|
||||||
print '<td align="center">'.$box_order.'</td>';
|
|
||||||
print '<td align="center">';
|
|
||||||
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
|
||||||
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="center">';
|
|
||||||
print '<a href="boxes.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '</tr>'."\n";
|
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||||
|
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||||
|
print '<td align="center">' . $pos_name[$obj->position] . '</td>';
|
||||||
|
$hasnext=true;
|
||||||
|
$hasprevious=true;
|
||||||
|
if ($foundrupture) { $hasprevious=false; $foundrupture=0; }
|
||||||
|
if (! $objnext || $obj->position != $objnext->position) { $hasnext=false; $foundrupture=1; }
|
||||||
|
print '<td align="center">'.$box_order.'</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print ($hasnext?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objnext->rowid.'">'.img_down().'</a> ':'');
|
||||||
|
print ($hasprevious?'<a href="boxes.php?action=switch&switchfrom='.$obj->rowid.'&switchto='.$objprevious->rowid.'">'.img_up().'</a>':'');
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<a href="boxes.php?rowid='.$obj->rowid.'&action=delete">'.img_delete().'</a>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>'."\n";
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$box_order++;
|
$box_order++;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ function printBoxesArea($user,$areacode)
|
|||||||
// Define $box_max_lines
|
// Define $box_max_lines
|
||||||
$box_max_lines=5;
|
$box_max_lines=5;
|
||||||
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
|
if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES;
|
||||||
|
|
||||||
$ii=0;
|
$ii=0;
|
||||||
foreach ($boxarray as $key => $box)
|
foreach ($boxarray as $key => $box)
|
||||||
{
|
{
|
||||||
@ -214,24 +214,27 @@ class InfoBox
|
|||||||
$sourcefile = DOL_DOCUMENT_ROOT."/core/boxes/".$boxname.".php";
|
$sourcefile = DOL_DOCUMENT_ROOT."/core/boxes/".$boxname.".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once($sourcefile);
|
dol_include_once($sourcefile);
|
||||||
$box=new $boxname($this->db,$obj->note);
|
if (class_exists($boxname))
|
||||||
|
|
||||||
$box->rowid=$obj->rowid;
|
|
||||||
$box->box_id=$obj->box_id;
|
|
||||||
$box->position=$obj->position;
|
|
||||||
$box->box_order=$obj->box_order;
|
|
||||||
$box->fk_user=$obj->fk_user;
|
|
||||||
$enabled=true;
|
|
||||||
if ($box->depends && count($box->depends) > 0)
|
|
||||||
{
|
{
|
||||||
foreach($box->depends as $module)
|
$box=new $boxname($this->db,$obj->note);
|
||||||
{
|
|
||||||
//print $module.'<br>';
|
$box->rowid=$obj->rowid;
|
||||||
if (empty($conf->$module->enabled)) $enabled=false;
|
$box->box_id=$obj->box_id;
|
||||||
}
|
$box->position=$obj->position;
|
||||||
|
$box->box_order=$obj->box_order;
|
||||||
|
$box->fk_user=$obj->fk_user;
|
||||||
|
$enabled=true;
|
||||||
|
if ($box->depends && count($box->depends) > 0)
|
||||||
|
{
|
||||||
|
foreach($box->depends as $module)
|
||||||
|
{
|
||||||
|
//print $module.'<br>';
|
||||||
|
if (empty($conf->$module->enabled)) $enabled=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($enabled) $boxes[]=$box;
|
||||||
}
|
}
|
||||||
if ($enabled) $boxes[]=$box;
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,28 +280,31 @@ class InfoBox
|
|||||||
}
|
}
|
||||||
|
|
||||||
dol_include_once($sourcefile);
|
dol_include_once($sourcefile);
|
||||||
$box=new $boxname($this->db,$obj->note);
|
if (class_exists($boxname))
|
||||||
|
{
|
||||||
|
$box=new $boxname($this->db,$obj->note);
|
||||||
|
|
||||||
$box->rowid=$obj->rowid;
|
$box->rowid=$obj->rowid;
|
||||||
$box->box_id=$obj->box_id;
|
$box->box_id=$obj->box_id;
|
||||||
$box->position=$obj->position;
|
$box->position=$obj->position;
|
||||||
$box->box_order=$obj->box_order;
|
$box->box_order=$obj->box_order;
|
||||||
if (is_numeric($box->box_order))
|
if (is_numeric($box->box_order))
|
||||||
{
|
{
|
||||||
if ($box->box_order % 2 == 1) $box->box_order='A'.$box->box_order;
|
if ($box->box_order % 2 == 1) $box->box_order='A'.$box->box_order;
|
||||||
elseif ($box->box_order % 2 == 0) $box->box_order='B'.$box->box_order;
|
elseif ($box->box_order % 2 == 0) $box->box_order='B'.$box->box_order;
|
||||||
|
}
|
||||||
|
$box->fk_user=$obj->fk_user;
|
||||||
|
$enabled=true;
|
||||||
|
if ($box->depends && count($box->depends) > 0)
|
||||||
|
{
|
||||||
|
foreach($box->depends as $module)
|
||||||
|
{
|
||||||
|
//print $boxname.'-'.$module.'<br>';
|
||||||
|
if (empty($conf->$module->enabled)) $enabled=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($enabled) $boxes[]=$box;
|
||||||
}
|
}
|
||||||
$box->fk_user=$obj->fk_user;
|
|
||||||
$enabled=true;
|
|
||||||
if ($box->depends && count($box->depends) > 0)
|
|
||||||
{
|
|
||||||
foreach($box->depends as $module)
|
|
||||||
{
|
|
||||||
//print $boxname.'-'.$module.'<br>';
|
|
||||||
if (empty($conf->$module->enabled)) $enabled=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($enabled) $boxes[]=$box;
|
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +334,7 @@ class InfoBox
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||||
|
|
||||||
dol_syslog("InfoBoxes::saveboxorder zone=".$zone." user=".$userid);
|
dol_syslog("InfoBoxes::saveboxorder zone=".$zone." user=".$userid);
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/boxes/box_services_vendus.php
|
* \file htdocs/core/boxes/box_services_contracts.php
|
||||||
* \ingroup produits,services
|
* \ingroup produits,services
|
||||||
* \brief Module de generation de l'affichage de la box services_vendus
|
* \brief Module de generation de l'affichage de la box services_vendus
|
||||||
*/
|
*/
|
||||||
@ -29,7 +29,7 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
|||||||
/**
|
/**
|
||||||
* Class to manage the box to show last services lines
|
* Class to manage the box to show last services lines
|
||||||
*/
|
*/
|
||||||
class box_services_vendus extends ModeleBoxes
|
class box_services_contracts extends ModeleBoxes
|
||||||
{
|
{
|
||||||
|
|
||||||
var $boxcode="lastproductsincontract";
|
var $boxcode="lastproductsincontract";
|
||||||
@ -46,7 +46,7 @@ include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function box_services_vendus()
|
function box_services_contracts()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("boxes");
|
$langs->load("boxes");
|
||||||
@ -77,7 +77,7 @@ class modService extends DolibarrModules
|
|||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array();
|
$this->boxes = array();
|
||||||
$this->boxes[0][1] = "box_services_vendus.php";
|
$this->boxes[0][1] = "box_services_contracts.php";
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user