30include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
51 $this->numero = 58000;
54 $this->rights_class =
'partnership';
58 $this->family =
"crm";
61 $this->module_position =
'90';
66 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
71 $this->descriptionlong =
"PartnershipDescriptionLong";
78 $this->version =
'dolibarr';
83 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
89 $this->picto =
'partnership';
92 $this->module_parts = array(
128 'moduleforexternal' => 0,
133 $this->dirs = array(
"/partnership/temp");
136 $this->config_page_url = array(
"setup.php@partnership");
140 $this->hidden =
false;
142 $this->depends = array();
143 $this->requiredby = array();
144 $this->conflictwith = array();
147 $this->langfiles = array(
"partnership");
150 $this->phpmin = array(7, 0);
151 $this->need_dolibarr_version = array(11, -3);
154 $this->warnings_activation = array();
155 $this->warnings_activation_ext = array();
164 $this->
const = array();
172 if (!isset($conf->partnership) || !isset($conf->partnership->enabled)) {
173 $conf->partnership =
new stdClass();
174 $conf->partnership->enabled = 0;
178 $this->tabs = array();
181 if ($tabtoadd ==
'member') {
182 $fk_mainmenu =
"members";
184 $fk_mainmenu =
"companies";
214 $this->dictionaries=array(
215 'langs'=>
'partnership',
217 'tabname'=>array(
"c_partnership_type"),
219 'tablib'=>array(
"PartnershipType"),
221 '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)),
223 'tabsqlsort'=>array(
"label ASC"),
225 'tabfield'=>array(
"code,label,keyword"),
227 'tabfieldvalue'=>array(
"code,label,keyword"),
229 'tabfieldinsert'=>array(
"code,label,keyword"),
231 'tabrowid'=>array(
"rowid"),
233 'tabcond'=>array($conf->partnership->enabled),
235 'tabhelp'=>array(array(
'keyword'=>$langs->trans(
'KeywordToCheckInWebsite')))
240 $this->boxes = array(
253 $datestart=
dol_mktime(21, 15, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
255 $this->cronjobs = array(
258 'label'=>
'CancelPartnershipForExpiredMembers',
260 'class'=>
'/partnership/class/partnershiputils.class.php',
261 'objectname'=>
'PartnershipUtils',
262 'method'=>
'doCancelStatusOfMemberPartnership',
264 'comment'=>
'Cancel status of partnership when subscription is expired + x days.',
266 'unitfrequency'=>86400,
268 'test'=>
'isModEnabled("partnership")',
269 'datestart'=>$datestart
273 'label'=>
'PartnershipCheckBacklink',
275 'class'=>
'/partnership/class/partnershiputils.class.php',
276 'objectname'=>
'PartnershipUtils',
277 'method'=>
'doWarningOfPartnershipIfDolibarrBacklinkNotfound',
279 'comment'=>
'Add a warning on partnership record if the backlink keyword is not found on the partner website.',
281 'unitfrequency'=>86400,
283 'test'=>
'isModEnabled("partnership")',
284 'datestart'=>$datestart
289 $this->rights = array();
293 $this->rights[$r][0] = $this->numero + $r;
294 $this->rights[$r][1] =
'Read objects of Partnership';
295 $this->rights[$r][4] =
'read';
297 $this->rights[$r][0] = $this->numero + $r;
298 $this->rights[$r][1] =
'Create/Update objects of Partnership';
299 $this->rights[$r][4] =
'write';
301 $this->rights[$r][0] = $this->numero + $r;
302 $this->rights[$r][1] =
'Delete objects of Partnership';
303 $this->rights[$r][4] =
'delete';
308 $this->menu = array();
332 $this->menu[$r++] = array(
333 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu,
335 'titre'=>
'Partnership',
336 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
337 'mainmenu'=>$fk_mainmenu,
338 'leftmenu'=>
'partnership',
339 'url'=>
'/partnership/partnership_list.php',
340 'langs'=>
'partnership',
341 'position'=>1100 + $r,
342 'enabled'=>
'$conf->partnership->enabled',
343 'perms'=>
'$user->rights->partnership->read',
347 $this->menu[$r++] = array(
348 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
350 'titre'=>
'NewPartnership',
351 'mainmenu'=>$fk_mainmenu,
352 'leftmenu'=>
'partnership_new',
353 'url'=>
'/partnership/partnership_card.php?action=create',
354 'langs'=>
'partnership',
355 'position'=>1100 + $r,
356 'enabled'=>
'$conf->partnership->enabled',
357 'perms'=>
'$user->rights->partnership->write',
361 $this->menu[$r++] = array(
362 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
364 'titre'=>
'ListOfPartnerships',
365 'mainmenu'=>$fk_mainmenu,
366 'leftmenu'=>
'partnership_list',
367 'url'=>
'/partnership/partnership_list.php',
368 'langs'=>
'partnership',
369 'position'=>1100 + $r,
370 'enabled'=>
'$conf->partnership->enabled',
371 'perms'=>
'$user->rights->partnership->read',
436 public function init($options =
'')
438 global $conf, $langs;
440 $result = $this->
_load_tables(
'/install/mysql/',
'partnership');
455 $this->
remove($options);
461 $myTmpObjects = array();
462 $myTmpObjects[
'Partnership'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
464 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
465 if ($myTmpObjectKey ==
'Partnership') {
468 if ($myTmpObjectArray[
'includerefgeneration']) {
469 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_partnerships.odt';
470 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
471 $dest = $dirodt.
'/template_partnerships.odt';
473 if (file_exists($src) && !file_exists($dest)) {
474 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
476 $result =
dol_copy($src, $dest, 0, 0);
478 $langs->load(
"errors");
479 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
484 $sql = array_merge($sql, array(
485 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
486 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
487 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
488 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
493 return $this->
_init($sql, $options);
504 public function remove($options =
'')
507 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 informations (by default a local PHP server timestamp) Re...
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.