diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index 8eb915f95eb..51d76d75155 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -42,7 +42,7 @@ class AssetType extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'group'; + public $picto = 'invoice'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -51,9 +51,9 @@ class AssetType extends CommonObject public $ismultientitymanaged = 1; /** - * @var string Asset type label - */ - public $label; + * @var string Asset type label + */ + public $label; /** @var string Accountancy code asset */ public $accountancy_code_asset; @@ -107,12 +107,14 @@ class AssetType extends CommonObject $sql.= ", accountancy_code_asset"; $sql.= ", accountancy_code_depreciation_asset"; $sql.= ", accountancy_code_depreciation_expense"; + $sql.= ", note"; $sql.= ", entity"; $sql.= ") VALUES ("; $sql.= "'".$this->db->escape($this->label)."'"; $sql.= ", '".$this->db->escape($this->accountancy_code_asset)."'"; $sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'"; $sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'"; + $sql.= ", '".$this->db->escape($this->note)."'"; $sql.= ", ".$conf->entity; $sql.= ")"; @@ -179,7 +181,8 @@ class AssetType extends CommonObject $sql.= "label = '".$this->db->escape($this->label) ."',"; $sql.= "accountancy_code_asset = '".$this->db->escape($this->accountancy_code_asset)."',"; $sql.= "accountancy_code_depreciation_asset = '".$this->db->escape($this->accountancy_code_depreciation_asset)."',"; - $sql.= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."'"; + $sql.= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."',"; + $sql.= "note = '".$this->db->escape($this->note) ."'"; $sql.= " WHERE rowid =".$this->id; $result = $this->db->query($sql); diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 9e06c4a765d..ea8a4502264 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -49,10 +49,13 @@ $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) { $sortorder="DESC"; } -if (! $sortfield) { $sortfield="d.lastname"; } +if (! $sortfield) { $sortfield="a.label"; } $label=GETPOST("label","alpha"); -$comment=GETPOST("comment"); +$accountancy_code_asset=GETPOST('accountancy_code_asset','string'); +$accountancy_code_depreciation_asset=GETPOST('accountancy_code_depreciation_asset','string'); +$accountancy_code_depreciation_expense=GETPOST('accountancy_code_depreciation_expense','string'); +$comment=GETPOST('comment','string'); // Security check $result=restrictedArea($user,'asset',$rowid,'asset_type'); @@ -259,39 +262,39 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''.dol_escape_htmltag($objp->label).''; - print ''; + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$object->accountancy_code_asset,1); + $accountingaccount->fetch('',$objp->accountancy_code_asset,1); - print $accountingaccount->getNomUrl(0,1,1,'',1); + print $accountingaccount->getNomUrl(0,0,0,'',0); } else { - print $object->accountancy_code_asset; + print $objp->accountancy_code_asset; } print ''; - print ''; + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount2 = new AccountingAccount($db); - $accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1); + $accountingaccount2->fetch('',$objp->accountancy_code_depreciation_asset,1); - print $accountingaccount2->getNomUrl(0,1,1,'',1); + print $accountingaccount2->getNomUrl(0,0,0,'',0); } else { - print $object->accountancy_code_depreciation_asset; + print $objp->accountancy_code_depreciation_asset; } print ''; - print ''; + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount3 = new AccountingAccount($db); - $accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1); + $accountingaccount3->fetch('',$objp->accountancy_code_depreciation_expense,1); - print $accountingaccount3->getNomUrl(0,1,1,'',1); + print $accountingaccount3->getNomUrl(0,0,0,'',0); } else { - print $object->accountancy_code_depreciation_expense; + print $objp->accountancy_code_depreciation_expense; } print ''; @@ -418,7 +421,7 @@ if ($rowid > 0) */ if ($action == 'delete') { - print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1); + print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAnAssetType"),$langs->trans("ConfirmDeleteAssetType",$object->label),"confirm_delete", '',0,1); } $head = asset_type_prepare_head($object); @@ -427,14 +430,23 @@ if ($rowid > 0) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'rowid', $linkback); + $morehtmlref='
'; + // Ref asset type + $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->asset->write, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->asset->write, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + + dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; print '
'; print ''; - print ''; + print ''; + print ''; + print ''; - print ''; + print ''; + print ''; - print ''; + print ''; print ''; print ''; - - print '
'; - print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); - - $moreforfilter = ''; - - print '
'; - print '
'; + print $langs->trans("AccountancyCodeAsset"); + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); @@ -445,8 +457,12 @@ if ($rowid > 0) print $object->accountancy_code_asset; } print '
'; + print '
'; + print $langs->trans("AccountancyCodeDepreciationAsset"); + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount2 = new AccountingAccount($db); @@ -457,8 +473,12 @@ if ($rowid > 0) print $object->accountancy_code_depreciation_asset; } print '
'; + print '
'; + print $langs->trans("AccountancyCodeDepreciationExpense"); + print ''; if (! empty($conf->accounting->enabled)) { $accountingaccount3 = new AccountingAccount($db); @@ -468,6 +488,7 @@ if ($rowid > 0) } else { print $object->accountancy_code_depreciation_expense; } + print '
'.$langs->trans("Description").''; @@ -493,9 +514,6 @@ if ($rowid > 0) print ''; } - // Add - print ''; - // Delete if ($user->rights->asset->write) { @@ -504,233 +522,6 @@ if ($rowid > 0) print ""; - - // Show list of assets (nearly same code than in page list.php) - $assettypestatic=new AssetType($db); - - $now=dol_now(); - - $sql = "SELECT a.rowid, d.login, d.firstname, d.lastname, d.societe, "; - $sql.= " d.datefin,"; - $sql.= " a.fk_asset_type as type_id,"; - $sql.= " t.label as type"; - $sql.= " FROM ".MAIN_DB_PREFIX."asset as a, ".MAIN_DB_PREFIX."asset_type as t"; - $sql.= " WHERE a.fk_asset_type = t.rowid"; - $sql.= " AND a.entity IN (".getEntity('asset').")"; - $sql.= " AND t.rowid = ".$object->id; - if ($sall) - { - $sql.=natural_search(array("f.firstname","d.lastname","d.societe","d.email","d.login","d.address","d.town","d.note_public","d.note_private"), $sall); - } - if ($status != '') - { - $sql.= natural_search('d.statut', $status, 2); - } - if ($action == 'search') - { - if (GETPOST('search','alpha')) - { - $sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha')); - } - } - if (! empty($search_lastname)) - { - $sql.= natural_search(array("d.firstname","d.lastname"), $search_lastname); - } - if (! empty($search_login)) - { - $sql.= natural_search("d.login", $search_login); - } - if (! empty($search_email)) - { - $sql.= natural_search("d.email", $search_email); - } - if ($filter == 'uptodate') - { - $sql.=" AND datefin >= '".$db->idate($now)."'"; - } - if ($filter == 'outofdate') - { - $sql.=" AND datefin < '".$db->idate($now)."'"; - } - - $sql.= " ".$db->order($sortfield,$sortorder); - - // Count total nb of records - $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { - $resql = $db->query($sql); - if ($resql) $nbtotalofrecords = $db->num_rows($result); - else dol_print_error($db); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 - { - $page = 0; - $offset = 0; - } - } - - $sql.= " ".$db->plimit($conf->liste_limit+1, $offset); - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - $titre=$langs->trans("AssetsList"); - if ($status != '') - { - if ($status == '-1,1') { $titre=$langs->trans("MembersListQualified"); } - else if ($status == '-1') { $titre=$langs->trans("MembersListToValid"); } - else if ($status == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); } - else if ($status == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); } - else if ($status == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } - else if ($status == '0') { $titre=$langs->trans("MembersListResiliated"); } - } - elseif ($action == 'search') - { - $titre=$langs->trans("MembersListQualified"); - } - - if ($type > 0) - { - $assettype=new AssetType($db); - $result=$assettype->fetch($type); - $titre.=" (".$assettype->label.")"; - } - - $param="&rowid=".$object->id; - if (! empty($status)) $param.="&status=".$status; - if (! empty($search_lastname)) $param.="&search_lastname=".$search_lastname; - if (! empty($search_firstname)) $param.="&search_firstname=".$search_firstname; - if (! empty($search_login)) $param.="&search_login=".$search_login; - if (! empty($search_email)) $param.="&search_email=".$search_email; - if (! empty($filter)) $param.="&filter=".$filter; - - if ($sall) - { - print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; - } - - print '
'; - print '
'."\n"; - - // Lignes des champs de filtre - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print "\n"; - - print ''; - print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); - print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); - print "\n"; - - while ($i < $num && $i < $conf->liste_limit) - { - $objp = $db->fetch_object($resql); - - $datefin=$db->jdate($objp->datefin); - - $adh=new Asset($db); - $adh->lastname=$objp->lastname; - $adh->firstname=$objp->firstname; - - // Lastname - print ''; - if ($objp->societe != '') - { - print ''."\n"; - } - else - { - print ''."\n"; - } - - // Login - print "\n"; - - // Type - /*print ''; - */ - - // Moral/Physique - print "\n"; - - // EMail - print "\n"; - - // Statut - print '"; - - // Actions - print '"; - - print "\n"; - $i++; - } - - print "
'; - print ''; - print ' '; - print ' '; - print ''; - print '  '; - print ''; - print '
'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).''.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).'".$objp->login."'; - $assettypestatic->id=$objp->type_id; - $assettypestatic->label=$objp->type; - print $assettypestatic->getNomUrl(1,12); - print '".$adh->getmorphylib($objp->morphy)."".dol_print_email($objp->email,0,0,1)."'; - print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2); - print "'; - if ($user->rights->asset->creer) - { - print ''.img_edit().''; - } - print ' '; - if ($user->rights->asset->supprimer) - { - print ''.img_picto($langs->trans("Resiliate"),'disable.png').''; - } - print "
\n"; - print '
'; - print ''; - - if ($num > $conf->liste_limit) - { - print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,''); - } - } - else - { - dol_print_error($db); - } } /* ************************************************************************** */ diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang index 0f955fe19ce..b780fb6fcba 100644 --- a/htdocs/langs/en_US/assets.lang +++ b/htdocs/langs/en_US/assets.lang @@ -22,7 +22,14 @@ AccountancyCodeAsset = Accounting code (asset) AccountancyCodeDepreciationAsset = Accounting code (depreciation asset account) AccountancyCodeDepreciationExpense = Accounting code (depreciation expense account) NewAssetType=New asset type +AssetsTypeSetup=Assets type setup +AssetTypeModified=Asset type modified +AssetType=Asset type AssetsLines=Assets +DeleteType=Delete +DeleteAnAssetType=Delete an asset type +ConfirmDeleteAssetType=Are you sure you want to delete this asset type? +ShowTypeCard=Show type '%s' # Module label 'ModuleAssetsName' ModuleAssetsName = Assets