Update works

This commit is contained in:
Alexandre SPANGARO
2018-04-06 06:04:03 +02:00
parent 06dc70df09
commit 3e66f5e25b
11 changed files with 246 additions and 249 deletions

View File

@@ -16,21 +16,21 @@
*/
/**
* \file htdocs/assets/class/assets_type.class.php
* \file htdocs/assets/class/asset_type.class.php
* \ingroup assets
* \brief File of class to manage assets types
* \brief File of class to manage asset types
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage assets type
* Class to manage asset type
*/
class AssetsType extends CommonObject
class AssetType extends CommonObject
{
public $table_element = 'assets_type';
public $element = 'assets_type';
public $table_element = 'asset_type';
public $element = 'asset_type';
public $picto = 'group';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
@@ -44,8 +44,8 @@ class AssetsType extends CommonObject
public $accountancy_code_depreciation_expense;
/** @var string Public note */
public $note;
/** @var array Array of assets */
public $assets=array();
/** @var array Array of asset */
public $asset=array();
/**
@@ -76,7 +76,7 @@ class AssetsType extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."assets_type (";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
$sql.= "label";
$sql.= ", entity";
$sql.= ") VALUES (";
@@ -84,11 +84,11 @@ class AssetsType extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ")";
dol_syslog("Assets_type::create", LOG_DEBUG);
dol_syslog("Asset_type::create", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."assets_type");
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."asset_type");
$result = $this->update($user,1);
if ($result < 0)
@@ -100,7 +100,7 @@ class AssetsType extends CommonObject
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ASSETS_TYPE_CREATE',$user);
$result=$this->call_trigger('ASSET_TYPE_CREATE',$user);
if ($result < 0) { $error++; }
// End call triggers
}
@@ -142,7 +142,7 @@ class AssetsType extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."assets_type ";
$sql = "UPDATE ".MAIN_DB_PREFIX."asset_type ";
$sql.= "SET ";
$sql.= "label = '".$this->db->escape($this->label) ."',";
$sql.= "accountancy_code_asset = '".$this->db->escape($this->accountancy_code_asset)."',";
@@ -156,8 +156,8 @@ class AssetsType extends CommonObject
$action='update';
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('assetstypedao'));
$parameters=array('assetstype'=>$this->id);
$hookmanager->initHooks(array('assettypedao'));
$parameters=array('assettype'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
@@ -175,7 +175,7 @@ class AssetsType extends CommonObject
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ASSETS_TYPE_MODIFY',$user);
$result=$this->call_trigger('ASSET_TYPE_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
@@ -211,14 +211,14 @@ class AssetsType extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."assets_type";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_type";
$sql.= " WHERE rowid = ".$this->id;
$resql=$this->db->query($sql);
if ($resql)
{
// Call trigger
$result=$this->call_trigger('ASSETS_TYPE_DELETE',$user);
$result=$this->call_trigger('ASSET_TYPE_DELETE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
// End call triggers
@@ -234,7 +234,7 @@ class AssetsType extends CommonObject
}
/**
* Fonction qui permet de recuperer le status de l'adherent
* Fonction qui permet de recuperer le status de l'immobilisation
*
* @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK
@@ -242,10 +242,10 @@ class AssetsType extends CommonObject
function fetch($rowid)
{
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
$sql .= " FROM ".MAIN_DB_PREFIX."assets_type as d";
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid;
dol_syslog("Assets_type::fetch", LOG_DEBUG);
dol_syslog("Asset_type::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@@ -273,7 +273,7 @@ class AssetsType extends CommonObject
}
/**
* Return list of assets' type
* Return list of asset's type
*
* @return array List of types of members
*/
@@ -281,11 +281,11 @@ class AssetsType extends CommonObject
{
global $conf,$langs;
$assetstypes = array();
$assettypes = array();
$sql = "SELECT rowid, label as label";
$sql.= " FROM ".MAIN_DB_PREFIX."assets_type";
$sql.= " WHERE entity IN (".getEntity('assets_type').")";
$sql.= " FROM ".MAIN_DB_PREFIX."asset_type";
$sql.= " WHERE entity IN (".getEntity('asset_type').")";
$resql=$this->db->query($sql);
if ($resql)
@@ -299,7 +299,7 @@ class AssetsType extends CommonObject
{
$obj = $this->db->fetch_object($resql);
$assetstypes[$obj->rowid] = $langs->trans($obj->label);
$assettypes[$obj->rowid] = $langs->trans($obj->label);
$i++;
}
}
@@ -308,7 +308,7 @@ class AssetsType extends CommonObject
{
print $this->db->error();
}
return $assetstypes;
return $assettypes;
}
/**
@@ -317,19 +317,19 @@ class AssetsType extends CommonObject
* @param string $excludefilter Filter to exclude
* @param int $mode 0=Return array of asset instance
* 1=Return array of asset instance without extra data
* 2=Return array of assets id only
* @return mixed Array of assets or -1 on error
* 2=Return array of asset id only
* @return mixed Array of asset or -1 on error
*/
function listAssetsForAssetsType($excludefilter='', $mode=0)
function listAssetForAssetType($excludefilter='', $mode=0)
{
global $conf, $user;
$ret=array();
$sql = "SELECT a.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."assets as a";
$sql.= " WHERE a.entity IN (".getEntity('assets').")";
$sql.= " AND a.fk_assets_type = ".$this->id;
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a";
$sql.= " WHERE a.entity IN (".getEntity('asset').")";
$sql.= " AND a.fk_asset_type = ".$this->id;
if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')';
dol_syslog(get_class($this)."::listAssetsForGroup", LOG_DEBUG);
@@ -342,13 +342,13 @@ class AssetsType extends CommonObject
{
if ($mode < 2)
{
$assetsstatic=new Assets($this->db);
$assetstatic=new Asset($this->db);
if ($mode == 1) {
$assetsstatic->fetch($obj->rowid,'','','',false, false);
$assetstatic->fetch($obj->rowid,'','','',false, false);
} else {
$assetsstatic->fetch($obj->rowid);
$assetstatic->fetch($obj->rowid);
}
$ret[$obj->rowid]=$assetsstatic;
$ret[$obj->rowid]=$assetstatic;
}
else $ret[$obj->rowid]=$obj->rowid;
}
@@ -356,7 +356,7 @@ class AssetsType extends CommonObject
$this->db->free($resql);
$this->assets=$ret;
$this->asset=$ret;
return $ret;
}
@@ -367,31 +367,31 @@ class AssetsType extends CommonObject
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
{
global $langs;
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
{
global $langs;
$result='';
$label=$langs->trans("ShowTypeCard",$this->label);
$result='';
$label=$langs->trans("ShowTypeCard",$this->label);
$linkstart = '<a href="'.DOL_URL_ROOT.'/assets/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/assets/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
$result .= $linkend;
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
$result .= $linkend;
return $result;
}
return $result;
}
/**
* Initialise an instance with random values.
@@ -409,11 +409,11 @@ class AssetsType extends CommonObject
$this->ref = 'ATSPEC';
$this->specimen=1;
$this->label='ASSETS TYPE SPECIMEN';
$this->label='ASSET TYPE SPECIMEN';
$this->note='This is a note';
// Assets of this asset type is just me
$this->assets=array(
$this->asset=array(
$user->id => $user
);
}

View File

@@ -23,8 +23,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/assets.lib.php';
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets.class.php';
require_once DOL_DOCUMENT_ROOT.'/assets/class/assets_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/assets/class/asset.class.php';
require_once DOL_DOCUMENT_ROOT.'/assets/class/asset_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("assets");
@@ -34,10 +34,7 @@ $action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');
$backtopage = GETPOST('backtopage','alpha');
$search_lastname = GETPOST('search_lastname','alpha');
$search_login = GETPOST('search_login','alpha');
$search_email = GETPOST('search_email','alpha');
$type = GETPOST('type','alpha');
$type = GETPOST('type','alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
@@ -51,33 +48,27 @@ if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="d.lastname"; }
$label=GETPOST("label","alpha");
$subscription=GETPOST("subscription","int");
$vote=GETPOST("vote","int");
$comment=GETPOST("comment");
$mail_valid=GETPOST("mail_valid");
// Security check
$result=restrictedArea($user,'assets',$rowid,'assets_type');
$result=restrictedArea($user,'assets',$rowid,'asset_type');
$object = new AssetsType($db);
$object = new AssetType($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('assets_type');
$extralabels=$extrafields->fetch_name_optionals_label('asset_type');
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_lastname="";
$search_login="";
$search_email="";
$type="";
$sall="";
$type="";
$sall="";
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('assetstypecard','globalcard'));
$hookmanager->initHooks(array('assettypecard','globalcard'));
/*
@@ -112,7 +103,7 @@ if ($action == 'add' && $user->rights->assets->write)
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), null, 'errors');
}
else {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."assets_type WHERE label='".$db->escape($object->label)."'";
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."asset_type WHERE label='".$db->escape($object->label)."'";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
@@ -203,14 +194,14 @@ $helpurl='';
llxHeader('',$langs->trans("AssetsTypeSetup"),$helpurl);
// List of assets type
// List of asset type
if (! $rowid && $action != 'create' && $action != 'edit')
{
//dol_fiche_head('');
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
$sql.= " FROM ".MAIN_DB_PREFIX."assets_type as d";
$sql.= " WHERE d.entity IN (".getEntity('assets_type').")";
$sql.= " FROM ".MAIN_DB_PREFIX."asset_type as d";
$sql.= " WHERE d.entity IN (".getEntity('asset_type').")";
$result = $db->query($sql);
if ($result)
@@ -228,10 +219,10 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
print_barre_liste($langs->trans("AssetsTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
$moreforfilter = '';
@@ -246,19 +237,19 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<th>&nbsp;</th>';
print "</tr>\n";
$assetstype = new AssetsType($db);
$assettype = new AssetType($db);
while ($i < $num)
{
$objp = $db->fetch_object($result);
$assetstype->id = $objp->rowid;
$assetstype->ref = $objp->rowid;
$assetstype->label = $objp->rowid;
$assettype->id = $objp->rowid;
$assettype->ref = $objp->rowid;
$assettype->label = $objp->rowid;
print '<tr class="oddeven">';
print '<td>';
print $assetstype->getNomUrl(1);
print $assettype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
@@ -298,7 +289,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
dol_fiche_head('');
dol_fiche_head('');
print '<table class="border" width="100%">';
print '<tbody>';
@@ -325,7 +316,7 @@ if ($action == 'create')
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
@@ -426,17 +417,17 @@ if ($rowid > 0)
// Show list of members (nearly same code than in page list.php)
$assetstypestatic=new AdherentType($db);
$assettypestatic=new AssetType($db);
$now=dol_now();
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, ";
$sql = "SELECT a.rowid, d.login, d.firstname, d.lastname, d.societe, ";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity IN (".getEntity('adherent').")";
$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)
{
@@ -444,7 +435,7 @@ if ($rowid > 0)
}
if ($status != '')
{
$sql.= natural_search('d.statut', $status, 2);
$sql.= natural_search('d.statut', $status, 2);
}
if ($action == 'search')
{
@@ -467,19 +458,19 @@ if ($rowid > 0)
}
if ($filter == 'uptodate')
{
$sql.=" AND datefin >= '".$db->idate($now)."'";
$sql.=" AND datefin >= '".$db->idate($now)."'";
}
if ($filter == 'outofdate')
{
$sql.=" AND datefin < '".$db->idate($now)."'";
$sql.=" AND datefin < '".$db->idate($now)."'";
}
// 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 ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db);
}
// Add order and limit
$sql.= " ".$db->order($sortfield,$sortorder);
@@ -488,54 +479,54 @@ if ($rowid > 0)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
$titre=$langs->trans("MembersList");
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");
}
$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)
{
$assetstype=new AdherentType($db);
$result=$assetstype->fetch($type);
$titre.=" (".$assetstype->label.")";
}
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;
$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;
}
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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
print '<br>';
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$moreforfilter = '';
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Lignes des champs de filtre
print '<tr class="liste_titre_filter">';
@@ -555,96 +546,96 @@ if ($rowid > 0)
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
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 "</tr>\n";
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 "</tr>\n";
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($resql);
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($resql);
$datefin=$db->jdate($objp->datefin);
$datefin=$db->jdate($objp->datefin);
$adh=new Adherent($db);
$adh->lastname=$objp->lastname;
$adh->firstname=$objp->firstname;
$adh=new Adherent($db);
$adh->lastname=$objp->lastname;
$adh->firstname=$objp->firstname;
// Lastname
print '<tr class="oddeven">';
if ($objp->societe != '')
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).'</a></td>'."\n";
}
else
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).'</a></td>'."\n";
}
// Lastname
print '<tr class="oddeven">';
if ($objp->societe != '')
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).'</a></td>'."\n";
}
else
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,32).'</a></td>'."\n";
}
// Login
print "<td>".$objp->login."</td>\n";
// Login
print "<td>".$objp->login."</td>\n";
// Type
/*print '<td class="nowrap">';
$assetstypestatic->id=$objp->type_id;
$assetstypestatic->label=$objp->type;
print $assetstypestatic->getNomUrl(1,12);
print '</td>';
// Type
/*print '<td class="nowrap">';
$assettypestatic->id=$objp->type_id;
$assettypestatic->label=$objp->type;
print $assettypestatic->getNomUrl(1,12);
print '</td>';
*/
// Moral/Physique
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
// Moral/Physique
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
// Statut
print '<td class="nowrap">';
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// Statut
print '<td class="nowrap">';
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// Date end subscription
if ($datefin)
{
print '<td align="center" class="nowrap">';
if ($datefin < dol_now() && $objp->statut > 0)
{
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
else
{
print dol_print_date($datefin,'day');
}
print '</td>';
}
else
{
print '<td align="left" class="nowrap">';
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
// Date end subscription
if ($datefin)
{
print '<td align="center" class="nowrap">';
if ($datefin < dol_now() && $objp->statut > 0)
{
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
else
{
print dol_print_date($datefin,'day');
}
print '</td>';
}
else
{
print '<td align="left" class="nowrap">';
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
// Actions
print '<td align="center">';
// Actions
print '<td align="center">';
if ($user->rights->adherent->creer)
{
print '<a href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
@@ -653,25 +644,25 @@ if ($rowid > 0)
if ($user->rights->adherent->supprimer)
{
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"),'disable.png').'</a>';
}
}
print "</td>";
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
print "</table>\n";
print '</div>';
print '</form>';
print "</table>\n";
print '</div>';
print '</form>';
if ($num > $conf->liste_limit)
{
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
}
}
else
{
dol_print_error($db);
dol_print_error($db);
}
}
@@ -723,10 +714,10 @@ if ($rowid > 0)
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
print $object->showOptionals($extrafields,'edit');
}
print '</table>';

View File

@@ -340,15 +340,16 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,1,1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,<br><br>\n\n__(ThisIsContentOfYourCard)__<br>\n__(ID)__ : __ID__<br>\n__(Civiliyty)__ : __MEMBER_CIVILITY__<br>\n__(Firstname)__ : __MEMBER_FIRSTNAME__<br>\n__(Lastname)__ : __MEMBER_LASTNAME__<br>\n__(Fullname)__ : __MEMBER_FULLNAME__<br>\n__(Company)__ : __MEMBER_COMPANY__<br>\n__(Address)__ : __MEMBER_ADDRESS__<br>\n__(Zip)__ : __MEMBER_ZIP__<br>\n__(Town)__ : __MEMBER_TOWN__<br>\n__(Country)__ : __MEMBER_COUNTRY__<br>\n__(Email)__ : __MEMBER_EMAIL__<br>\n__(Birthday)__ : __MEMBER_BIRTH__<br>\n__(Photo)__ : __MEMBER_PHOTO__<br>\n__(Login)__ : __MEMBER_LOGIN__<br>\n__(Password)__ : __MEMBER_PASSWORD__<br>\n__(Phone)__ : __MEMBER_PHONE__<br>\n__(PhonePerso)__ : __MEMBER_PHONEPRO__<br>\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 1);
ALTER TABLE llx_product ADD COLUMN fk_default_warehouse integer DEFAULT NULL;
ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);
ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid);
-- Assets
CREATE TABLE llx_assets(
CREATE TABLE llx_asset(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
label varchar(255),
amount double(24,8) DEFAULT NULL,
fk_asset_type integer NOT NULL,
fk_soc integer,
description text,
note_public text,
@@ -361,13 +362,15 @@ CREATE TABLE llx_assets(
status integer NOT NULL
) ENGINE=innodb;
ALTER TABLE llx_assets ADD INDEX idx_assets_rowid (rowid);
ALTER TABLE llx_assets ADD INDEX idx_assets_ref (ref);
ALTER TABLE llx_assets ADD INDEX idx_assets_entity (entity);
ALTER TABLE llx_assets ADD INDEX idx_assets_fk_soc (fk_soc);
ALTER TABLE llx_assets ADD INDEX idx_assets_status (status);
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
create table llx_assets_extrafields
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);
create table llx_asset_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
@@ -375,12 +378,11 @@ create table llx_assets_extrafields
import_key varchar(14)
) ENGINE=innodb;
create table llx_assets_type
create table llx_asset_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp,
statut smallint NOT NULL DEFAULT 0,
label varchar(50) NOT NULL,
accountancy_code_asset varchar(32),
accountancy_code_depreciation_asset varchar(32),
@@ -388,9 +390,9 @@ create table llx_assets_type
note text
)ENGINE=innodb;
ALTER TABLE llx_assets_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
create table llx_assets_type_extrafields
create table llx_asset_type_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
@@ -398,6 +400,6 @@ create table llx_assets_type_extrafields
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_assets_type_extrafields ADD INDEX idx_assets_type_extrafields (fk_object);
ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object);
INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (7,'INV', 'Inventory journal', 8, 1);

View File

@@ -14,8 +14,11 @@
-- along with this program. If not, see http://www.gnu.org/licenses/.
ALTER TABLE llx_assets ADD INDEX idx_assets_rowid (rowid);
ALTER TABLE llx_assets ADD INDEX idx_assets_ref (ref);
ALTER TABLE llx_assets ADD INDEX idx_assets_entity (entity);
ALTER TABLE llx_assets ADD INDEX idx_assets_fk_soc (fk_soc);
ALTER TABLE llx_assets ADD INDEX idx_assets_status (status);
ALTER TABLE llx_asset ADD INDEX idx_asset_rowid (rowid);
ALTER TABLE llx_asset ADD INDEX idx_asset_ref (ref);
ALTER TABLE llx_asset ADD INDEX idx_asset_entity (entity);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_soc (fk_soc);
ALTER TABLE llx_asset ADD INDEX idx_asset_fk_asset_type (fk_asset_type);
ALTER TABLE llx_asset ADD CONSTRAINT fk_asset_asset_type FOREIGN KEY (fk_asset_type) REFERENCES llx_asset_type (rowid);

View File

@@ -14,12 +14,13 @@
-- along with this program. If not, see http://www.gnu.org/licenses/.
CREATE TABLE llx_assets(
CREATE TABLE llx_asset(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
entity integer DEFAULT 1 NOT NULL,
label varchar(255),
amount double(24,8) DEFAULT NULL,
fk_asset_type integer NOT NULL,
fk_soc integer,
description text,
note_public text,

View File

@@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see http://www.gnu.org/licenses/.
create table llx_assets_extrafields
create table llx_asset_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,

View File

@@ -13,4 +13,4 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
ALTER TABLE llx_assets_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);
ALTER TABLE llx_asset_type ADD UNIQUE INDEX uk_asset_type_label (label, entity);

View File

@@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
create table llx_assets_type
create table llx_asset_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id

View File

@@ -14,4 +14,4 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
ALTER TABLE llx_assets_type_extrafields ADD INDEX idx_assets_type_extrafields (fk_object);
ALTER TABLE llx_asset_type_extrafields ADD INDEX idx_asset_type_extrafields (fk_object);

View File

@@ -13,7 +13,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
create table llx_assets_type_extrafields
create table llx_asset_type_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,