28require_once DOL_DOCUMENT_ROOT .
'/partnership/class/partnership.class.php';
38 public $module =
'webportal';
44 Partnership::STATUS_DRAFT =>
'Draft',
45 Partnership::STATUS_VALIDATED =>
'Accepted',
46 Partnership::STATUS_APPROVED =>
'Refused',
47 Partnership::STATUS_REFUSED =>
'Suspended',
48 Partnership::STATUS_CANCELED =>
'Terminated',
54 protected $partnership_static =
null;
98 public $fields = array(
99 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'visible' => 0,
'noteditable' => 1,
'index' => 1,
'css' =>
'left',
'comment' =>
"Id",),
100 'ref' => array(
'type' =>
'varchar(128)',
'label' =>
'Ref',
'enabled' => 1,
'position' => 10,
'notnull' => 1,
'visible' => 5,
'noteditable' => 1,
'default' =>
'(PROV)',
'index' => 1,
'searchall' => 1,
'showoncombobox' => 1,
'comment' =>
"Reference of object",
'showonheader' => 1,),
101 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'enabled' => 1,
'position' => 15,
'notnull' => 1,
'visible' => -2,
'default' =>
'1',
'index' => 1,),
103 'fk_type' => array(
'type' =>
'integer:PartnershipType:partnership/class/partnership_type.class.php:0:(active:=:1)',
'label' =>
'Type',
'enabled' => 1,
'position' => 20,
'notnull' => 1,
'visible' => 5,
'csslist' =>
'',),
104 'fk_soc' => array(
'type' =>
'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))',
'label' =>
'ThirdParty',
'picto' =>
'company',
'enabled' => 1,
'position' => 50,
'notnull' => -1,
'visible' => 5,
'index' => 1,
'css' =>
'',
'csslist' =>
'',),
105 'note_public' => array(
'type' =>
'html',
'label' =>
'NotePublic',
'enabled' => 1,
'position' => 61,
'notnull' => 0,
'visible' => 0,),
106 'note_private' => array(
'type' =>
'html',
'label' =>
'NotePrivate',
'enabled' => 1,
'position' => 62,
'notnull' => 0,
'visible' => 0,),
107 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'position' => 500,
'notnull' => 1,
'visible' => -2,),
108 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'position' => 501,
'notnull' => 0,
'visible' => -2,),
109 'fk_user_creat' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserAuthor',
'enabled' => 1,
'position' => 510,
'notnull' => 1,
'visible' => -2,
'foreignkey' =>
'user.rowid',),
110 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserModif',
'enabled' => 1,
'position' => 511,
'notnull' => -1,
'visible' => -2,),
111 'last_main_doc' => array(
'type' =>
'varchar(255)',
'label' =>
'LastMainDoc',
'enabled' => 1,
'position' => 600,
'notnull' => 0,
'visible' => 0,),
112 'import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'position' => 1000,
'notnull' => -1,
'visible' => -2,),
113 'model_pdf' => array(
'type' =>
'varchar(255)',
'label' =>
'Model pdf',
'enabled' => 1,
'position' => 1010,
'notnull' => -1,
'visible' => 0,),
114 'date_partnership_start' => array(
'type' =>
'date',
'label' =>
'DatePartnershipStart',
'enabled' => 1,
'position' => 52,
'notnull' => 1,
'visible' => 5,),
115 'date_partnership_end' => array(
'type' =>
'date',
'label' =>
'DatePartnershipEnd',
'enabled' => 1,
'position' => 53,
'notnull' => 0,
'visible' => 5,),
116 'url_to_check' => array(
'type' =>
'varchar(255)',
'label' =>
'UrlToCheck',
'enabled' => 1,
'position' => 70,
'notnull' => 0,
'visible' => -5,),
117 'count_last_url_check_error' => array(
'type' =>
'integer',
'label' =>
'CountLastUrlCheckError',
'enabled' => 1,
'position' => 71,
'notnull' => 0,
'visible' => -2,
'default' =>
'0',),
118 'last_check_backlink' => array(
'type' =>
'datetime',
'label' =>
'LastCheckBacklink',
'enabled' => 1,
'position' => 72,
'notnull' => 0,
'visible' => -2,),
119 'reason_decline_or_cancel' => array(
'type' =>
'text',
'label' =>
'ReasonDeclineOrCancel',
'enabled' => 1,
'position' => 73,
'notnull' => 0,
'visible' => -2,),
120 'ip' => array(
'type' =>
'varchar(250)',
'label' =>
'Ip',
'enabled' => 1,
'position' => 74,
'notnull' => 0,
'visible' => -2,),
122 'status' => array(
'type' =>
'smallint',
'label' =>
'Status',
'enabled' => 1,
'position' => 2000,
'notnull' => 1,
'visible' => 5,
'default' =>
'0',
'index' => 1,
'arrayofkeyval' => self::ARRAY_STATUS_LABEL,
'showonheader' => 1,),
152 if (!$this->partnership_static) {
153 $this->partnership_static =
new Partnership($this->db);
156 return $this->partnership_static;
170 $this->isextrafieldmanaged = 0;
175 if (is_object($langs)) {
176 foreach ($this->fields as $key => $val) {
177 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
178 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
179 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
194 global
$conf, $langs;
199 return [
'optimize' => $langs->trans(
"WebPortalPartnership")];
201 $datas[
'picto'] =
img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"WebPortalPartnership") .
'</u>';
202 if (isset($this->
status)) {
205 $datas[
'ref'] .=
'<br><b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
220 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
222 global
$conf, $langs, $hookmanager;
224 if (!empty(
$conf->dol_no_mouse_hover)) {
233 'objecttype' => $this->element,
236 $classfortooltip =
'classfortooltip';
239 $classfortooltip =
'classforajaxtooltip';
249 if ($option !=
'nolink') {
251 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
252 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
253 $add_save_lastsearch_values = 1;
255 if ($add_save_lastsearch_values) {
256 $url .=
'&save_lastsearch_values=1';
261 if (empty($notooltip)) {
263 $label = $langs->trans(
"ShowPartnership");
266 $linkclose .= ($label ?
' title="' .
dol_escape_htmltag($label, 1) .
'"' :
' title="tocomplete"');
267 $linkclose .= $dataparams .
' class="' . $classfortooltip . ($morecss ?
' ' . $morecss :
'') .
'"';
269 $linkclose = ($morecss ?
' class="' . $morecss .
'"' :
'');
272 if ($option ==
'nolink') {
273 $linkstart =
'<span';
275 $linkstart =
'<a href="' . $url .
'"';
277 $linkstart .= $linkclose .
'>';
278 if ($option ==
'nolink') {
279 $linkend =
'</span>';
284 $result .= $linkstart;
286 if (empty($this->showphoto_on_popup)) {
288 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') : $dataparams .
' class="' . (($withpicto != 2) ?
'paddingright ' :
'') . $classfortooltip .
'"'), 0, 0, $notooltip ? 0 : 1);
292 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
294 list($class, $module) = explode(
'@', $this->picto);
297 $filename = $filearray[0][
'name'];
298 if (!empty($filename)) {
299 $pospoint = strpos($filearray[0][
'name'],
'.');
301 $pathtophoto = $class .
'/' . $this->
ref .
'/thumbs/' . substr($filename, 0, $pospoint) .
'_mini' . substr($filename, $pospoint);
302 if (!
getDolGlobalString(strtoupper($module .
'_' . $class) .
'_FORMATLISTPHOTOSASUSERS')) {
303 $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>';
305 $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>';
310 $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);
315 if ($withpicto != 2) {
316 $result .= $this->ref;
322 global $action, $hookmanager;
323 $hookmanager->initHooks(array(
'partnershipdao'));
324 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
325 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
327 $result = $hookmanager->resPrint;
329 $result .= $hookmanager->resPrint;
Class to manage Dolibarr database access.
Class for WebPortalPartnership.
getLibStatut($mode=0)
Return the label of the status.
LibStatut($status, $mode=0)
Return the status.
getTooltipContentArray($params)
getTooltipContentArray
__construct(DoliDB $db)
Constructor.
const ARRAY_STATUS_LABEL
Status list (short label)
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
getPartnershipStatic()
Get partnership for static method.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
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)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...