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(
256 0 => array(
'priority'=>60,
'label'=>
'CancelPartnershipForExpiredMembers',
'jobtype'=>
'method',
'class'=>
'/partnership/class/partnershiputils.class.php',
'objectname'=>
'PartnershipUtils',
'method'=>
'doCancelStatusOfMemberPartnership',
'parameters'=>
'',
'comment'=>
'Cancel status of partnership when subscription is expired + x days.',
'frequency'=>1,
'unitfrequency'=>86400,
'status'=>1,
'test'=>
'$conf->partnership->enabled',
'datestart'=>$datestart),
257 1 => array(
'priority'=>61,
'label'=>
'PartnershipCheckBacklink',
'jobtype'=>
'method',
'class'=>
'/partnership/class/partnershiputils.class.php',
'objectname'=>
'PartnershipUtils',
'method'=>
'doWarningOfPartnershipIfDolibarrBacklinkNotfound',
'parameters'=>
'',
'comment'=>
'Warning of partnership if Dolibarr backlink not found on partner website.',
'frequency'=>1,
'unitfrequency'=>86400,
'status'=>0,
'test'=>
'$conf->partnership->enabled',
'datestart'=>$datestart),
261 $this->rights = array();
265 $this->rights[$r][0] = $this->numero + $r;
266 $this->rights[$r][1] =
'Read objects of Partnership';
267 $this->rights[$r][4] =
'read';
269 $this->rights[$r][0] = $this->numero + $r;
270 $this->rights[$r][1] =
'Create/Update objects of Partnership';
271 $this->rights[$r][4] =
'write';
273 $this->rights[$r][0] = $this->numero + $r;
274 $this->rights[$r][1] =
'Delete objects of Partnership';
275 $this->rights[$r][4] =
'delete';
280 $this->menu = array();
304 $this->menu[$r++] = array(
305 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu,
307 'titre'=>
'Partnership',
308 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
309 'mainmenu'=>$fk_mainmenu,
310 'leftmenu'=>
'partnership',
311 'url'=>
'/partnership/partnership_list.php',
312 'langs'=>
'partnership',
313 'position'=>1100 + $r,
314 'enabled'=>
'$conf->partnership->enabled',
315 'perms'=>
'$user->rights->partnership->read',
319 $this->menu[$r++] = array(
320 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
322 'titre'=>
'NewPartnership',
323 'mainmenu'=>$fk_mainmenu,
324 'leftmenu'=>
'partnership_new',
325 'url'=>
'/partnership/partnership_card.php?action=create',
326 'langs'=>
'partnership',
327 'position'=>1100 + $r,
328 'enabled'=>
'$conf->partnership->enabled',
329 'perms'=>
'$user->rights->partnership->write',
333 $this->menu[$r++] = array(
334 'fk_menu'=>
'fk_mainmenu='.$fk_mainmenu.
',fk_leftmenu=partnership',
336 'titre'=>
'ListOfPartnerships',
337 'mainmenu'=>$fk_mainmenu,
338 'leftmenu'=>
'partnership_list',
339 'url'=>
'/partnership/partnership_list.php',
340 'langs'=>
'partnership',
341 'position'=>1100 + $r,
342 'enabled'=>
'$conf->partnership->enabled',
343 'perms'=>
'$user->rights->partnership->read',
408 public function init($options =
'')
410 global $conf, $langs;
412 $result = $this->
_load_tables(
'/install/mysql/',
'partnership');
427 $this->
remove($options);
433 $myTmpObjects = array();
434 $myTmpObjects[
'Partnership'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
436 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
437 if ($myTmpObjectKey ==
'Partnership') {
440 if ($myTmpObjectArray[
'includerefgeneration']) {
441 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_partnerships.odt';
442 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
443 $dest = $dirodt.
'/template_partnerships.odt';
445 if (file_exists($src) && !file_exists($dest)) {
446 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
448 $result =
dol_copy($src, $dest, 0, 0);
450 $langs->load(
"errors");
451 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
456 $sql = array_merge($sql, array(
457 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
458 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
459 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
460 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
465 return $this->
_init($sql, $options);
476 public function remove($options =
'')
479 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.