31include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
52 $this->numero = 58000;
55 $this->rights_class =
'partnership';
59 $this->family =
"crm";
62 $this->module_position =
'90';
67 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
72 $this->descriptionlong =
"PartnershipDescriptionLong";
79 $this->version =
'dolibarr';
84 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
90 $this->picto =
'partnership';
93 $this->module_parts = array(
129 'moduleforexternal' => 0,
134 $this->dirs = array(
"/partnership/temp");
137 $this->config_page_url = array(
"setup.php@partnership");
141 $this->hidden =
false;
143 $this->depends = array();
144 $this->requiredby = array();
145 $this->conflictwith = array();
148 $this->langfiles = array(
"partnership");
151 $this->phpmin = array(7, 0);
152 $this->need_dolibarr_version = array(11, -3);
155 $this->warnings_activation = array();
156 $this->warnings_activation_ext = array();
165 $this->
const = array();
173 if (!isset($conf->partnership) || !isset($conf->partnership->enabled)) {
174 $conf->partnership =
new stdClass();
175 $conf->partnership->enabled = 0;
179 $this->tabs = array();
182 if ($tabtoadd ==
'member') {
183 $fk_mainmenu =
"members";
185 $fk_mainmenu =
"companies";
215 $this->dictionaries = array(
216 'langs' =>
'partnership',
218 'tabname' => array(
"c_partnership_type"),
220 'tablib' => array(
"PartnershipType"),
222 'tabsql' => array(
'SELECT f.rowid as rowid, f.code, f.label, f.keyword, f.active FROM '.MAIN_DB_PREFIX.
'c_partnership_type as f WHERE f.entity = '.((
int) $conf->entity)),
224 'tabsqlsort' => array(
"label ASC"),
226 'tabfield' => array(
"code,label,keyword"),
228 'tabfieldvalue' => array(
"code,label,keyword"),
230 'tabfieldinsert' => array(
"code,label,keyword"),
232 'tabrowid' => array(
"rowid"),
234 'tabcond' => array($conf->partnership->enabled),
236 'tabhelp' => array(array(
'keyword' => $langs->trans(
'KeywordToCheckInWebsite')))
241 $this->boxes = array(
254 $datestart =
dol_mktime(21, 15, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
256 $this->cronjobs = array(
259 'label' =>
'CancelPartnershipForExpiredMembers',
260 'jobtype' =>
'method',
261 'class' =>
'/partnership/class/partnershiputils.class.php',
262 'objectname' =>
'PartnershipUtils',
263 'method' =>
'doCancelStatusOfMemberPartnership',
265 'comment' =>
'Cancel status of partnership when subscription is expired + x days.',
267 'unitfrequency' => 86400,
269 'test' =>
'isModEnabled("partnership")',
270 'datestart' => $datestart
274 'label' =>
'PartnershipCheckBacklink',
275 'jobtype' =>
'method',
276 'class' =>
'/partnership/class/partnershiputils.class.php',
277 'objectname' =>
'PartnershipUtils',
278 'method' =>
'doWarningOfPartnershipIfDolibarrBacklinkNotfound',
280 'comment' =>
'Add a warning on partnership record if the backlink keyword is not found on the partner website.',
282 'unitfrequency' => 86400,
284 'test' =>
'isModEnabled("partnership")',
285 'datestart' => $datestart
290 $this->rights = array();
294 $this->rights[$r][0] = $this->numero + $r;
295 $this->rights[$r][1] =
'Read objects of Partnership';
296 $this->rights[$r][4] =
'read';
298 $this->rights[$r][0] = $this->numero + $r;
299 $this->rights[$r][1] =
'Create/Update objects of Partnership';
300 $this->rights[$r][4] =
'write';
302 $this->rights[$r][0] = $this->numero + $r;
303 $this->rights[$r][1] =
'Delete objects of Partnership';
304 $this->rights[$r][4] =
'delete';
309 $this->menu = array();
333 $this->menu[$r++] = array(
334 'fk_menu' =>
'fk_mainmenu='.$fk_mainmenu,
336 'titre' =>
'Partnership',
337 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
338 'mainmenu' => $fk_mainmenu,
339 'leftmenu' =>
'partnership',
340 'url' =>
'/partnership/partnership_list.php',
341 'langs' =>
'partnership',
342 'position' => 1100 + $r,
343 'enabled' =>
'$conf->partnership->enabled',
344 'perms' =>
'$user->rights->partnership->read',
348 $this->menu[$r++] = array(
349 'fk_menu' =>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
351 'titre' =>
'NewPartnership',
352 'mainmenu' => $fk_mainmenu,
353 'leftmenu' =>
'partnership_new',
354 'url' =>
'/partnership/partnership_card.php?action=create',
355 'langs' =>
'partnership',
356 'position' => 1100 + $r,
357 'enabled' =>
'$conf->partnership->enabled',
358 'perms' =>
'$user->rights->partnership->write',
362 $this->menu[$r++] = array(
363 'fk_menu' =>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
365 'titre' =>
'ListOfPartnerships',
366 'mainmenu' => $fk_mainmenu,
367 'leftmenu' =>
'partnership_list',
368 'url' =>
'/partnership/partnership_list.php',
369 'langs' =>
'partnership',
370 'position' => 1100 + $r,
371 'enabled' =>
'$conf->partnership->enabled',
372 'perms' =>
'$user->rights->partnership->read',
437 public function init($options =
'')
439 global $conf, $langs;
441 $result = $this->
_load_tables(
'/install/mysql/',
'partnership');
456 $this->
remove($options);
462 $myTmpObjects = array();
463 $myTmpObjects[
'Partnership'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
465 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
466 if ($myTmpObjectKey ==
'Partnership') {
469 if ($myTmpObjectArray[
'includerefgeneration']) {
470 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_partnerships.odt';
471 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
472 $dest = $dirodt.
'/template_partnerships.odt';
474 if (file_exists($src) && !file_exists($dest)) {
475 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
477 $result =
dol_copy($src, $dest, 0, 0);
479 $langs->load(
"errors");
480 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
485 $sql = array_merge($sql, array(
486 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
487 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
488 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
489 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
494 return $this->
_init($sql, $options);
505 public function remove($options =
'')
508 return $this->
_remove($sql, $options);
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Description and activation class for module Partnership This module is base on this specification : h...
init($options='')
Function called when module is enabled.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_copy($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_now($mode='auto')
Return date for now.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.