';
print '
';
@@ -329,91 +279,77 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
- print '
'."\n";
- $parameters=array();
- $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ print '
'."\n";
+ if ($user->rights->assets->delete)
+ {
+ print '
id.'&action=delete">'.$langs->trans('Delete').''."\n";
+ }
+ else
+ {
+ print '
'.$langs->trans('Delete').''."\n";
+ }
+ }
+ print '
'."\n";
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
- $action = 'presend';
+ $action = 'presend';
}
if ($action != 'presend')
{
- print '
';
- print '
'; // ancre
+ print '
';
+ print '
'; // ancre
- // Documents
- /*$objref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $comref . '.pdf';
- $filedir = $conf->assets->dir_output . '/' . $objref;
- $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
- $genallowed = $user->rights->assets->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->assets->create; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('assets', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
+ // Documents
+ /*$objref = dol_sanitizeFileName($object->ref);
+ $relativepath = $comref . '/' . $comref . '.pdf';
+ $filedir = $conf->assets->dir_output . '/' . $objref;
+ $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
+ $genallowed = $user->rights->assets->read; // If you can read, you can build the PDF to read content
+ $delallowed = $user->rights->assets->create; // If you can create/edit, you can remove a file on card
+ print $formfile->showdocuments('assets', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
- // Show links to link elements
- $linktoelem = $form->showLinkToObjectBlock($object, null, array('assets'));
- $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+ // Show links to link elements
+ $linktoelem = $form->showLinkToObjectBlock($object, null, array('assets'));
+ $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
- print '
';
+ print '
';
- $MAXEVENT = 10;
+ $MAXEVENT = 10;
- $morehtmlright = '
';
- $morehtmlright.= $langs->trans("SeeAll");
- $morehtmlright.= '';
+ $morehtmlright = '
';
+ $morehtmlright.= $langs->trans("SeeAll");
+ $morehtmlright.= '';
- // List of actions on element
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
- $formactions = new FormActions($db);
- $somethingshown = $formactions->showactions($object, 'assets', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
+ $formactions = new FormActions($db);
+ $somethingshown = $formactions->showactions($object, 'assets', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
- print '
';
+ print '
';
}
//Select mail models is same action as presend
diff --git a/htdocs/assets/class/assets.class.php b/htdocs/assets/class/assets.class.php
index 69b94cc3fd8..efacac10822 100644
--- a/htdocs/assets/class/assets.class.php
+++ b/htdocs/assets/class/assets.class.php
@@ -75,14 +75,14 @@ class Assets extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
- 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
+ 'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
'amount' => array('type'=>'double(24,8)', 'label'=>'Amount', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
- 'description' => array('type'=>'text', 'label'=>'Descrption', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1,),
- 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,),
- 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,),
+ 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>510, 'notnull'=>1,),
@@ -106,8 +106,6 @@ class Assets extends CommonObject
public $import_key;
public $status;
-
-
// If this object has a subtable with lines
/**
@@ -131,8 +129,6 @@ class Assets extends CommonObject
*/
//public $lines = array();
-
-
/**
* Constructor
*
@@ -170,43 +166,42 @@ class Assets extends CommonObject
public function createFromClone(User $user, $fromid)
{
global $hookmanager, $langs;
- $error = 0;
+ $error = 0;
- dol_syslog(__METHOD__, LOG_DEBUG);
+ dol_syslog(__METHOD__, LOG_DEBUG);
- $object = new self($this->db);
+ $object = new self($this->db);
- $this->db->begin();
+ $this->db->begin();
- // Load source object
- $object->fetchCommon($fromid);
- // Reset some properties
- unset($object->id);
- unset($object->fk_user_creat);
- unset($object->import_key);
+ // Load source object
+ $object->fetchCommon($fromid);
+ // Reset some properties
+ unset($object->id);
+ unset($object->fk_user_creat);
+ unset($object->import_key);
- // Clear fields
- $object->ref = "copy_of_".$object->ref;
- $object->title = $langs->trans("CopyOf")." ".$object->title;
- // ...
+ // Clear fields
+ $object->ref = "copy_of_".$object->ref;
+ $object->title = $langs->trans("CopyOf")." ".$object->title;
- // Create clone
+ // Create clone
$object->context['createfromclone'] = 'createfromclone';
- $result = $object->createCommon($user);
- if ($result < 0) {
- $error++;
- $this->error = $object->error;
- $this->errors = $object->errors;
- }
+ $result = $object->createCommon($user);
+ if ($result < 0) {
+ $error++;
+ $this->error = $object->error;
+ $this->errors = $object->errors;
+ }
- // End
- if (!$error) {
- $this->db->commit();
- return $object;
- } else {
- $this->db->rollback();
- return -1;
- }
+ // End
+ if (!$error) {
+ $this->db->commit();
+ return $object;
+ } else {
+ $this->db->rollback();
+ return -1;
+ }
}
/**
@@ -264,50 +259,50 @@ class Assets extends CommonObject
/**
* Return a link to the object card (with optionaly the picto)
*
- * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
- * @param string $option On what the link point to ('nolink', ...)
- * @param int $notooltip 1=Disable tooltip
- * @param string $morecss Add more css on link
- * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
- * @return string String with URL
+ * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+ * @param string $option On what the link point to ('nolink', ...)
+ * @param int $notooltip 1=Disable tooltip
+ * @param string $morecss Add more css on link
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $db, $conf, $langs;
- global $dolibarr_main_authentication, $dolibarr_main_demo;
- global $menumanager;
+ global $dolibarr_main_authentication, $dolibarr_main_demo;
+ global $menumanager;
- if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+ if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
- $result = '';
- $companylink = '';
+ $result = '';
+ $companylink = '';
- $label = '
' . $langs->trans("Assets") . '';
- $label.= '
';
- $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref;
+ $label = '
' . $langs->trans("Asset") . '';
+ $label.= '
';
+ $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref;
- $url = dol_buildpath('/assets/card.php',1).'?id='.$this->id;
+ $url = dol_buildpath('/assets/card.php',1).'?id='.$this->id;
- if ($option != 'nolink')
- {
- // Add param to save lastsearch_values or not
- $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
- if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
- }
+ if ($option != 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
+ if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ }
- $linkclose='';
- if (empty($notooltip))
- {
- if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
- {
- $label=$langs->trans("ShowAssets");
- $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
- }
- $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
- }
- else $linkclose = ($morecss?' class="'.$morecss.'"':'');
+ $linkclose='';
+ if (empty($notooltip))
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowAssets");
+ $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
+ }
+ else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '
';
@@ -325,8 +320,8 @@ class Assets extends CommonObject
/**
* Retourne le libelle du status d'un user (actif, inactif)
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @return string Label of status
*/
function getLibStatut($mode=0)
{
@@ -336,9 +331,9 @@ class Assets extends CommonObject
/**
* Return the status
*
- * @param int $status Id status
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
- * @return string Label of status
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
static function LibStatut($status,$mode=0)
{
@@ -463,23 +458,6 @@ class Assets extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
- // ...
-
return 0;
}
-}
-
-/**
- * Class AssetsLine. You can also remove this and generate a CRUD class for lines objects.
- */
-/*
-class AssetsLine
-{
- // @var int ID
- public $id;
- // @var mixed Sample line property 1
- public $prop1;
- // @var mixed Sample line property 2
- public $prop2;
-}
-*/
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index ccfac2c72e2..179421d372f 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -278,7 +278,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Assets
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'accountancy', 'assets', 10__+MAX_llx_menu__, '/assets/list.php?leftmenu=assets&mainmenu=accountancy', 'Assets', 0, 'assets', '$user->rights->assets->read', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/card.php?leftmenu=assets&mainmenu=accountancy&action=create', 'NewAsset', 1, 'assets', '$user->rights->assets->write', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/list.php?leftmenu=assets&mainmenu=accounactancy', 'List', 1, 'assets', '$user->rights->assets->read', '', 2, 1, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->assets->enabled && $leftmenu=="assets"', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'accountancy', '', 2800__+MAX_llx_menu__, '/assets/list.php?leftmenu=assets&mainmenu=accountancy', 'List', 1, 'assets', '$user->rights->assets->read', '', 2, 1, __ENTITY__);
-- Check deposit
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__);
diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang
index 8c9e28023ae..ea8cc2a149a 100644
--- a/htdocs/langs/en_US/assets.lang
+++ b/htdocs/langs/en_US/assets.lang
@@ -18,6 +18,9 @@
#
Assets = Assets
NewAsset = New asset
+AccountancyAccountAsset = Accounting code (asset)
+AccountancyAccountDepreciationAsset = Accounting code (depreciation asset account)
+AccountancyAccountDepreciationExpense = Accounting code (depreciation expense account)
# Module label 'ModuleAssetsName'
ModuleAssetsName = Assets