31 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
42 public $table_element =
'c_partnership_type';
47 public $element =
'partnership_type';
52 public $picto =
'generic';
58 public $ismultientitymanaged = 1;
73 public $fields = array(
74 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 10),
75 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'default' =>
'1',
'enabled' => 1,
'visible' => -2,
'notnull' => 1,
'position' => 15,
'index' => 1),
76 'code' => array(
'type' =>
'varchar(32)',
'label' =>
'Code',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 20),
77 'label' => array(
'type' =>
'varchar(64)',
'label' =>
'Label',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 25,
'showoncombobox' => 1),
78 'active' => array(
'type' =>
'integer',
'label' =>
'Active',
'enabled' => 1,
'visible' => -1,
'notnull' => 1,
'position' => 30),
95 $this->fields[
'rowid'][
'visible'] = 0;
97 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
98 $this->fields[
'entity'][
'enabled'] = 0;
108 foreach ($this->fields as $key => $val) {
109 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
110 unset($this->fields[$key]);
115 if (is_object($langs)) {
116 foreach ($this->fields as $key => $val) {
117 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
118 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
119 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
136 return $resultcreate;
146 public function fetch($id, $ref =
null)
164 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
174 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
175 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
176 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
178 $sql .=
" WHERE 1 = 1";
185 $this->errors[] = $errormessage;
186 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
190 if (!empty($sortfield)) {
191 $sql .= $this->db->order($sortfield, $sortorder);
193 if (!empty($limit)) {
194 $sql .= $this->db->plimit($limit, $offset);
197 $resql = $this->db->query(
$sql);
199 $num = $this->db->num_rows($resql);
201 while ($i < ($limit ? min($limit, $num) : $num)) {
202 $obj = $this->db->fetch_object($resql);
204 $record =
new self($this->db);
205 $record->setVarsFromFetchObj($obj);
207 $records[$record->id] = $record;
211 $this->db->free($resql);
215 $this->errors[] =
'Error '.$this->db->lasterror();
216 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
241 public function delete(
User $user, $notrigger = 0)
256 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
258 global $conf, $langs, $hookmanager;
260 if (!empty($conf->dol_no_mouse_hover)) {
266 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"PartnershipType").
'</u>';
267 if (isset($this->
status)) {
268 $label .=
' '.$this->getLibStatut(5);
271 $label .=
'<b>'.$langs->trans(
'Code').
':</b> '.$this->code;
272 $label .=
'<br><b>'.$langs->trans(
'Label').
':</b> '.$this->label;
277 if ($option !=
'nolink') {
279 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
280 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
281 $add_save_lastsearch_values = 1;
283 if ($url && $add_save_lastsearch_values) {
284 $url .=
'&save_lastsearch_values=1';
289 if (empty($notooltip)) {
291 $label = $langs->trans(
"ShowMyObject");
292 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
294 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
295 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
297 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
300 if ($option ==
'nolink' || empty($url)) {
301 $linkstart =
'<span';
303 $linkstart =
'<a href="'.$url.
'"';
305 $linkstart .= $linkclose.
'>';
306 if ($option ==
'nolink' || empty($url)) {
307 $linkend =
'</span>';
312 $result .= $linkstart;
314 if (empty($this->showphoto_on_popup)) {
316 $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);
320 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
322 list($class, $module) = explode(
'@', $this->picto);
325 $filename = $filearray[0][
'name'];
326 if (!empty($filename)) {
327 $pospoint = strpos($filearray[0][
'name'],
'.');
329 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
331 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.
'" alt="No photo" border="0" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.$module.
'&entity='.$conf->entity.
'&file='.urlencode($pathtophoto).
'"></div></div>';
333 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.$module.
'&entity='.$conf->entity.
'&file='.urlencode($pathtophoto).
'"></div>';
338 $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);
343 if ($withpicto != 2) {
344 $result .= $this->ref;
350 global $action, $hookmanager;
351 $hookmanager->initHooks(array(
'myobjectdao'));
352 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
353 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
355 $result = $hookmanager->resPrint;
357 $result .= $hookmanager->resPrint;
382 $sql =
"SELECT rowid, date_creation as datec, tms as datem,";
383 $sql .=
" fk_user_creat, fk_user_modif";
384 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
385 $sql .=
" WHERE t.rowid = ".((int) $id);
387 $result = $this->db->query(
$sql);
389 if ($this->db->num_rows($result)) {
390 $obj = $this->db->fetch_object($result);
392 $this->
id = $obj->rowid;
394 $this->user_creation_id = $obj->fk_user_creat;
395 $this->user_modification_id = $obj->fk_user_modif;
396 $this->date_creation = $this->db->jdate($obj->datec);
397 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
400 $this->db->free($result);
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Parent class of all other business classes (invoices, contracts, proposals, orders,...
createCommon(User $user, $notrigger=0)
Create object into database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
updateCommon(User $user, $notrigger=0)
Update object into database.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Class to manage Dolibarr database access.
Class to manage partnership type.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
getLibStatut($mode=0)
Return the label of the status.
__construct(DoliDB $db)
Constructor.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
fetch($id, $ref=null)
Load object in memory from the database.
update(User $user, $notrigger=0)
Update object into database.
info($id)
Load the info information in the object.
create(User $user, $notrigger=0)
Create object into database.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
Class to manage Dolibarr users.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.