Merge pull request #2639 from aternatik/stable_resource
New : mark resource module as stable
This commit is contained in:
commit
e1403b136c
@ -3350,25 +3350,26 @@ abstract class CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
|
||||||
$sql.= " WHERE rowid =".$rowid;
|
$sql.= " WHERE rowid=".$rowid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
$resql=$this->db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
|
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
|
||||||
if ($result < 0) { $this->db->rollback(); return -1; }
|
if ($result < 0) { $this->db->rollback(); return -1; }
|
||||||
}
|
}
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -218,9 +218,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
|||||||
|
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)),
|
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled) || ! empty($conf->resource->enabled)),
|
||||||
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)),
|
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read) || ! empty($user->rights->resource->read)),
|
||||||
'module'=>'mailing|export|import|opensurvey');
|
'module'=>'mailing|export|import|opensurvey|resource');
|
||||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||||
if ($showmode)
|
if ($showmode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class modResource extends DolibarrModules
|
|||||||
// (where XXX is value of numeric property 'numero' of module)
|
// (where XXX is value of numeric property 'numero' of module)
|
||||||
$this->description = "Manage resources (printers, cars, room, ...) you can then share into events";
|
$this->description = "Manage resources (printers, cars, room, ...) you can then share into events";
|
||||||
// Possible values for version are: 'development', 'experimental' or version
|
// Possible values for version are: 'development', 'experimental' or version
|
||||||
$this->version = 'development';
|
$this->version = 'dolibarr';
|
||||||
// Key used in llx_const table to save module status enabled/disabled
|
// Key used in llx_const table to save module status enabled/disabled
|
||||||
// (where MYMODULE is value of property name of module in uppercase)
|
// (where MYMODULE is value of property name of module in uppercase)
|
||||||
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||||
@ -114,8 +114,7 @@ class modResource extends DolibarrModules
|
|||||||
$this->requiredby = array('modPlace');
|
$this->requiredby = array('modPlace');
|
||||||
// Minimum version of PHP required by module
|
// Minimum version of PHP required by module
|
||||||
$this->phpmin = array(5, 3);
|
$this->phpmin = array(5, 3);
|
||||||
// Minimum version of Dolibarr required by module
|
|
||||||
$this->need_dolibarr_version = array(3, 5);
|
|
||||||
$this->langfiles = array("resource@resource"); // langfiles@resource
|
$this->langfiles = array("resource@resource"); // langfiles@resource
|
||||||
// Constants
|
// Constants
|
||||||
// List of particular constants to add when module is enabled
|
// List of particular constants to add when module is enabled
|
||||||
|
|||||||
@ -90,7 +90,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
|
|||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -70,6 +70,7 @@ $resource_type = GETPOST('resource_type','alpha');
|
|||||||
$busy = GETPOST('busy','int');
|
$busy = GETPOST('busy','int');
|
||||||
$mandatory = GETPOST('mandatory','int');
|
$mandatory = GETPOST('mandatory','int');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
$confirm = GETPOST('confirm','alpha');
|
||||||
|
|
||||||
if($action == 'add_element_resource' && ! $cancel)
|
if($action == 'add_element_resource' && ! $cancel)
|
||||||
{
|
{
|
||||||
@ -113,10 +114,10 @@ if ($action == 'update_linked_resource' && $user->rights->resource->write && !GE
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a resource linked to an element
|
// Delete a resource linked to an element
|
||||||
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes')
|
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && $confirm === 'yes')
|
||||||
{
|
{
|
||||||
$res = $object->fetch(GETPOST('id'));
|
$res = $object->fetch($id);
|
||||||
if($res)
|
if($res > 0)
|
||||||
{
|
{
|
||||||
$result = $object->delete_resource($lineid,$element);
|
$result = $object->delete_resource($lineid,$element);
|
||||||
|
|
||||||
@ -173,7 +174,7 @@ else
|
|||||||
// Confirmation suppression resource line
|
// Confirmation suppression resource line
|
||||||
if ($action == 'delete_resource')
|
if ($action == 'delete_resource')
|
||||||
{
|
{
|
||||||
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
|
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&id=".$id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user