Merge pull request #12389 from Dolibarr/scrutinizer-patch-5
Scrutinizer Auto-Fixes
This commit is contained in:
commit
89ecd6a72a
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
|
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
|
||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$value = GETPOST('value', 'alpha');
|
$value = GETPOST('value', 'alpha');
|
||||||
@ -47,14 +47,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
|||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstbom=GETPOST('maskconstBom', 'alpha');
|
$maskconstbom = GETPOST('maskconstBom', 'alpha');
|
||||||
$maskbom=GETPOST('maskBom', 'alpha');
|
$maskbom = GETPOST('maskBom', 'alpha');
|
||||||
|
|
||||||
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
|
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -66,20 +66,20 @@ if ($action == 'updateMask')
|
|||||||
|
|
||||||
elseif ($action == 'specimen')
|
elseif ($action == 'specimen')
|
||||||
{
|
{
|
||||||
$modele=GETPOST('module', 'alpha');
|
$modele = GETPOST('module', 'alpha');
|
||||||
|
|
||||||
$bom = new BOM($db);
|
$bom = new BOM($db);
|
||||||
$bom->initAsSpecimen();
|
$bom->initAsSpecimen();
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file = ''; $classname = ''; $filefound = 0;
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$file=dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
|
$file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound = 1;
|
||||||
$classname = "pdf_".$modele;
|
$classname = "pdf_".$modele;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -155,9 +155,9 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
|
|||||||
$draft = GETPOST("BOM_DRAFT_WATERMARK");
|
$draft = GETPOST("BOM_DRAFT_WATERMARK");
|
||||||
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -169,13 +169,13 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
|
|||||||
|
|
||||||
elseif ($action == 'set_BOM_FREE_TEXT')
|
elseif ($action == 'set_BOM_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -190,13 +190,13 @@ elseif ($action == 'set_BOM_FREE_TEXT')
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
llxHeader("", $langs->trans("BOMsSetup"));
|
llxHeader("", $langs->trans("BOMsSetup"));
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = bomAdminPrepareHead();
|
$head = bomAdminPrepareHead();
|
||||||
@ -229,18 +229,18 @@ foreach ($dirmodels as $reldir)
|
|||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file)-4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.$file.'.php';
|
||||||
|
|
||||||
$module = new $file($db);
|
$module = new $file($db);
|
||||||
|
|
||||||
// Show modules according to features level
|
// Show modules according to features level
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||||
|
|
||||||
if ($module->isEnabled())
|
if ($module->isEnabled())
|
||||||
@ -251,9 +251,9 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
// Show example of numbering model
|
// Show example of numbering model
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$tmp=$module->getExample();
|
$tmp = $module->getExample();
|
||||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||||
else print $tmp;
|
else print $tmp;
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
@ -270,22 +270,22 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$bom=new BOM($db);
|
$bom = new BOM($db);
|
||||||
$bom->initAsSpecimen();
|
$bom->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip='';
|
$htmltooltip = '';
|
||||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$bom->type=0;
|
$bom->type = 0;
|
||||||
$nextval=$module->getNextValue($mysoc, $bom);
|
$nextval = $module->getNextValue($mysoc, $bom);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval) {
|
if ($nextval) {
|
||||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||||
$nextval = $langs->trans($nextval);
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip.=$nextval.'<br>';
|
$htmltooltip .= $nextval.'<br>';
|
||||||
} else {
|
} else {
|
||||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,14 +313,14 @@ print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
|
|||||||
// Load array def with activated templates
|
// Load array def with activated templates
|
||||||
$def = array();
|
$def = array();
|
||||||
$sql = "SELECT nom";
|
$sql = "SELECT nom";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql.= " WHERE type = '".$type."'";
|
$sql .= " WHERE type = '".$type."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$resql=$db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$num_rows=$db->num_rows($resql);
|
$num_rows = $db->num_rows($resql);
|
||||||
while ($i < $num_rows)
|
while ($i < $num_rows)
|
||||||
{
|
{
|
||||||
$array = $db->fetch_array($resql);
|
$array = $db->fetch_array($resql);
|
||||||
@ -348,43 +348,43 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
foreach (array('','/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle=opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
$filelist[]=$file;
|
$filelist[] = $file;
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
arsort($filelist);
|
arsort($filelist);
|
||||||
|
|
||||||
foreach($filelist as $file)
|
foreach ($filelist as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||||
{
|
{
|
||||||
if (file_exists($dir.'/'.$file))
|
if (file_exists($dir.'/'.$file))
|
||||||
{
|
{
|
||||||
$name = substr($file, 4, dol_strlen($file) -16);
|
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||||
|
|
||||||
require_once $dir.'/'.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
$modulequalified=1;
|
$modulequalified = 1;
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||||
|
|
||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr class="oddeven"><td width="100">';
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print (empty($module->name)?$name:$module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
@ -419,15 +419,15 @@ foreach ($dirmodels as $reldir)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
if ($module->type == 'pdf')
|
if ($module->type == 'pdf')
|
||||||
{
|
{
|
||||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
@ -471,18 +471,18 @@ print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
|||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||||
$htmltext.='</i>';
|
$htmltext .= '</i>';
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
|
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
|
||||||
print '<tr class="oddeven"><td colspan="2">';
|
print '<tr class="oddeven"><td colspan="2">';
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||||
$variablename='BOM_FREE_TEXT';
|
$variablename = 'BOM_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
{
|
{
|
||||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||||
@ -490,7 +490,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td class="right">';
|
print '</td><td class="right">';
|
||||||
|
|||||||
@ -30,44 +30,44 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("mrp","other"));
|
$langs->loadLangs(array("mrp", "other"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$cancel = GETPOST('cancel', 'aZ09');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomcard'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object=new BOM($db);
|
$object = new BOM($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
|
$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id;
|
||||||
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
// Initialize array of search criterias
|
// Initialize array of search criterias
|
||||||
$search_all=trim(GETPOST("search_all", 'alpha'));
|
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||||
$search=array();
|
$search = array();
|
||||||
foreach($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
|
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||||
|
|
||||||
// Security check - Protection if external user
|
// Security check - Protection if external user
|
||||||
//if ($user->socid > 0) access_forbidden();
|
//if ($user->socid > 0) access_forbidden();
|
||||||
@ -85,13 +85,13 @@ $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array();
|
$parameters = array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ if (empty($reshook))
|
|||||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
// Actions cancel, add, update, delete or clone
|
// Actions cancel, add, update, delete or clone
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||||
@ -118,9 +118,9 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$trigger_name='BOM_SENTBYMAIL';
|
$trigger_name = 'BOM_SENTBYMAIL';
|
||||||
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
|
$autocopy = 'MAIN_MAIL_AUTOCOPY_BOM_TO';
|
||||||
$trackid='bom'.$object->id;
|
$trackid = 'bom'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
// Add line
|
// Add line
|
||||||
@ -140,12 +140,12 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! ($idprod > 0)) {
|
if (!($idprod > 0)) {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$bomline = new BOMLine($db);
|
$bomline = new BOMLine($db);
|
||||||
$bomline->fk_bom = $id;
|
$bomline->fk_bom = $id;
|
||||||
@ -176,10 +176,10 @@ if (empty($reshook))
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Set if we used free entry or predefined product
|
// Set if we used free entry or predefined product
|
||||||
$qty=GETPOST('qty', 'int');
|
$qty = GETPOST('qty', 'int');
|
||||||
$qty_frozen = GETPOST('qty_frozen', 'int');
|
$qty_frozen = GETPOST('qty_frozen', 'int');
|
||||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||||
$efficiency=GETPOST('efficiency', 'int');
|
$efficiency = GETPOST('efficiency', 'int');
|
||||||
|
|
||||||
if ($qty == '') {
|
if ($qty == '') {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||||
@ -212,8 +212,8 @@ if (empty($reshook))
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$formfile=new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("BOM"), '');
|
llxHeader('', $langs->trans("BOM"), '');
|
||||||
|
|
||||||
@ -248,10 +248,10 @@ if ($action == 'create')
|
|||||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ if ($action == 'create')
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
print '<input type="'.($backtopage ? "submit" : "button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -284,10 +284,10 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Confirmation to delete
|
// Confirmation to delete
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
|
||||||
}
|
}
|
||||||
// Confirmation to delete line
|
// Confirmation to delete line
|
||||||
if ($action == 'deleteline')
|
if ($action == 'deleteline')
|
||||||
@ -342,14 +342,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
|
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$formquestion=array();
|
$formquestion = array();
|
||||||
if (! empty($conf->bom->enabled))
|
if (!empty($conf->bom->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("mrp");
|
$langs->load("mrp");
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
$forcecombo=0;
|
$forcecombo = 0;
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
@ -357,7 +357,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of closing
|
// Confirmation of closing
|
||||||
@ -372,14 +372,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$formquestion=array();
|
$formquestion = array();
|
||||||
if (! empty($conf->bom->enabled))
|
if (!empty($conf->bom->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("mrp");
|
$langs->load("mrp");
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
$forcecombo=0;
|
$forcecombo = 0;
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
@ -387,7 +387,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of reopen
|
// Confirmation of reopen
|
||||||
@ -402,14 +402,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$formquestion=array();
|
$formquestion = array();
|
||||||
if (! empty($conf->bom->enabled))
|
if (!empty($conf->bom->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("mrp");
|
$langs->load("mrp");
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
$forcecombo=0;
|
$forcecombo = 0;
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
@ -417,14 +417,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone confirmation
|
// Clone confirmation
|
||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array();
|
$formquestion = array();
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of action xxxx
|
// Confirmation of action xxxx
|
||||||
@ -432,15 +432,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
{
|
{
|
||||||
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
||||||
|
|
||||||
$formquestion=array();
|
$formquestion = array();
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Hook formConfirm
|
// Call Hook formConfirm
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
@ -448,9 +448,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
// Object card
|
// Object card
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="'.dol_buildpath('/bom/bom_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
/*
|
/*
|
||||||
// Ref bis
|
// Ref bis
|
||||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1);
|
||||||
@ -488,7 +488,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
@ -500,11 +500,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<table class="border centpercent tableforfield">'."\n";
|
print '<table class="border centpercent tableforfield">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
$keyforbreak='description';
|
$keyforbreak = 'description';
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -574,8 +574,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
if ($action != 'presend' && $action != 'editline') {
|
if ($action != 'presend' && $action != 'editline') {
|
||||||
print '<div class="tabsAction">'."\n";
|
print '<div class="tabsAction">'."\n";
|
||||||
$parameters=array();
|
$parameters = array();
|
||||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
@ -585,7 +585,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
|
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
@ -668,11 +668,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
// Documents
|
// Documents
|
||||||
$objref = dol_sanitizeFileName($object->ref);
|
$objref = dol_sanitizeFileName($object->ref);
|
||||||
$relativepath = $objref . '/' . $objref . '.pdf';
|
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||||
$filedir = $conf->bom->dir_output . '/' . $objref;
|
$filedir = $conf->bom->dir_output.'/'.$objref;
|
||||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
|
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
|
||||||
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
|
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
|
||||||
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
@ -685,11 +685,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$MAXEVENT = 10;
|
$MAXEVENT = 10;
|
||||||
|
|
||||||
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
|
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
|
||||||
$morehtmlright.= $langs->trans("SeeAll");
|
$morehtmlright .= $langs->trans("SeeAll");
|
||||||
$morehtmlright.= '</a>';
|
$morehtmlright .= '</a>';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
$somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||||
|
|
||||||
@ -700,8 +700,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (GETPOST('modelselected')) $action = 'presend';
|
if (GETPOST('modelselected')) $action = 'presend';
|
||||||
|
|
||||||
// Presend form
|
// Presend form
|
||||||
$modelmail='bom';
|
$modelmail = 'bom';
|
||||||
$defaulttopic='InformationMessage';
|
$defaulttopic = 'InformationMessage';
|
||||||
$diroutput = $conf->bom->dir_output;
|
$diroutput = $conf->bom->dir_output;
|
||||||
$trackid = 'bom'.$object->id;
|
$trackid = 'bom'.$object->id;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,7 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
|||||||
$result = $object->set_unpaid($user);
|
$result = $object->set_unpaid($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -108,7 +108,7 @@ if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
|||||||
// bank account
|
// bank account
|
||||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
|||||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->delete($user);
|
$result = $object->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: list.php");
|
header("Location: list.php");
|
||||||
@ -134,22 +134,22 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
|
|||||||
// Add social contribution
|
// Add social contribution
|
||||||
if ($action == 'add' && $user->rights->tax->charges->creer)
|
if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$dateech=dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear'));
|
$dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear'));
|
||||||
$dateperiod=dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear'));
|
$dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear'));
|
||||||
$amount=price2num(GETPOST('amount'));
|
$amount = price2num(GETPOST('amount'));
|
||||||
$actioncode=GETPOST('actioncode');
|
$actioncode = GETPOST('actioncode');
|
||||||
|
|
||||||
if (! $dateech)
|
if (!$dateech)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
elseif (! $dateperiod)
|
elseif (!$dateperiod)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
elseif (! $actioncode > 0)
|
elseif (!$actioncode > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
@ -206,20 +206,20 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
elseif (! is_numeric($amount))
|
elseif (!is_numeric($amount))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$object->date_ech = $dateech;
|
$object->date_ech = $dateech;
|
||||||
$object->periode = $dateperiod;
|
$object->periode = $dateperiod;
|
||||||
$object->amount = price2num($amount);
|
$object->amount = price2num($amount);
|
||||||
|
|
||||||
$result=$object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -228,7 +228,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm != 'yes') { $action=''; }
|
if ($action == 'confirm_clone' && $confirm != 'yes') { $action = ''; }
|
||||||
|
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer))
|
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer))
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$id=$originalId;
|
$id = $originalId;
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -299,10 +299,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formsocialcontrib = new FormSocialContrib($db);
|
$formsocialcontrib = new FormSocialContrib($db);
|
||||||
$bankaccountstatic = new Account($db);
|
$bankaccountstatic = new Account($db);
|
||||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||||
|
|
||||||
$title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Card");
|
$title = $langs->trans("SocialContribution").' - '.$langs->trans("Card");
|
||||||
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
||||||
llxHeader("", $title, $help_url);
|
llxHeader("", $title, $help_url);
|
||||||
|
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ if ($action == 'create')
|
|||||||
print $langs->trans("Type");
|
print $langs->trans("Type");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode", 'alpha')?GETPOST("actioncode", 'alpha'):'', 'actioncode', 1);
|
$formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode", 'alpha') ?GETPOST("actioncode", 'alpha') : '', 'actioncode', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ if ($action == 'create')
|
|||||||
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
|
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectDate(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
print $form->selectDate(!empty($dateperiod) ? $dateperiod : '-1', 'period', 0, 0, 0, 'charge', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ if ($action == 'create')
|
|||||||
print $langs->trans("DateDue");
|
print $langs->trans("DateDue");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectDate(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -366,29 +366,29 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (!empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$formproject=new FormProjets($db);
|
$formproject = new FormProjets($db);
|
||||||
|
|
||||||
// Associated project
|
// Associated project
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
$numproject=$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
$numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment Mode
|
// Payment Mode
|
||||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank Account
|
// Bank Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
|
||||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ if ($action == 'create')
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -414,28 +414,28 @@ if ($action == 'create')
|
|||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$object = new ChargeSociales($db);
|
$object = new ChargeSociales($db);
|
||||||
$result=$object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$head=tax_prepare_head($object);
|
$head = tax_prepare_head($object);
|
||||||
|
|
||||||
$totalpaye = $object->getSommePaiement();
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
// Clone confirmation
|
// Clone confirmation
|
||||||
if ($action === 'clone')
|
if ($action === 'clone')
|
||||||
{
|
{
|
||||||
$formquestion=array(
|
$formquestion = array(
|
||||||
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
|
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
|
||||||
);
|
);
|
||||||
if (! empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX))
|
if (!empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX))
|
||||||
{
|
{
|
||||||
$formquestion[]=array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
|
$formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$formquestion[]=array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
|
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
|
||||||
$formquestion[]=array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1);
|
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("DateDue"), 'value' => -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
@ -558,18 +558,18 @@ if ($id > 0)
|
|||||||
print $langs->trans('PaymentMode');
|
print $langs->trans('PaymentMode');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editmode')
|
if ($action != 'editmode')
|
||||||
print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editmode') {
|
if ($action == 'editmode') {
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||||
} else {
|
} else {
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank Account
|
// Bank Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
@ -595,25 +595,25 @@ if ($id > 0)
|
|||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
|
|
||||||
$nbcols = 3;
|
$nbcols = 3;
|
||||||
if (! empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
$nbcols ++;
|
$nbcols++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Payments
|
* Payments
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||||
$sql.= " c.code as type_code,c.libelle as paiement_type,";
|
$sql .= " c.code as type_code,c.libelle as paiement_type,";
|
||||||
$sql.= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " WHERE p.fk_charge = ".$id;
|
$sql .= " WHERE p.fk_charge = ".$id;
|
||||||
$sql.= " AND p.fk_charge = cs.rowid";
|
$sql .= " AND p.fk_charge = cs.rowid";
|
||||||
$sql.= " AND cs.entity IN (".getEntity('tax').")";
|
$sql .= " AND cs.entity IN (".getEntity('tax').")";
|
||||||
$sql.= " ORDER BY dp DESC";
|
$sql .= " ORDER BY dp DESC";
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -624,14 +624,14 @@ if ($id > 0)
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print '<table class="noborder paymenttable">';
|
print '<table class="noborder paymenttable">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
if (! empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
print '<td class="liste_titre right">' . $langs->trans('BankAccount') . '</td>';
|
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
|
||||||
}
|
}
|
||||||
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -645,16 +645,16 @@ if ($id > 0)
|
|||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||||
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
|
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
|
||||||
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
|
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
|
||||||
if (! empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
$bankaccountstatic->id = $objp->baid;
|
$bankaccountstatic->id = $objp->baid;
|
||||||
$bankaccountstatic->ref = $objp->baref;
|
$bankaccountstatic->ref = $objp->baref;
|
||||||
$bankaccountstatic->label = $objp->baref;
|
$bankaccountstatic->label = $objp->baref;
|
||||||
$bankaccountstatic->number = $objp->banumber;
|
$bankaccountstatic->number = $objp->banumber;
|
||||||
|
|
||||||
if (! empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
$bankaccountstatic->account_number = $objp->account_number;
|
$bankaccountstatic->account_number = $objp->account_number;
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
@ -687,7 +687,7 @@ if ($id > 0)
|
|||||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||||
|
|
||||||
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
|
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
|
||||||
print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
|
print '<td class="right'.($resteapayer ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -730,7 +730,7 @@ if ($id > 0)
|
|||||||
// Reopen
|
// Reopen
|
||||||
if ($object->paye && $user->rights->tax->charges->creer)
|
if ($object->paye && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&action=reopen\">".$langs->trans("ReOpen")."</a></div>";
|
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1)."?id=$object->id&action=reopen\">".$langs->trans("ReOpen")."</a></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
@ -746,7 +746,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classify 'paid'
|
// Classify 'paid'
|
||||||
if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer)
|
if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&action=paid\">".$langs->trans("ClassifyPaid")."</a></div>";
|
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&action=paid\">".$langs->trans("ClassifyPaid")."</a></div>";
|
||||||
}
|
}
|
||||||
@ -754,7 +754,7 @@ if ($id > 0)
|
|||||||
// Clone
|
// Clone
|
||||||
if ($user->rights->tax->charges->creer)
|
if ($user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&action=clone\">".$langs->trans("ToClone")."</a></div>";
|
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1)."?id=$object->id&action=clone\">".$langs->trans("ToClone")."</a></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
|||||||
* \brief File of class to manage donations
|
* \brief File of class to manage donations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,12 +39,12 @@ class Don extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object
|
* @var string ID to identify managed object
|
||||||
*/
|
*/
|
||||||
public $element='don';
|
public $element = 'don';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element='don';
|
public $table_element = 'don';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Field with ID of parent key if this field has a parent
|
* @var int Field with ID of parent key if this field has a parent
|
||||||
@ -167,14 +167,14 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("donations");
|
$langs->load("donations");
|
||||||
$this->labelStatus[-1]=$langs->trans("Canceled");
|
$this->labelStatus[-1] = $langs->trans("Canceled");
|
||||||
$this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
$this->labelStatus[0] = $langs->trans("DonationStatusPromiseNotValidated");
|
||||||
$this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated");
|
$this->labelStatus[1] = $langs->trans("DonationStatusPromiseValidated");
|
||||||
$this->labelStatus[2]=$langs->trans("DonationStatusPaid");
|
$this->labelStatus[2] = $langs->trans("DonationStatusPaid");
|
||||||
$this->labelStatusShort[-1]=$langs->trans("Canceled");
|
$this->labelStatusShort[-1] = $langs->trans("Canceled");
|
||||||
$this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
$this->labelStatusShort[0] = $langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||||
$this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
$this->labelStatusShort[1] = $langs->trans("DonationStatusPromiseValidatedShort");
|
||||||
$this->labelStatusShort[2]=$langs->trans("DonationStatusPaidShort");
|
$this->labelStatusShort[2] = $langs->trans("DonationStatusPaidShort");
|
||||||
}
|
}
|
||||||
|
|
||||||
$statusType = 'status'.$status;
|
$statusType = 'status'.$status;
|
||||||
@ -194,7 +194,7 @@ class Don extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function initAsSpecimen()
|
public function initAsSpecimen()
|
||||||
{
|
{
|
||||||
global $conf, $user,$langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -202,10 +202,10 @@ class Don extends CommonObject
|
|||||||
$socids = array();
|
$socids = array();
|
||||||
|
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||||
$sql.= " WHERE client IN (1, 3)";
|
$sql .= " WHERE client IN (1, 3)";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
$sql.= " LIMIT 10";
|
$sql .= " LIMIT 10";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -222,9 +222,9 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialise parametres
|
// Initialise parametres
|
||||||
$this->id=0;
|
$this->id = 0;
|
||||||
$this->ref = 'SPECIMEN';
|
$this->ref = 'SPECIMEN';
|
||||||
$this->specimen=1;
|
$this->specimen = 1;
|
||||||
$this->lastname = 'Doe';
|
$this->lastname = 'Doe';
|
||||||
$this->firstname = 'John';
|
$this->firstname = 'John';
|
||||||
$this->socid = 1;
|
$this->socid = 1;
|
||||||
@ -236,11 +236,11 @@ class Don extends CommonObject
|
|||||||
$this->address = 'Twist road';
|
$this->address = 'Twist road';
|
||||||
$this->zip = '99999';
|
$this->zip = '99999';
|
||||||
$this->town = 'Town';
|
$this->town = 'Town';
|
||||||
$this->note_private='Private note';
|
$this->note_private = 'Private note';
|
||||||
$this->note_public='Public note';
|
$this->note_public = 'Public note';
|
||||||
$this->email='email@email.com';
|
$this->email = 'email@email.com';
|
||||||
$this->note='';
|
$this->note = '';
|
||||||
$this->statut=1;
|
$this->statut = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ class Don extends CommonObject
|
|||||||
$this->amount = trim($this->amount);
|
$this->amount = trim($this->amount);
|
||||||
|
|
||||||
$map = range(0, 9);
|
$map = range(0, 9);
|
||||||
$len=dol_strlen($this->amount);
|
$len = dol_strlen($this->amount);
|
||||||
for ($i = 0; $i < $len; $i++)
|
for ($i = 0; $i < $len; $i++)
|
||||||
{
|
{
|
||||||
if (!isset($map[substr($this->amount, $i, 1)]))
|
if (!isset($map[substr($this->amount, $i, 1)]))
|
||||||
@ -308,7 +308,7 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $amount_invalid)
|
if (!$amount_invalid)
|
||||||
{
|
{
|
||||||
if ($this->amount == 0)
|
if ($this->amount == 0)
|
||||||
{
|
{
|
||||||
@ -350,64 +350,64 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$ret = 0;
|
$ret = 0;
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->address=($this->address>0?$this->address:$this->address);
|
$this->address = ($this->address > 0 ? $this->address : $this->address);
|
||||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
$this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
|
||||||
$this->town=($this->town>0?$this->town:$this->town);
|
$this->town = ($this->town > 0 ? $this->town : $this->town);
|
||||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||||
$this->country=($this->country?$this->country:$this->country);
|
$this->country = ($this->country ? $this->country : $this->country);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
||||||
$sql.= "datec";
|
$sql .= "datec";
|
||||||
$sql.= ", entity";
|
$sql .= ", entity";
|
||||||
$sql.= ", amount";
|
$sql .= ", amount";
|
||||||
$sql.= ", fk_payment";
|
$sql .= ", fk_payment";
|
||||||
$sql.= ", fk_soc";
|
$sql .= ", fk_soc";
|
||||||
$sql.= ", firstname";
|
$sql .= ", firstname";
|
||||||
$sql.= ", lastname";
|
$sql .= ", lastname";
|
||||||
$sql.= ", societe";
|
$sql .= ", societe";
|
||||||
$sql.= ", address";
|
$sql .= ", address";
|
||||||
$sql.= ", zip";
|
$sql .= ", zip";
|
||||||
$sql.= ", town";
|
$sql .= ", town";
|
||||||
$sql.= ", fk_country";
|
$sql .= ", fk_country";
|
||||||
$sql.= ", public";
|
$sql .= ", public";
|
||||||
$sql.= ", fk_projet";
|
$sql .= ", fk_projet";
|
||||||
$sql.= ", note_private";
|
$sql .= ", note_private";
|
||||||
$sql.= ", note_public";
|
$sql .= ", note_public";
|
||||||
$sql.= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql.= ", fk_user_valid";
|
$sql .= ", fk_user_valid";
|
||||||
$sql.= ", datedon";
|
$sql .= ", datedon";
|
||||||
$sql.= ", email";
|
$sql .= ", email";
|
||||||
$sql.= ", phone";
|
$sql .= ", phone";
|
||||||
$sql.= ", phone_mobile";
|
$sql .= ", phone_mobile";
|
||||||
$sql.= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql.= "'".$this->db->idate($now)."'";
|
$sql .= "'".$this->db->idate($now)."'";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql .= ", ".$conf->entity;
|
||||||
$sql.= ", ".price2num($this->amount);
|
$sql .= ", ".price2num($this->amount);
|
||||||
$sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null");
|
$sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");
|
||||||
$sql.= ", ".($this->socid > 0 ? $this->socid : "null");
|
$sql .= ", ".($this->socid > 0 ? $this->socid : "null");
|
||||||
$sql.= ", '".$this->db->escape($this->firstname)."'";
|
$sql .= ", '".$this->db->escape($this->firstname)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->lastname)."'";
|
$sql .= ", '".$this->db->escape($this->lastname)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->societe)."'";
|
$sql .= ", '".$this->db->escape($this->societe)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->address)."'";
|
$sql .= ", '".$this->db->escape($this->address)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->zip)."'";
|
$sql .= ", '".$this->db->escape($this->zip)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->town)."'";
|
$sql .= ", '".$this->db->escape($this->town)."'";
|
||||||
$sql.= ", ".($this->country_id > 0 ? $this->country_id : '0');
|
$sql .= ", ".($this->country_id > 0 ? $this->country_id : '0');
|
||||||
$sql.= ", ".((int) $this->public);
|
$sql .= ", ".((int) $this->public);
|
||||||
$sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
|
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
|
||||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||||
$sql.= ", ".$user->id;
|
$sql .= ", ".$user->id;
|
||||||
$sql.= ", null";
|
$sql .= ", null";
|
||||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->email)."'";
|
$sql .= ", '".$this->db->escape($this->email)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->phone)."'";
|
$sql .= ", '".$this->db->escape($this->phone)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->phone_mobile)."'";
|
$sql .= ", '".$this->db->escape($this->phone_mobile)."'";
|
||||||
$sql.= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -418,7 +418,7 @@ class Don extends CommonObject
|
|||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('DON_CREATE', $user);
|
$result = $this->call_trigger('DON_CREATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -431,10 +431,10 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (! $error) {
|
if (!$error) {
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -471,20 +471,20 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->address=($this->address>0?$this->address:$this->address);
|
$this->address = ($this->address > 0 ? $this->address : $this->address);
|
||||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
$this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
|
||||||
$this->town=($this->town>0?$this->town:$this->town);
|
$this->town = ($this->town > 0 ? $this->town : $this->town);
|
||||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||||
$this->country=($this->country?$this->country:$this->country);
|
$this->country = ($this->country ? $this->country : $this->country);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
||||||
$sql .= "amount = " . price2num($this->amount);
|
$sql .= "amount = ".price2num($this->amount);
|
||||||
$sql .= ",fk_payment = ".($this->modepaymentid?$this->modepaymentid:"null");
|
$sql .= ",fk_payment = ".($this->modepaymentid ? $this->modepaymentid : "null");
|
||||||
$sql .= ",firstname = '".$this->db->escape($this->firstname)."'";
|
$sql .= ",firstname = '".$this->db->escape($this->firstname)."'";
|
||||||
$sql .= ",lastname='".$this->db->escape($this->lastname)."'";
|
$sql .= ",lastname='".$this->db->escape($this->lastname)."'";
|
||||||
$sql .= ",societe='".$this->db->escape($this->societe)."'";
|
$sql .= ",societe='".$this->db->escape($this->societe)."'";
|
||||||
@ -493,11 +493,11 @@ class Don extends CommonObject
|
|||||||
$sql .= ",town='".$this->db->escape($this->town)."'";
|
$sql .= ",town='".$this->db->escape($this->town)."'";
|
||||||
$sql .= ",fk_country = ".($this->country_id > 0 ? $this->country_id : '0');
|
$sql .= ",fk_country = ".($this->country_id > 0 ? $this->country_id : '0');
|
||||||
$sql .= ",public=".$this->public;
|
$sql .= ",public=".$this->public;
|
||||||
$sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null');
|
$sql .= ",fk_projet=".($this->fk_project > 0 ? $this->fk_project : 'null');
|
||||||
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
$sql .= ",note_private=".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
|
||||||
$sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
$sql .= ",note_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||||
$sql .= ",datedon='".$this->db->idate($this->date)."'";
|
$sql .= ",datedon='".$this->db->idate($this->date)."'";
|
||||||
$sql .= ",date_valid=".($this->date_valid?"'".$this->db->idate($this->date)."'":"null");
|
$sql .= ",date_valid=".($this->date_valid ? "'".$this->db->idate($this->date)."'" : "null");
|
||||||
$sql .= ",email='".$this->db->escape($this->email)."'";
|
$sql .= ",email='".$this->db->escape($this->email)."'";
|
||||||
$sql .= ",phone='".$this->db->escape($this->phone)."'";
|
$sql .= ",phone='".$this->db->escape($this->phone)."'";
|
||||||
$sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'";
|
$sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'";
|
||||||
@ -505,23 +505,23 @@ class Don extends CommonObject
|
|||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('DON_MODIFY', $user);
|
$result = $this->call_trigger('DON_MODIFY', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update extrafield
|
// Update extrafield
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$result = $this->insertExtraFields();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -529,7 +529,7 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error )
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
$result = 1;
|
$result = 1;
|
||||||
@ -545,7 +545,7 @@ class Don extends CommonObject
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::Update error -2 ".$this->error, LOG_ERR);
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@ -561,18 +561,18 @@ class Don extends CommonObject
|
|||||||
public function delete($user, $notrigger = 0)
|
public function delete($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('DON_DELETE', $user);
|
$result = $this->call_trigger('DON_DELETE', $user);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -582,23 +582,10 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete donation
|
// Delete donation
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "don_extrafields";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don_extrafields";
|
||||||
$sql.= " WHERE fk_object=" . $this->id;
|
$sql .= " WHERE fk_object=".$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if (! $resql)
|
|
||||||
{
|
|
||||||
$this->errors[] = $this->db->lasterror();
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "don";
|
|
||||||
$sql.= " WHERE rowid=" . $this->id;
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
@ -608,19 +595,32 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don";
|
||||||
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql)
|
||||||
|
{
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
foreach ($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this) . "::delete " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -638,28 +638,28 @@ class Don extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
$sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,";
|
||||||
$sql.= " d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
$sql .= " d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||||
$sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
|
$sql .= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, ";
|
||||||
$sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
$sql .= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
||||||
$sql.= " p.ref as project_ref,";
|
$sql .= " p.ref as project_ref,";
|
||||||
$sql.= " cp.libelle as payment_label, cp.code as payment_code,";
|
$sql .= " cp.libelle as payment_label, cp.code as payment_code,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql .= " c.code as country_code, c.label as country";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid";
|
||||||
$sql.= " WHERE d.entity IN (".getEntity('donation').")";
|
$sql .= " WHERE d.entity IN (".getEntity('donation').")";
|
||||||
if (! empty($id))
|
if (!empty($id))
|
||||||
{
|
{
|
||||||
$sql.= " AND d.rowid=".$id;
|
$sql .= " AND d.rowid=".$id;
|
||||||
}
|
}
|
||||||
elseif (! empty($ref))
|
elseif (!empty($ref))
|
||||||
{
|
{
|
||||||
$sql.= " AND d.ref='".$this->db->escape($ref)."'";
|
$sql .= " AND d.ref='".$this->db->escape($ref)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
if ($this->db->num_rows($resql))
|
||||||
@ -671,7 +671,7 @@ class Don extends CommonObject
|
|||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
$this->datec = $this->db->jdate($obj->datec);
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
$this->date_validation = $this->db->jdate($obj->date_valid);
|
$this->date_validation = $this->db->jdate($obj->date_valid);
|
||||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||||
$this->date_modification = $this->db->jdate($obj->datem);
|
$this->date_modification = $this->db->jdate($obj->datem);
|
||||||
$this->datem = $this->db->jdate($obj->datem);
|
$this->datem = $this->db->jdate($obj->datem);
|
||||||
$this->date = $this->db->jdate($obj->datedon);
|
$this->date = $this->db->jdate($obj->datedon);
|
||||||
@ -686,21 +686,21 @@ class Don extends CommonObject
|
|||||||
$this->country_id = $obj->fk_country;
|
$this->country_id = $obj->fk_country;
|
||||||
$this->country_code = $obj->country_code;
|
$this->country_code = $obj->country_code;
|
||||||
$this->country = $obj->country;
|
$this->country = $obj->country;
|
||||||
$this->country_olddata = $obj->country_olddata; // deprecated
|
$this->country_olddata = $obj->country_olddata; // deprecated
|
||||||
$this->email = $obj->email;
|
$this->email = $obj->email;
|
||||||
$this->phone = $obj->phone;
|
$this->phone = $obj->phone;
|
||||||
$this->phone_mobile = $obj->phone_mobile;
|
$this->phone_mobile = $obj->phone_mobile;
|
||||||
$this->project = $obj->project_ref;
|
$this->project = $obj->project_ref;
|
||||||
$this->fk_projet = $obj->fk_project; // deprecated
|
$this->fk_projet = $obj->fk_project; // deprecated
|
||||||
$this->fk_project = $obj->fk_project;
|
$this->fk_project = $obj->fk_project;
|
||||||
$this->public = $obj->public;
|
$this->public = $obj->public;
|
||||||
$this->mode_reglement_id = $obj->fk_payment;
|
$this->mode_reglement_id = $obj->fk_payment;
|
||||||
$this->mode_reglement_code= $obj->payment_code;
|
$this->mode_reglement_code = $obj->payment_code;
|
||||||
$this->mode_reglement = $obj->payment_label;
|
$this->mode_reglement = $obj->payment_label;
|
||||||
$this->paid = $obj->paid;
|
$this->paid = $obj->paid;
|
||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->note_private = $obj->note_private;
|
$this->note_private = $obj->note_private;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
|
||||||
// Retreive all extrafield
|
// Retreive all extrafield
|
||||||
@ -742,13 +742,13 @@ class Don extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $user;
|
global $langs, $user;
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = ".$userid." WHERE rowid = ".$id." AND fk_statut = 0";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = ".$userid." WHERE rowid = ".$id." AND fk_statut = 0";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->affected_rows($resql))
|
if ($this->db->affected_rows($resql))
|
||||||
@ -756,7 +756,7 @@ class Don extends CommonObject
|
|||||||
if (!$notrigger)
|
if (!$notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('DON_VALIDATE', $user);
|
$result = $this->call_trigger('DON_VALIDATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -796,9 +796,9 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql .= ", fk_payment=".$modepayment;
|
$sql .= ", fk_payment=".$modepayment;
|
||||||
}
|
}
|
||||||
$sql .= " WHERE rowid = ".$id." AND fk_statut = 1";
|
$sql .= " WHERE rowid = ".$id." AND fk_statut = 1";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->affected_rows($resql))
|
if ($this->db->affected_rows($resql))
|
||||||
@ -829,10 +829,10 @@ class Don extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ( $this->db->affected_rows($resql) )
|
if ($this->db->affected_rows($resql))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -860,18 +860,18 @@ class Don extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$result=0;
|
$result = 0;
|
||||||
|
|
||||||
$sql = "SELECT sum(amount) as total";
|
$sql = "SELECT sum(amount) as total";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don";
|
$sql .= " FROM ".MAIN_DB_PREFIX."don";
|
||||||
$sql.= " WHERE fk_statut = ".$param;
|
$sql .= " WHERE fk_statut = ".$param;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql .= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$result=$obj->total;
|
$result = $obj->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -888,19 +888,19 @@ class Don extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb = array();
|
||||||
|
|
||||||
$sql = "SELECT count(d.rowid) as nb";
|
$sql = "SELECT count(d.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||||
$sql.= " WHERE d.fk_statut > 0";
|
$sql .= " WHERE d.fk_statut > 0";
|
||||||
$sql.= " AND d.entity IN (".getEntity('donation').")";
|
$sql .= " AND d.entity IN (".getEntity('donation').")";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$this->nb["donations"]=$obj->nb;
|
$this->nb["donations"] = $obj->nb;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return 1;
|
return 1;
|
||||||
@ -908,7 +908,7 @@ class Don extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error=$this->db->error();
|
$this->error = $this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -924,15 +924,15 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result = '';
|
||||||
$label=$langs->trans("ShowDonation").': '.$this->id;
|
$label = $langs->trans("ShowDonation").': '.$this->id;
|
||||||
|
|
||||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) $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);
|
if ($withpicto) $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);
|
||||||
if ($withpicto != 2) $result.= $this->ref;
|
if ($withpicto != 2) $result .= $this->ref;
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -947,9 +947,9 @@ class Don extends CommonObject
|
|||||||
public function info($id)
|
public function info($id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
|
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
|
||||||
$sql.= ' d.tms';
|
$sql .= ' d.tms';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'don as d';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'don as d';
|
||||||
$sql.= ' WHERE d.rowid = '.$id;
|
$sql .= ' WHERE d.rowid = '.$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -996,16 +996,16 @@ class Don extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
if (! dol_strlen($modele)) {
|
if (!dol_strlen($modele)) {
|
||||||
$modele = 'html_cerfafr';
|
$modele = 'html_cerfafr';
|
||||||
|
|
||||||
if ($this->modelpdf) {
|
if ($this->modelpdf) {
|
||||||
$modele = $this->modelpdf;
|
$modele = $this->modelpdf;
|
||||||
} elseif (! empty($conf->global->DON_ADDON_MODEL)) {
|
} elseif (!empty($conf->global->DON_ADDON_MODEL)) {
|
||||||
$modele = $conf->global->DON_ADDON_MODEL;
|
$modele = $conf->global->DON_ADDON_MODEL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1016,37 +1016,37 @@ class Don extends CommonObject
|
|||||||
//return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
//return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
// Increase limit for PDF build
|
// Increase limit for PDF build
|
||||||
$err=error_reporting();
|
$err = error_reporting();
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
@set_time_limit(120);
|
@set_time_limit(120);
|
||||||
error_reporting($err);
|
error_reporting($err);
|
||||||
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath = '';
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||||
$tmp=explode(':', $modele, 2);
|
$tmp = explode(':', $modele, 2);
|
||||||
if (! empty($tmp[1]))
|
if (!empty($tmp[1]))
|
||||||
{
|
{
|
||||||
$modele=$tmp[0];
|
$modele = $tmp[0];
|
||||||
$srctemplatepath=$tmp[1];
|
$srctemplatepath = $tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file = ''; $classname = ''; $filefound = 0;
|
||||||
$dirmodels=array('/');
|
$dirmodels = array('/');
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels, $conf->modules_parts['models']);
|
if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
foreach(array('html','doc','pdf') as $prefix)
|
foreach (array('html', 'doc', 'pdf') as $prefix)
|
||||||
{
|
{
|
||||||
$file = $prefix."_".preg_replace('/^html_/', '', $modele).".modules.php";
|
$file = $prefix."_".preg_replace('/^html_/', '', $modele).".modules.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// On verifie l'emplacement du modele
|
||||||
$file=dol_buildpath($reldir."core/modules/dons/".$file, 0);
|
$file = dol_buildpath($reldir."core/modules/dons/".$file, 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound = 1;
|
||||||
$classname=$prefix.'_'.$modele;
|
$classname = $prefix.'_'.$modele;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1058,17 +1058,17 @@ class Don extends CommonObject
|
|||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
||||||
$object=$this;
|
$object = $this;
|
||||||
|
|
||||||
$classname = $modele;
|
$classname = $modele;
|
||||||
$obj = new $classname($this->db);
|
$obj = new $classname($this->db);
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
$sav_charset_output = $outputlangs->charset_output;
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output = $sav_charset_output;
|
||||||
|
|
||||||
// we delete preview files
|
// we delete preview files
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
@ -1077,7 +1077,7 @@ class Don extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output = $sav_charset_output;
|
||||||
dol_syslog("Erreur dans don_create");
|
dol_syslog("Erreur dans don_create");
|
||||||
dol_print_error($this->db, $obj->error);
|
dol_print_error($this->db, $obj->error);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
* \ingroup mymodule
|
* \ingroup mymodule
|
||||||
* \brief Description and activation file for module MyModule
|
* \brief Description and activation file for module MyModule
|
||||||
*/
|
*/
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description and activation class for module MyModule
|
* Description and activation class for module MyModule
|
||||||
@ -40,7 +40,7 @@ class modMyModule extends DolibarrModules
|
|||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs, $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
// Id for module (must be unique).
|
// Id for module (must be unique).
|
||||||
@ -73,7 +73,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// Name of image file used for this module.
|
// Name of image file used for this module.
|
||||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||||
$this->picto='generic';
|
$this->picto = 'generic';
|
||||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||||
$this->module_parts = array(
|
$this->module_parts = array(
|
||||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||||
@ -121,13 +121,13 @@ class modMyModule extends DolibarrModules
|
|||||||
$this->hidden = false;
|
$this->hidden = false;
|
||||||
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||||
$this->depends = array();
|
$this->depends = array();
|
||||||
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||||
$this->langfiles = array("mymodule@mymodule");
|
$this->langfiles = array("mymodule@mymodule");
|
||||||
$this->phpmin = array(5,5); // Minimum version of PHP required by module
|
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
|
||||||
$this->need_dolibarr_version = array(11,-3); // Minimum version of Dolibarr required by module
|
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
|
||||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||||
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||||
//$this->always_enabled = true; // If true, can't be disabled
|
//$this->always_enabled = true; // If true, can't be disabled
|
||||||
|
|
||||||
@ -146,9 +146,9 @@ class modMyModule extends DolibarrModules
|
|||||||
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
||||||
)*/
|
)*/
|
||||||
|
|
||||||
if (! isset($conf->mymodule) || ! isset($conf->mymodule->enabled)) {
|
if (!isset($conf->mymodule) || !isset($conf->mymodule->enabled)) {
|
||||||
$conf->mymodule=new stdClass();
|
$conf->mymodule = new stdClass();
|
||||||
$conf->mymodule->enabled=0;
|
$conf->mymodule->enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Array to add new pages in new tabs
|
// Array to add new pages in new tabs
|
||||||
@ -180,7 +180,7 @@ class modMyModule extends DolibarrModules
|
|||||||
// 'user' to add a tab in user view
|
// 'user' to add a tab in user view
|
||||||
|
|
||||||
// Dictionaries
|
// Dictionaries
|
||||||
$this->dictionaries=array();
|
$this->dictionaries = array();
|
||||||
/* Example:
|
/* Example:
|
||||||
$this->dictionaries=array(
|
$this->dictionaries=array(
|
||||||
'langs'=>'mymodule@mymodule',
|
'langs'=>'mymodule@mymodule',
|
||||||
@ -241,44 +241,44 @@ class modMyModule extends DolibarrModules
|
|||||||
|
|
||||||
// Permissions provided by this module
|
// Permissions provided by this module
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
// Add here entries to declare new permissions
|
// Add here entries to declare new permissions
|
||||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Read objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Read objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
/* END MODULEBUILDER PERMISSIONS */
|
/* END MODULEBUILDER PERMISSIONS */
|
||||||
|
|
||||||
// Main menu entries to add
|
// Main menu entries to add
|
||||||
$this->menu = array();
|
$this->menu = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
// Add here entries to declare new menus
|
// Add here entries to declare new menus
|
||||||
/* BEGIN MODULEBUILDER TOPMENU */
|
/* BEGIN MODULEBUILDER TOPMENU */
|
||||||
$this->menu[$r++]=array(
|
$this->menu[$r++] = array(
|
||||||
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'top', // This is a Top menu entry
|
'type'=>'top', // This is a Top menu entry
|
||||||
'titre'=>'MyModule',
|
'titre'=>'MyModule',
|
||||||
'mainmenu'=>'mymodule',
|
'mainmenu'=>'mymodule',
|
||||||
'leftmenu'=>'',
|
'leftmenu'=>'',
|
||||||
'url'=>'/mymodule/mymoduleindex.php',
|
'url'=>'/mymodule/mymoduleindex.php',
|
||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1000+$r,
|
'position'=>1000 + $r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||||
);
|
);
|
||||||
/* END MODULEBUILDER TOPMENU */
|
/* END MODULEBUILDER TOPMENU */
|
||||||
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
||||||
@ -327,7 +327,7 @@ class modMyModule extends DolibarrModules
|
|||||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||||
|
|
||||||
// Exports profiles provided by this module
|
// Exports profiles provided by this module
|
||||||
$r=1;
|
$r = 1;
|
||||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||||
/*
|
/*
|
||||||
$langs->load("mymodule@mymodule");
|
$langs->load("mymodule@mymodule");
|
||||||
@ -352,7 +352,7 @@ class modMyModule extends DolibarrModules
|
|||||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||||
|
|
||||||
// Imports profiles provided by this module
|
// Imports profiles provided by this module
|
||||||
$r=1;
|
$r = 1;
|
||||||
/* BEGIN MODULEBUILDER IMPORT MYOBJECT */
|
/* BEGIN MODULEBUILDER IMPORT MYOBJECT */
|
||||||
/*
|
/*
|
||||||
$langs->load("mymodule@mymodule");
|
$langs->load("mymodule@mymodule");
|
||||||
@ -384,7 +384,7 @@ class modMyModule extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$result=$this->_load_tables('/mymodule/sql/');
|
$result = $this->_load_tables('/mymodule/sql/');
|
||||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
|
||||||
// Create extrafields during init
|
// Create extrafields during init
|
||||||
|
|||||||
@ -43,19 +43,19 @@
|
|||||||
|
|
||||||
|
|
||||||
// Load Dolibarr environment
|
// Load Dolibarr environment
|
||||||
$res=0;
|
$res = 0;
|
||||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
|
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
|
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
|
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
|
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||||
// Try main.inc.php using relative path
|
// Try main.inc.php using relative path
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
|
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||||
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
|
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||||
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
|
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||||
if (! $res) die("Include of main fails");
|
if (!$res) die("Include of main fails");
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
@ -63,41 +63,41 @@ dol_include_once('/mymodule/class/myobject.class.php');
|
|||||||
dol_include_once('/mymodule/lib/mymodule_myobject.lib.php');
|
dol_include_once('/mymodule/lib/mymodule_myobject.lib.php');
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("mymodule@mymodule","other"));
|
$langs->loadLangs(array("mymodule@mymodule", "other"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$cancel = GETPOST('cancel', 'aZ09');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
//$lineid = GETPOST('lineid', 'int');
|
//$lineid = GETPOST('lineid', 'int');
|
||||||
|
|
||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object=new MyObject($db);
|
$object = new MyObject($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
|
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||||
$hookmanager->initHooks(array('myobjectcard','globalcard')); // Note that conf->hooks_modules contains array
|
$hookmanager->initHooks(array('myobjectcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||||
|
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
// Initialize array of search criterias
|
// Initialize array of search criterias
|
||||||
$search_all=trim(GETPOST("search_all", 'alpha'));
|
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||||
$search=array();
|
$search = array();
|
||||||
foreach($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
|
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($action) && empty($id) && empty($ref)) $action='view';
|
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||||
|
|
||||||
// Security check - Protection if external user
|
// Security check - Protection if external user
|
||||||
//if ($user->socid > 0) access_forbidden();
|
//if ($user->socid > 0) access_forbidden();
|
||||||
@ -117,13 +117,13 @@ $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the in
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array();
|
$parameters = array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ if (empty($reshook))
|
|||||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||||
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
|
|
||||||
// Actions cancel, add, update, delete or clone
|
// Actions cancel, add, update, delete or clone
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||||
@ -158,9 +158,9 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
$trigger_name = 'MYOBJECT_SENTBYMAIL';
|
||||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
$autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||||
$trackid='myobject'.$object->id;
|
$trackid = 'myobject'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,8 +173,8 @@ if (empty($reshook))
|
|||||||
* Put here all code to build page
|
* Put here all code to build page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$formfile=new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans('MyObject'), '');
|
llxHeader('', $langs->trans('MyObject'), '');
|
||||||
|
|
||||||
@ -209,10 +209,10 @@ if ($action == 'create')
|
|||||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ if ($action == 'create')
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
print '<input type="'.($backtopage ? "submit" : "button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -245,10 +245,10 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// Confirmation to delete
|
// Confirmation to delete
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
|
||||||
}
|
}
|
||||||
// Confirmation to delete line
|
// Confirmation to delete line
|
||||||
if ($action == 'deleteline')
|
if ($action == 'deleteline')
|
||||||
@ -285,13 +285,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array();
|
$formquestion = array();
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation of action xxxx
|
// Confirmation of action xxxx
|
||||||
if ($action == 'xxx')
|
if ($action == 'xxx')
|
||||||
{
|
{
|
||||||
$formquestion=array();
|
$formquestion = array();
|
||||||
/*
|
/*
|
||||||
$forcecombo=0;
|
$forcecombo=0;
|
||||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||||
@ -302,14 +302,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Hook formConfirm
|
// Call Hook formConfirm
|
||||||
$parameters = array('lineid' => $lineid);
|
$parameters = array('lineid' => $lineid);
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
@ -317,9 +317,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
// Object card
|
// Object card
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
$linkback = '<a href="' .dol_buildpath('/mymodule/myobject_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="'.dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref='<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
/*
|
/*
|
||||||
// Ref bis
|
// Ref bis
|
||||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->myobject->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->myobject->creer, 'string', '', 0, 1);
|
||||||
@ -357,7 +357,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
@ -372,10 +372,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
|
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
|
||||||
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
||||||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -533,13 +533,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$MAXEVENT = 10;
|
$MAXEVENT = 10;
|
||||||
|
|
||||||
$morehtmlright = '<a href="'.dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id.'">';
|
$morehtmlright = '<a href="'.dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id.'">';
|
||||||
$morehtmlright.= $langs->trans("SeeAll");
|
$morehtmlright .= $langs->trans("SeeAll");
|
||||||
$morehtmlright.= '</a>';
|
$morehtmlright .= '</a>';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'myobject', (is_object($object->thirdparty)?$object->thirdparty->id:0), 1, '', $MAXEVENT, '', $morehtmlright);
|
$somethingshown = $formactions->showactions($object, 'myobject', (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlright);
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This set stripe global env
|
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This set stripe global env
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,28 +90,28 @@ class Stripe extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT tokenstring";
|
$sql = "SELECT tokenstring";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql .= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " AND service = '".$mode."'";
|
$sql .= " AND service = '".$mode."'";
|
||||||
if ($fk_soc > 0) {
|
if ($fk_soc > 0) {
|
||||||
$sql.= " AND fk_soc = ".$fk_soc;
|
$sql .= " AND fk_soc = ".$fk_soc;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql.= " AND fk_soc IS NULL";
|
$sql .= " AND fk_soc IS NULL";
|
||||||
}
|
}
|
||||||
$sql.= " AND fk_user IS NULL AND fk_adherent IS NULL";
|
$sql .= " AND fk_user IS NULL AND fk_adherent IS NULL";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if ($this->db->num_rows($result)) {
|
if ($this->db->num_rows($result)) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$tokenstring=$obj->tokenstring;
|
$tokenstring = $obj->tokenstring;
|
||||||
|
|
||||||
$tmparray = dol_json_decode($tokenstring);
|
$tmparray = dol_json_decode($tokenstring);
|
||||||
$key = $tmparray->stripe_user_id;
|
$key = $tmparray->stripe_user_id;
|
||||||
} else {
|
} else {
|
||||||
$tokenstring='';
|
$tokenstring = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -133,7 +133,7 @@ class Stripe extends CommonObject
|
|||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
||||||
$societeaccount = new SocieteAccount($this->db);
|
$societeaccount = new SocieteAccount($this->db);
|
||||||
return $societeaccount->getCustomerAccount($id, 'stripe', $status); // Get thirdparty cus_...
|
return $societeaccount->getCustomerAccount($id, 'stripe', $status); // Get thirdparty cus_...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,14 +158,14 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
$customer = null;
|
$customer = null;
|
||||||
|
|
||||||
$sql = "SELECT sa.key_account as key_account, sa.entity"; // key_account is cus_....
|
$sql = "SELECT sa.key_account as key_account, sa.entity"; // key_account is cus_....
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
|
||||||
$sql.= " WHERE sa.fk_soc = " . $object->id;
|
$sql .= " WHERE sa.fk_soc = ".$object->id;
|
||||||
$sql.= " AND sa.entity IN (".getEntity('societe').")";
|
$sql .= " AND sa.entity IN (".getEntity('societe').")";
|
||||||
$sql.= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
$sql .= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
||||||
$sql.= " AND key_account IS NOT NULL AND key_account <> ''";
|
$sql .= " AND key_account IS NOT NULL AND key_account <> ''";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::customerStripe search stripe customer id for thirdparty id=".$object->id, LOG_DEBUG);
|
dol_syslog(get_class($this)."::customerStripe search stripe customer id for thirdparty id=".$object->id, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -174,7 +174,7 @@ class Stripe extends CommonObject
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$tiers = $obj->key_account;
|
$tiers = $obj->key_account;
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers);
|
dol_syslog(get_class($this)."::customerStripe found stripe customer key_account = ".$tiers);
|
||||||
|
|
||||||
// Force to use the correct API key
|
// Force to use the correct API key
|
||||||
global $stripearrayofkeysbyenv;
|
global $stripearrayofkeysbyenv;
|
||||||
@ -187,7 +187,7 @@ class Stripe extends CommonObject
|
|||||||
$customer = \Stripe\Customer::retrieve("$tiers", array("stripe_account" => $key));
|
$customer = \Stripe\Customer::retrieve("$tiers", array("stripe_account" => $key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
// For exemple, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.'
|
// For exemple, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.'
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
@ -230,11 +230,11 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the VAT record in Stripe
|
// Create the VAT record in Stripe
|
||||||
if (! empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer
|
if (!empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer
|
||||||
{
|
{
|
||||||
if (! empty($vatcleaned))
|
if (!empty($vatcleaned))
|
||||||
{
|
{
|
||||||
$isineec=isInEEC($object);
|
$isineec = isInEEC($object);
|
||||||
if ($object->country_code && $isineec)
|
if ($object->country_code && $isineec)
|
||||||
{
|
{
|
||||||
//$taxids = $customer->allTaxIds($customer->id);
|
//$taxids = $customer->allTaxIds($customer->id);
|
||||||
@ -244,15 +244,15 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create customer in Dolibarr
|
// Create customer in Dolibarr
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)";
|
||||||
$sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', " . $status . ", " . $conf->entity . ", '".$this->db->idate(dol_now())."', ".$user->id.")";
|
$sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', ".$status.", ".$conf->entity.", '".$this->db->idate(dol_now())."', ".$user->id.")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ class Stripe extends CommonObject
|
|||||||
$stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key));
|
$stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -332,8 +332,8 @@ class Stripe extends CommonObject
|
|||||||
if (empty($status)) $service = 'StripeTest';
|
if (empty($status)) $service = 'StripeTest';
|
||||||
else $service = 'StripeLive';
|
else $service = 'StripeLive';
|
||||||
|
|
||||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
$arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||||
if (! in_array($currency_code, $arrayzerounitcurrency)) $stripeamount = $amount * 100;
|
if (!in_array($currency_code, $arrayzerounitcurrency)) $stripeamount = $amount * 100;
|
||||||
else $stripeamount = $amount;
|
else $stripeamount = $amount;
|
||||||
|
|
||||||
$fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE;
|
$fee = $amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE;
|
||||||
@ -342,7 +342,7 @@ class Stripe extends CommonObject
|
|||||||
} elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
|
} elseif ($fee < $conf->global->STRIPE_APPLICATION_FEE_MINIMAL) {
|
||||||
$fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
|
$fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
|
||||||
}
|
}
|
||||||
if (! in_array($currency_code, $arrayzerounitcurrency)) {
|
if (!in_array($currency_code, $arrayzerounitcurrency)) {
|
||||||
$stripefee = round($fee * 100);
|
$stripefee = round($fee * 100);
|
||||||
} else {
|
} else {
|
||||||
$stripefee = round($fee);
|
$stripefee = round($fee);
|
||||||
@ -398,7 +398,7 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
if (empty($paymentintent))
|
if (empty($paymentintent))
|
||||||
{
|
{
|
||||||
$ipaddress=getUserRemoteIP();
|
$ipaddress = getUserRemoteIP();
|
||||||
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
||||||
if (is_object($object))
|
if (is_object($object))
|
||||||
{
|
{
|
||||||
@ -408,17 +408,17 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dataforintent = array(
|
$dataforintent = array(
|
||||||
"confirm" => $confirmnow, // Do not confirm immediatly during creation of intent
|
"confirm" => $confirmnow, // Do not confirm immediatly during creation of intent
|
||||||
"confirmation_method" => $mode,
|
"confirmation_method" => $mode,
|
||||||
"amount" => $stripeamount,
|
"amount" => $stripeamount,
|
||||||
"currency" => $currency_code,
|
"currency" => $currency_code,
|
||||||
"payment_method_types" => array("card"),
|
"payment_method_types" => array("card"),
|
||||||
"description" => $description,
|
"description" => $description,
|
||||||
"statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
"statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||||
"setup_future_usage" => "on_session",
|
"setup_future_usage" => "on_session",
|
||||||
"metadata" => $metadata
|
"metadata" => $metadata
|
||||||
);
|
);
|
||||||
if (! is_null($customer)) $dataforintent["customer"]=$customer;
|
if (!is_null($customer)) $dataforintent["customer"] = $customer;
|
||||||
// payment_method =
|
// payment_method =
|
||||||
// payment_method_types = array('card')
|
// payment_method_types = array('card')
|
||||||
//var_dump($dataforintent);
|
//var_dump($dataforintent);
|
||||||
@ -427,13 +427,13 @@ class Stripe extends CommonObject
|
|||||||
unset($dataforintent['setup_future_usage']);
|
unset($dataforintent['setup_future_usage']);
|
||||||
$dataforintent["off_session"] = true;
|
$dataforintent["off_session"] = true;
|
||||||
}
|
}
|
||||||
if (! is_null($payment_method))
|
if (!is_null($payment_method))
|
||||||
{
|
{
|
||||||
$dataforintent["payment_method"] = $payment_method;
|
$dataforintent["payment_method"] = $payment_method;
|
||||||
$description.=' - '.$payment_method;
|
$description .= ' - '.$payment_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0)
|
if ($conf->entity != $conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0)
|
||||||
{
|
{
|
||||||
$dataforintent["application_fee_amount"] = $stripefee;
|
$dataforintent["application_fee_amount"] = $stripefee;
|
||||||
}
|
}
|
||||||
@ -452,7 +452,7 @@ class Stripe extends CommonObject
|
|||||||
$arrayofoptions["idempotency_key"] = $description;
|
$arrayofoptions["idempotency_key"] = $description;
|
||||||
}
|
}
|
||||||
// Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
|
// Note: If all data for payment intent are same than a previous on, even if we use 'create', Stripe will return ID of the old existing payment intent.
|
||||||
if (! empty($key)) { // If the Stripe connect account not set, we use common API usage
|
if (!empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||||
$arrayofoptions["stripe_account"] = $key;
|
$arrayofoptions["stripe_account"] = $key;
|
||||||
}
|
}
|
||||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
|
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
|
||||||
@ -463,12 +463,12 @@ class Stripe extends CommonObject
|
|||||||
$paymentintentalreadyexists = 0;
|
$paymentintentalreadyexists = 0;
|
||||||
// Check that payment intent $paymentintent->id is not already recorded.
|
// Check that payment intent $paymentintent->id is not already recorded.
|
||||||
$sql = "SELECT pi.rowid";
|
$sql = "SELECT pi.rowid";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi";
|
||||||
$sql.= " WHERE pi.entity IN (".getEntity('societe').")";
|
$sql .= " WHERE pi.entity IN (".getEntity('societe').")";
|
||||||
$sql.= " AND pi.ext_payment_site = '" . $service . "'";
|
$sql .= " AND pi.ext_payment_site = '".$service."'";
|
||||||
$sql.= " AND pi.ext_payment_id = '".$this->db->escape($paymentintent->id)."'";
|
$sql .= " AND pi.ext_payment_id = '".$this->db->escape($paymentintent->id)."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -481,17 +481,17 @@ class Stripe extends CommonObject
|
|||||||
else dol_print_error($this->db);
|
else dol_print_error($this->db);
|
||||||
|
|
||||||
// If not, we create it.
|
// If not, we create it.
|
||||||
if (! $paymentintentalreadyexists)
|
if (!$paymentintentalreadyexists)
|
||||||
{
|
{
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)";
|
||||||
$sql .= " VALUES ('".$this->db->idate($now)."', '0', '".$this->db->escape($paymentintent->id)."', ".$object->id.", '".$this->db->escape($object->element)."', " . $conf->entity . ", '" . $service . "')";
|
$sql .= " VALUES ('".$this->db->idate($now)."', '0', '".$this->db->escape($paymentintent->id)."', ".$object->id.", '".$this->db->escape($object->element)."', ".$conf->entity.", '".$service."')";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::PaymentIntent failed to insert paymentintent with id=".$paymentintent->id." into database.");
|
dol_syslog(get_class($this)."::PaymentIntent failed to insert paymentintent with id=".$paymentintent->id." into database.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,14 +500,14 @@ class Stripe extends CommonObject
|
|||||||
$_SESSION["stripe_payment_intent"] = $paymentintent;
|
$_SESSION["stripe_payment_intent"] = $paymentintent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Stripe\Error\Card $e)
|
catch (Stripe\Error\Card $e)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
$this->code = $e->getStripeCode();
|
$this->code = $e->getStripeCode();
|
||||||
$this->declinecode = $e->getDeclineCode();
|
$this->declinecode = $e->getDeclineCode();
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
/*var_dump($dataforintent);
|
/*var_dump($dataforintent);
|
||||||
var_dump($description);
|
var_dump($description);
|
||||||
@ -524,7 +524,7 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("getPaymentIntent return error=".$error." this->error=".$this->error, LOG_INFO, -1);
|
dol_syslog("getPaymentIntent return error=".$error." this->error=".$this->error, LOG_INFO, -1);
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
return $paymentintent;
|
return $paymentintent;
|
||||||
}
|
}
|
||||||
@ -568,7 +568,7 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
if (empty($setupintent))
|
if (empty($setupintent))
|
||||||
{
|
{
|
||||||
$ipaddress=getUserRemoteIP();
|
$ipaddress = getUserRemoteIP();
|
||||||
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
||||||
if (is_object($object))
|
if (is_object($object))
|
||||||
{
|
{
|
||||||
@ -578,13 +578,13 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dataforintent = array(
|
$dataforintent = array(
|
||||||
"confirm" => $confirmnow, // Do not confirm immediatly during creation of intent
|
"confirm" => $confirmnow, // Do not confirm immediatly during creation of intent
|
||||||
"payment_method_types" => array("card"),
|
"payment_method_types" => array("card"),
|
||||||
"description" => $description,
|
"description" => $description,
|
||||||
"usage" => "off_session",
|
"usage" => "off_session",
|
||||||
"metadata" => $metadata
|
"metadata" => $metadata
|
||||||
);
|
);
|
||||||
if (! is_null($customer)) $dataforintent["customer"]=$customer;
|
if (!is_null($customer)) $dataforintent["customer"] = $customer;
|
||||||
// payment_method =
|
// payment_method =
|
||||||
// payment_method_types = array('card')
|
// payment_method_types = array('card')
|
||||||
//var_dump($dataforintent);
|
//var_dump($dataforintent);
|
||||||
@ -652,7 +652,7 @@ class Stripe extends CommonObject
|
|||||||
$_SESSION["stripe_setup_intent"] = $setupintent;
|
$_SESSION["stripe_setup_intent"] = $setupintent;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
/*var_dump($dataforintent);
|
/*var_dump($dataforintent);
|
||||||
var_dump($description);
|
var_dump($description);
|
||||||
@ -666,7 +666,7 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("getSetupIntent return error=".$error, LOG_INFO, -1);
|
dol_syslog("getSetupIntent return error=".$error, LOG_INFO, -1);
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
return $setupintent;
|
return $setupintent;
|
||||||
}
|
}
|
||||||
@ -693,12 +693,12 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
$card = null;
|
$card = null;
|
||||||
|
|
||||||
$sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.exp_date_month, sa.exp_date_year, sa.number, sa.cvn"; // stripe_card_ref is card_....
|
$sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.exp_date_month, sa.exp_date_year, sa.number, sa.cvn"; // stripe_card_ref is card_....
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_rib as sa";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa";
|
||||||
$sql.= " WHERE sa.rowid = " . $object->id; // We get record from ID, no need for filter on entity
|
$sql .= " WHERE sa.rowid = ".$object->id; // We get record from ID, no need for filter on entity
|
||||||
$sql.= " AND sa.type = 'card'";
|
$sql .= " AND sa.type = 'card'";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch search stripe card id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch search stripe card id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -706,12 +706,12 @@ class Stripe extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$cardref = $obj->stripe_card_ref;
|
$cardref = $obj->stripe_card_ref;
|
||||||
dol_syslog(get_class($this) . "::cardStripe cardref=".$cardref);
|
dol_syslog(get_class($this)."::cardStripe cardref=".$cardref);
|
||||||
if ($cardref)
|
if ($cardref)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||||
if (! preg_match('/^pm_/', $cardref))
|
if (!preg_match('/^pm_/', $cardref))
|
||||||
{
|
{
|
||||||
$card = $cu->sources->retrieve($cardref);
|
$card = $cu->sources->retrieve($cardref);
|
||||||
}
|
}
|
||||||
@ -720,7 +720,7 @@ class Stripe extends CommonObject
|
|||||||
$card = \Stripe\PaymentMethod::retrieve($cardref);
|
$card = \Stripe\PaymentMethod::retrieve($cardref);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (! preg_match('/^pm_/', $cardref))
|
if (!preg_match('/^pm_/', $cardref))
|
||||||
{
|
{
|
||||||
//$card = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
|
//$card = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
|
||||||
$card = $cu->sources->retrieve($cardref);
|
$card = $cu->sources->retrieve($cardref);
|
||||||
@ -731,7 +731,7 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
dol_syslog($this->error, LOG_WARNING);
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
@ -739,15 +739,15 @@ class Stripe extends CommonObject
|
|||||||
}
|
}
|
||||||
elseif ($createifnotlinkedtostripe)
|
elseif ($createifnotlinkedtostripe)
|
||||||
{
|
{
|
||||||
$exp_date_month=$obj->exp_date_month;
|
$exp_date_month = $obj->exp_date_month;
|
||||||
$exp_date_year=$obj->exp_date_year;
|
$exp_date_year = $obj->exp_date_year;
|
||||||
$number=$obj->number;
|
$number = $obj->number;
|
||||||
$cvc=$obj->cvn; // cvn in database, cvc for stripe
|
$cvc = $obj->cvn; // cvn in database, cvc for stripe
|
||||||
$cardholdername=$obj->proprio;
|
$cardholdername = $obj->proprio;
|
||||||
|
|
||||||
$dataforcard = array(
|
$dataforcard = array(
|
||||||
"source" => array('object'=>'card', 'exp_month'=>$exp_date_month, 'exp_year'=>$exp_date_year, 'number'=>$number, 'cvc'=>$cvc, 'name'=>$cardholdername),
|
"source" => array('object'=>'card', 'exp_month'=>$exp_date_month, 'exp_year'=>$exp_date_year, 'number'=>$number, 'cvc'=>$cvc, 'name'=>$cardholdername),
|
||||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))
|
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']))
|
||||||
);
|
);
|
||||||
|
|
||||||
//$a = \Stripe\Stripe::getApiKey();
|
//$a = \Stripe\Stripe::getApiKey();
|
||||||
@ -778,14 +778,14 @@ class Stripe extends CommonObject
|
|||||||
|
|
||||||
if ($card)
|
if ($card)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "societe_rib";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib";
|
||||||
$sql.= " SET stripe_card_ref = '".$this->db->escape($card->id)."', card_type = '".$this->db->escape($card->brand)."',";
|
$sql .= " SET stripe_card_ref = '".$this->db->escape($card->id)."', card_type = '".$this->db->escape($card->brand)."',";
|
||||||
$sql.= " country_code = '".$this->db->escape($card->country)."',";
|
$sql .= " country_code = '".$this->db->escape($card->country)."',";
|
||||||
$sql.= " approved = ".($card->cvc_check == 'pass' ? 1 : 0);
|
$sql .= " approved = ".($card->cvc_check == 'pass' ? 1 : 0);
|
||||||
$sql.= " WHERE rowid = " . $object->id;
|
$sql .= " WHERE rowid = ".$object->id;
|
||||||
$sql.= " AND type = 'card'";
|
$sql .= " AND type = 'card'";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
@ -795,7 +795,7 @@ class Stripe extends CommonObject
|
|||||||
$this->error = 'Call to cu->source->create return empty card';
|
$this->error = 'Call to cu->source->create return empty card';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->error = $e->getMessage();
|
$this->error = $e->getMessage();
|
||||||
dol_syslog($this->error, LOG_WARNING);
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
@ -837,12 +837,12 @@ class Stripe extends CommonObject
|
|||||||
else $service = 'StripeLive';
|
else $service = 'StripeLive';
|
||||||
|
|
||||||
$sql = "SELECT sa.key_account as key_account, sa.fk_soc, sa.entity";
|
$sql = "SELECT sa.key_account as key_account, sa.fk_soc, sa.entity";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
|
||||||
$sql.= " WHERE sa.key_account = '" . $this->db->escape($customer) . "'";
|
$sql .= " WHERE sa.key_account = '".$this->db->escape($customer)."'";
|
||||||
//$sql.= " AND sa.entity IN (".getEntity('societe').")";
|
//$sql.= " AND sa.entity IN (".getEntity('societe').")";
|
||||||
$sql.= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
$sql .= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if ($this->db->num_rows($result)) {
|
if ($this->db->num_rows($result)) {
|
||||||
@ -855,8 +855,8 @@ class Stripe extends CommonObject
|
|||||||
$key = null;
|
$key = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
$arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||||
if (! in_array($currency, $arrayzerounitcurrency)) $stripeamount=$amount * 100;
|
if (!in_array($currency, $arrayzerounitcurrency)) $stripeamount = $amount * 100;
|
||||||
else $stripeamount = $amount;
|
else $stripeamount = $amount;
|
||||||
|
|
||||||
$societe = new Societe($this->db);
|
$societe = new Societe($this->db);
|
||||||
@ -868,22 +868,22 @@ class Stripe extends CommonObject
|
|||||||
$order = new Commande($this->db);
|
$order = new Commande($this->db);
|
||||||
$order->fetch($item);
|
$order->fetch($item);
|
||||||
$ref = $order->ref;
|
$ref = $order->ref;
|
||||||
$description = "ORD=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
$description = "ORD=".$ref.".CUS=".$societe->id.".PM=stripe";
|
||||||
} elseif ($origin == 'invoice') {
|
} elseif ($origin == 'invoice') {
|
||||||
$invoice = new Facture($this->db);
|
$invoice = new Facture($this->db);
|
||||||
$invoice->fetch($item);
|
$invoice->fetch($item);
|
||||||
$ref = $invoice->ref;
|
$ref = $invoice->ref;
|
||||||
$description = "INV=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
$description = "INV=".$ref.".CUS=".$societe->id.".PM=stripe";
|
||||||
}
|
}
|
||||||
|
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
"dol_id" => "" . $item . "",
|
"dol_id" => "".$item."",
|
||||||
"dol_type" => "" . $origin . "",
|
"dol_type" => "".$origin."",
|
||||||
"dol_thirdparty_id" => "" . $societe->id . "",
|
"dol_thirdparty_id" => "".$societe->id."",
|
||||||
'dol_thirdparty_name' => $societe->name,
|
'dol_thirdparty_name' => $societe->name,
|
||||||
'dol_version'=>DOL_VERSION,
|
'dol_version'=>DOL_VERSION,
|
||||||
'dol_entity'=>$conf->entity,
|
'dol_entity'=>$conf->entity,
|
||||||
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])
|
'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])
|
||||||
);
|
);
|
||||||
$return = new Stripe($this->db);
|
$return = new Stripe($this->db);
|
||||||
try {
|
try {
|
||||||
@ -897,13 +897,13 @@ class Stripe extends CommonObject
|
|||||||
{
|
{
|
||||||
$stripecard = $source;
|
$stripecard = $source;
|
||||||
$amountstripe = $stripeamount;
|
$amountstripe = $stripeamount;
|
||||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||||
$stripe = $return;
|
$stripe = $return;
|
||||||
$amounttopay = $amount;
|
$amounttopay = $amount;
|
||||||
$servicestatus = $status;
|
$servicestatus = $status;
|
||||||
|
|
||||||
dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG);
|
dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG);
|
||||||
$stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here)
|
$stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here)
|
||||||
|
|
||||||
dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
|
dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
|
||||||
|
|
||||||
@ -931,7 +931,7 @@ class Stripe extends CommonObject
|
|||||||
$charge = \Stripe\Charge::create(array(
|
$charge = \Stripe\Charge::create(array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
"capture" => $capture,
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
@ -941,7 +941,7 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
"capture" => $capture,
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
@ -965,20 +965,20 @@ class Stripe extends CommonObject
|
|||||||
$fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
|
$fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100);
|
if (!in_array($currency, $arrayzerounitcurrency)) $stripefee = round($fee * 100);
|
||||||
else $stripefee = round($fee);
|
else $stripefee = round($fee);
|
||||||
|
|
||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
"statement_descriptor" => dol_trunc($description, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
"capture" => $capture,
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
);
|
);
|
||||||
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0)
|
if ($conf->entity != $conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0)
|
||||||
{
|
{
|
||||||
$paymentarray["application_fee_amount"] = $stripefee;
|
$paymentarray["application_fee_amount"] = $stripefee;
|
||||||
}
|
}
|
||||||
@ -991,13 +991,13 @@ class Stripe extends CommonObject
|
|||||||
{
|
{
|
||||||
$stripecard = $source;
|
$stripecard = $source;
|
||||||
$amountstripe = $stripeamount;
|
$amountstripe = $stripeamount;
|
||||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||||
$stripe = $return;
|
$stripe = $return;
|
||||||
$amounttopay = $amount;
|
$amounttopay = $amount;
|
||||||
$servicestatus = $status;
|
$servicestatus = $status;
|
||||||
|
|
||||||
dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG);
|
dol_syslog("* createPaymentStripe get stripeacc", LOG_DEBUG);
|
||||||
$stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here)
|
$stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account if it exists (no network access here)
|
||||||
|
|
||||||
dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
|
dol_syslog("* createPaymentStripe Create payment on card ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
|
||||||
|
|
||||||
@ -1035,13 +1035,13 @@ class Stripe extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($charge->source->type == 'card') {
|
if ($charge->source->type == 'card') {
|
||||||
$return->message = $charge->source->card->brand . " ...." . $charge->source->card->last4;
|
$return->message = $charge->source->card->brand." ....".$charge->source->card->last4;
|
||||||
} elseif ($charge->source->type == 'three_d_secure') {
|
} elseif ($charge->source->type == 'three_d_secure') {
|
||||||
$stripe = new Stripe($this->db);
|
$stripe = new Stripe($this->db);
|
||||||
$src = \Stripe\Source::retrieve("" . $charge->source->three_d_secure->card . "", array(
|
$src = \Stripe\Source::retrieve("".$charge->source->three_d_secure->card."", array(
|
||||||
"stripe_account" => $stripe->getStripeAccount($service)
|
"stripe_account" => $stripe->getStripeAccount($service)
|
||||||
));
|
));
|
||||||
$return->message = $src->card->brand . " ...." . $src->card->last4;
|
$return->message = $src->card->brand." ....".$src->card->last4;
|
||||||
} else {
|
} else {
|
||||||
$return->message = $charge->id;
|
$return->message = $charge->id;
|
||||||
}
|
}
|
||||||
@ -1057,7 +1057,7 @@ class Stripe extends CommonObject
|
|||||||
$return->type = $err['type'];
|
$return->type = $err['type'];
|
||||||
$return->code = $err['code'];
|
$return->code = $err['code'];
|
||||||
$return->message = $err['message'];
|
$return->message = $err['message'];
|
||||||
$body = "Error: <br>" . $return->id . " " . $return->message . " ";
|
$body = "Error: <br>".$return->id." ".$return->message." ";
|
||||||
$subject = '[Alert] Payment error using Stripe';
|
$subject = '[Alert] Payment error using Stripe';
|
||||||
$cmailfile = new CMailFile($subject, $conf->global->ONLINE_PAYMENT_SENDEMAIL, $conf->global->MAIN_INFO_SOCIETE_MAIL, $body);
|
$cmailfile = new CMailFile($subject, $conf->global->ONLINE_PAYMENT_SENDEMAIL, $conf->global->MAIN_INFO_SOCIETE_MAIL, $body);
|
||||||
$cmailfile->sendfile();
|
$cmailfile->sendfile();
|
||||||
|
|||||||
@ -26,49 +26,49 @@
|
|||||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
require '../main.inc.php'; // Load $user and permissions
|
require '../main.inc.php'; // Load $user and permissions
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
|
||||||
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$setterminal = GETPOST('setterminal', 'int');
|
$setterminal = GETPOST('setterminal', 'int');
|
||||||
|
|
||||||
if ($setterminal>0)
|
if ($setterminal > 0)
|
||||||
{
|
{
|
||||||
$_SESSION["takeposterminal"]=$setterminal;
|
$_SESSION["takeposterminal"] = $setterminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION["urlfrom"]='/takepos/takepos.php';
|
$_SESSION["urlfrom"] = '/takepos/takepos.php';
|
||||||
|
|
||||||
$langs->loadLangs(array("bills","orders","commercial","cashdesk","receiptprinter"));
|
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
|
||||||
|
|
||||||
$categorie = new Categorie($db);
|
$categorie = new Categorie($db);
|
||||||
|
|
||||||
$maxcategbydefaultforthisdevice=16;
|
$maxcategbydefaultforthisdevice = 16;
|
||||||
$maxproductbydefaultforthisdevice=32;
|
$maxproductbydefaultforthisdevice = 32;
|
||||||
if ($conf->browser->layout == 'phone')
|
if ($conf->browser->layout == 'phone')
|
||||||
{
|
{
|
||||||
$maxcategbydefaultforthisdevice=8;
|
$maxcategbydefaultforthisdevice = 8;
|
||||||
$maxproductbydefaultforthisdevice=16;
|
$maxproductbydefaultforthisdevice = 16;
|
||||||
//REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED
|
//REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED
|
||||||
if ($_SESSION["takeposterminal"]!="" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1)
|
if ($_SESSION["takeposterminal"] != "" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1)
|
||||||
{
|
{
|
||||||
$_SESSION["basiclayout"]=1;
|
$_SESSION["basiclayout"] = 1;
|
||||||
header("Location: phone.php?mobilepage=invoice");
|
header("Location: phone.php?mobilepage=invoice");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?$maxcategbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXCATEG);
|
$MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG) ? $maxcategbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXCATEG);
|
||||||
$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXPRODUCT);
|
$MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT) ? $maxproductbydefaultforthisdevice : $conf->global->TAKEPOS_NB_MAXPRODUCT);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -76,9 +76,9 @@ $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultf
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
$title='TakePOS - Dolibarr '.DOL_VERSION;
|
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
||||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||||
$head='<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
|
||||||
@ -90,15 +90,15 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
|||||||
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
|
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script> <!-- TODO It seems we don't need this -->
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
<?php
|
<?php
|
||||||
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)?$conf->global->TAKEPOS_ROOT_CATEGORY_ID:0), 1);
|
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
|
||||||
|
|
||||||
|
|
||||||
// Search root category to know its level
|
// Search root category to know its level
|
||||||
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
|
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
|
||||||
$levelofrootcategory=0;
|
$levelofrootcategory = 0;
|
||||||
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
|
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
|
||||||
{
|
{
|
||||||
foreach($categories as $key => $categorycursor)
|
foreach ($categories as $key => $categorycursor)
|
||||||
{
|
{
|
||||||
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
|
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ $levelofmaincategories = $levelofrootcategory + 1;
|
|||||||
|
|
||||||
$maincategories = array();
|
$maincategories = array();
|
||||||
$subcategories = array();
|
$subcategories = array();
|
||||||
foreach($categories as $key => $categorycursor)
|
foreach ($categories as $key => $categorycursor)
|
||||||
{
|
{
|
||||||
if ($categorycursor['level'] == $levelofmaincategories)
|
if ($categorycursor['level'] == $levelofmaincategories)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ var currentcat;
|
|||||||
var pageproducts=0;
|
var pageproducts=0;
|
||||||
var pagecategories=0;
|
var pagecategories=0;
|
||||||
var pageactions=0;
|
var pageactions=0;
|
||||||
var place="<?php echo $place;?>";
|
var place="<?php echo $place; ?>";
|
||||||
var editaction="qty";
|
var editaction="qty";
|
||||||
var editnumber="";
|
var editnumber="";
|
||||||
|
|
||||||
@ -367,13 +367,13 @@ function deleteline() {
|
|||||||
|
|
||||||
function Customer() {
|
function Customer() {
|
||||||
console.log("Open box to select the thirdparty place="+place);
|
console.log("Open box to select the thirdparty place="+place);
|
||||||
$.colorbox({href:"../societe/list.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer");?>"});
|
$.colorbox({href:"../societe/list.php?contextpage=poslist&nomassaction=1&place="+place, width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Customer"); ?>"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function History()
|
function History()
|
||||||
{
|
{
|
||||||
console.log("Open box to select the history");
|
console.log("Open box to select the history");
|
||||||
$.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History");?>"});
|
$.colorbox({href:"../compta/facture/list.php?contextpage=poslist", width:"90%", height:"80%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("History"); ?>"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function CloseBill() {
|
function CloseBill() {
|
||||||
@ -384,17 +384,17 @@ function CloseBill() {
|
|||||||
|
|
||||||
function Floors() {
|
function Floors() {
|
||||||
console.log("Open box to select floor");
|
console.log("Open box to select floor");
|
||||||
$.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors");?>"});
|
$.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("Floors"); ?>"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function FreeZone() {
|
function FreeZone() {
|
||||||
console.log("Open box to enter a free product");
|
console.log("Open box to enter a free product");
|
||||||
$.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone");?>"});
|
$.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function TakeposOrderNotes() {
|
function TakeposOrderNotes() {
|
||||||
console.log("Open box to order notes");
|
console.log("Open box to order notes");
|
||||||
$.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("OrderNotes");?>"});
|
$.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("OrderNotes"); ?>"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function Refresh() {
|
function Refresh() {
|
||||||
@ -575,7 +575,7 @@ function TerminalsDialog()
|
|||||||
{
|
{
|
||||||
jQuery("#dialog-info").dialog({
|
jQuery("#dialog-info").dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
height: <?php echo 180+round($conf->global->TAKEPOS_NUM_TERMINALS / 3 * 20); ?>,
|
height: <?php echo 180 + round($conf->global->TAKEPOS_NUM_TERMINALS / 3 * 20); ?>,
|
||||||
width: <?php echo ($conf->dol_optimize_smallscreen ? 316 : 400); ?>,
|
width: <?php echo ($conf->dol_optimize_smallscreen ? 316 : 400); ?>,
|
||||||
modal: true,
|
modal: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
@ -598,7 +598,7 @@ function TerminalsDialog()
|
|||||||
|
|
||||||
function DirectPayment(){
|
function DirectPayment(){
|
||||||
console.log("DirectPayment");
|
console.log("DirectPayment");
|
||||||
$("#poslines").load("invoice.php?place"+place+"&action=valid&pay=<?php echo $langs->trans("cash");?>", function() {
|
$("#poslines").load("invoice.php?place"+place+"&action=valid&pay=<?php echo $langs->trans("cash"); ?>", function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,9 +608,9 @@ $( document ).ready(function() {
|
|||||||
Refresh();
|
Refresh();
|
||||||
<?php
|
<?php
|
||||||
//IF NO TERMINAL SELECTED
|
//IF NO TERMINAL SELECTED
|
||||||
if ($_SESSION["takeposterminal"]=="")
|
if ($_SESSION["takeposterminal"] == "")
|
||||||
{
|
{
|
||||||
if ($conf->global->TAKEPOS_NUM_TERMINALS=="1") $_SESSION["takeposterminal"]=1;
|
if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1;
|
||||||
else print "TerminalsDialog();";
|
else print "TerminalsDialog();";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -619,7 +619,7 @@ $( document ).ready(function() {
|
|||||||
|
|
||||||
<body style="overflow: hidden; background-color:#D1D1D1;">
|
<body style="overflow: hidden; background-color:#D1D1D1;">
|
||||||
<?php
|
<?php
|
||||||
if ($conf->global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="") print '<div id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
|
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row1">
|
<div class="row1">
|
||||||
@ -650,21 +650,21 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="
|
|||||||
|
|
||||||
// TakePOS setup check
|
// TakePOS setup check
|
||||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||||
$sql.= " AND active = 1";
|
$sql .= " AND active = 1";
|
||||||
$sql.= " ORDER BY libelle";
|
$sql .= " ORDER BY libelle";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$paiementsModes = array();
|
$paiementsModes = array();
|
||||||
if ($resql){
|
if ($resql) {
|
||||||
while ($obj = $db->fetch_object($resql)){
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
$paycode = $obj->code;
|
$paycode = $obj->code;
|
||||||
if ($paycode == 'LIQ') $paycode = 'CASH';
|
if ($paycode == 'LIQ') $paycode = 'CASH';
|
||||||
if ($paycode == 'CHQ') $paycode = 'CHEQUE';
|
if ($paycode == 'CHQ') $paycode = 'CHEQUE';
|
||||||
|
|
||||||
$constantforkey="CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
|
$constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"];
|
||||||
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
|
//var_dump($constantforkey.' '.$conf->global->$constantforkey);
|
||||||
if (! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) array_push($paiementsModes, $obj);
|
if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) array_push($paiementsModes, $obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,30 +673,30 @@ if (empty($paiementsModes)) {
|
|||||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
|
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors');
|
||||||
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal").' '.$_SESSION["takeposterminal"], null, 'errors');
|
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal").' '.$_SESSION["takeposterminal"], null, 'errors');
|
||||||
}
|
}
|
||||||
if (count($maincategories)==0) {
|
if (count($maincategories) == 0) {
|
||||||
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
|
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
|
||||||
}
|
}
|
||||||
// User menu and external TakePOS modules
|
// User menu and external TakePOS modules
|
||||||
$menus = array();
|
$menus = array();
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
if (empty($conf->global->TAKEPOS_BAR_RESTAURANT))
|
if (empty($conf->global->TAKEPOS_BAR_RESTAURANT))
|
||||||
{
|
{
|
||||||
$menus[$r++]=array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("New").'</div>', 'action'=>'New();');
|
$menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("New").'</div>', 'action'=>'New();');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// BAR RESTAURANT specific menu
|
// BAR RESTAURANT specific menu
|
||||||
$menus[$r++]=array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("Place").'</div>', 'action'=>'Floors();');
|
$menus[$r++] = array('title'=>'<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">'.$langs->trans("Place").'</div>', 'action'=>'Floors();');
|
||||||
}
|
}
|
||||||
|
|
||||||
$menus[$r++]=array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();');
|
$menus[$r++] = array('title'=>'<span class="far fa-building paddingrightonly"></span><div class="trunc">'.$langs->trans("Customer").'</div>', 'action'=>'Customer();');
|
||||||
$menus[$r++]=array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
|
$menus[$r++] = array('title'=>'<span class="fa fa-history paddingrightonly"></span><div class="trunc">'.$langs->trans("History").'</div>', 'action'=>'History();');
|
||||||
$menus[$r++]=array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
|
$menus[$r++] = array('title'=>'<span class="fa fa-cube paddingrightonly"></span><div class="trunc">'.$langs->trans("FreeZone").'</div>', 'action'=>'FreeZone();');
|
||||||
$menus[$r++]=array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
|
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
|
||||||
|
|
||||||
if ($conf->global->TAKEPOS_DIRECT_PAYMENT){
|
if ($conf->global->TAKEPOS_DIRECT_PAYMENT) {
|
||||||
$menus[$r++]=array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").'</div>', 'action'=>'DirectPayment();');
|
$menus[$r++] = array('title'=>'<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("DirectPayment").'</div>', 'action'=>'DirectPayment();');
|
||||||
}
|
}
|
||||||
|
|
||||||
// BAR RESTAURANT specific menu
|
// BAR RESTAURANT specific menu
|
||||||
@ -755,7 +755,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
|||||||
echo '<button style="'.$menu['style'].'" type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).');">'.$langs->trans("Next").'</button>';
|
echo '<button style="'.$menu['style'].'" type="button" id="actionnext" class="actionbutton" onclick="MoreActions('.count($menus).');">'.$langs->trans("Next").'</button>';
|
||||||
echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
||||||
}
|
}
|
||||||
elseif ($i>9) echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
elseif ($i > 9) echo '<button style="display: none;" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
||||||
else echo '<button style="'.$menu['style'].'" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
else echo '<button style="'.$menu['style'].'" type="button" id="action'.$i.'" class="actionbutton" onclick="'.$menu['action'].'">'.$menu['title'].'</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,17 +773,17 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
|||||||
<!-- Show categories -->
|
<!-- Show categories -->
|
||||||
<div class="div4">
|
<div class="div4">
|
||||||
<?php
|
<?php
|
||||||
$count=0;
|
$count = 0;
|
||||||
while ($count < $MAXCATEG)
|
while ($count < $MAXCATEG)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="wrapper" <?php if ($count==($MAXCATEG-2)) echo 'onclick="MoreCategories(\'less\');"'; elseif ($count==($MAXCATEG-1)) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id="catdiv<?php echo $count;?>">
|
<div class="wrapper" <?php if ($count == ($MAXCATEG - 2)) echo 'onclick="MoreCategories(\'less\');"'; elseif ($count == ($MAXCATEG - 1)) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"'; ?> id="catdiv<?php echo $count; ?>">
|
||||||
<?php
|
<?php
|
||||||
if ($count==($MAXCATEG-2)) {
|
if ($count == ($MAXCATEG - 2)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
elseif ($count==($MAXCATEG-1)) {
|
elseif ($count == ($MAXCATEG - 1)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
@ -792,12 +792,12 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
|||||||
echo '<img class="imgwrapper" height="100%" id="catimg'.$count.'" />';
|
echo '<img class="imgwrapper" height="100%" id="catimg'.$count.'" />';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($count!=($MAXCATEG-2) && $count!=($MAXCATEG-1)) { ?>
|
<?php if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
|
||||||
<div class="description" id="catdivdesc<?php echo $count;?>">
|
<div class="description" id="catdivdesc<?php echo $count; ?>">
|
||||||
<div class="description_content" id="catdesc<?php echo $count;?>"></div>
|
<div class="description_content" id="catdesc<?php echo $count; ?>"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="catwatermark" id='catwatermark<?php echo $count;?>'>+</div>
|
<div class="catwatermark" id='catwatermark<?php echo $count; ?>'>+</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$count++;
|
$count++;
|
||||||
@ -808,17 +808,17 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
|||||||
<!-- Show product -->
|
<!-- Show product -->
|
||||||
<div class="div5">
|
<div class="div5">
|
||||||
<?php
|
<?php
|
||||||
$count=0;
|
$count = 0;
|
||||||
while ($count < $MAXPRODUCT)
|
while ($count < $MAXPRODUCT)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="wrapper2" id='prodiv<?php echo $count;?>' <?php if ($count==($MAXPRODUCT-2)) {?> onclick="MoreProducts('less');" <?php } if ($count==($MAXPRODUCT-1)) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>>
|
<div class="wrapper2" id='prodiv<?php echo $count; ?>' <?php if ($count == ($MAXPRODUCT - 2)) {?> onclick="MoreProducts('less');" <?php } if ($count == ($MAXPRODUCT - 1)) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"'; ?>>
|
||||||
<?php
|
<?php
|
||||||
if ($count==($MAXPRODUCT-2)) {
|
if ($count == ($MAXPRODUCT - 2)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
elseif ($count==($MAXPRODUCT-1)) {
|
elseif ($count == ($MAXPRODUCT - 1)) {
|
||||||
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
|
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
|
||||||
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em;"></span>';
|
||||||
}
|
}
|
||||||
@ -827,12 +827,12 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
|||||||
echo '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
|
echo '<img class="imgwrapper" height="100%" title="" id="proimg'.$count.'">';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($count!=($MAXPRODUCT-2) && $count!=($MAXPRODUCT-1)) { ?>
|
<?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1)) { ?>
|
||||||
<div class="description" id="prodivdesc<?php echo $count;?>">
|
<div class="description" id="prodivdesc<?php echo $count; ?>">
|
||||||
<div class="description_content" id="prodesc<?php echo $count;?>"></div>
|
<div class="description_content" id="prodesc<?php echo $count; ?>"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="catwatermark" id='prowatermark<?php echo $count;?>'>+</div>
|
<div class="catwatermark" id='prowatermark<?php echo $count; ?>'>+</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$count++;
|
$count++;
|
||||||
|
|||||||
@ -31,92 +31,92 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
||||||
$theme_bordercolor = array(235,235,224);
|
$theme_bordercolor = array(235, 235, 224);
|
||||||
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
if (! defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
|
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
|
||||||
{
|
{
|
||||||
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
|
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
|
||||||
{
|
{
|
||||||
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// for now we use the same configuration for all types of color blind
|
// for now we use the same configuration for all types of color blind
|
||||||
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85,135,150), array(150,135,80), array(150,80,150));
|
$theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4'));
|
$theme_bgcolor = array(hexdec('F4'), hexdec('F4'), hexdec('F4'));
|
||||||
$theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));
|
$theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC'));
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
$colorbackhmenu1='60,70,100'; // topmenu
|
$colorbackhmenu1 = '60,70,100'; // topmenu
|
||||||
$colorbackvmenu1='250,250,250'; // vmenu
|
$colorbackvmenu1 = '250,250,250'; // vmenu
|
||||||
$colortopbordertitle1='200,200,200'; // top border of title
|
$colortopbordertitle1 = '200,200,200'; // top border of title
|
||||||
$colorbacktitle1='233,234,237'; // title of tables,list
|
$colorbacktitle1 = '233,234,237'; // title of tables,list
|
||||||
$colorbacktabcard1='255,255,255'; // card
|
$colorbacktabcard1 = '255,255,255'; // card
|
||||||
$colorbacktabactive='234,234,234';
|
$colorbacktabactive = '234,234,234';
|
||||||
$colorbacklineimpair1='255,255,255'; // line impair
|
$colorbacklineimpair1 = '255,255,255'; // line impair
|
||||||
$colorbacklineimpair2='255,255,255'; // line impair
|
$colorbacklineimpair2 = '255,255,255'; // line impair
|
||||||
$colorbacklinepair1='250,250,250'; // line pair
|
$colorbacklinepair1 = '250,250,250'; // line pair
|
||||||
$colorbacklinepair2='250,250,250'; // line pair
|
$colorbacklinepair2 = '250,250,250'; // line pair
|
||||||
$colorbacklinepairhover='230,237,244'; // line hover
|
$colorbacklinepairhover = '230,237,244'; // line hover
|
||||||
$colorbacklinepairchecked='230,237,244'; // line checked
|
$colorbacklinepairchecked = '230,237,244'; // line checked
|
||||||
$colorbacklinebreak='233,228,230'; // line break
|
$colorbacklinebreak = '233,228,230'; // line break
|
||||||
$colorbackbody='255,255,255';
|
$colorbackbody = '255,255,255';
|
||||||
$colortexttitlenotab='140,80,10'; // 140,80,10 or 10,140,80
|
$colortexttitlenotab = '140,80,10'; // 140,80,10 or 10,140,80
|
||||||
$colortexttitle='0,0,0';
|
$colortexttitle = '0,0,0';
|
||||||
$colortext='0,0,0';
|
$colortext = '0,0,0';
|
||||||
$colortextlink='10, 20, 100';
|
$colortextlink = '10, 20, 100';
|
||||||
$fontsize='0.86em';
|
$fontsize = '0.86em';
|
||||||
$fontsizesmaller='0.75em';
|
$fontsizesmaller = '0.75em';
|
||||||
$topMenuFontSize='1.2em';
|
$topMenuFontSize = '1.2em';
|
||||||
$toolTipBgColor='rgba(255, 255, 255, 0.96)';
|
$toolTipBgColor = 'rgba(255, 255, 255, 0.96)';
|
||||||
$toolTipFontColor='#333';
|
$toolTipFontColor = '#333';
|
||||||
|
|
||||||
// text color
|
// text color
|
||||||
$textSuccess ='#28a745';
|
$textSuccess = '#28a745';
|
||||||
$colorblind_deuteranopes_textSuccess ='#37de5d';
|
$colorblind_deuteranopes_textSuccess = '#37de5d';
|
||||||
$textDanger ='#dc3545';
|
$textDanger = '#dc3545';
|
||||||
$textWarning ='#bc9526';
|
$textWarning = '#bc9526';
|
||||||
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
||||||
|
|
||||||
|
|
||||||
// Badges colors
|
// Badges colors
|
||||||
$badgePrimary ='#007bff';
|
$badgePrimary = '#007bff';
|
||||||
$badgeSecondary ='#cccccc';
|
$badgeSecondary = '#cccccc';
|
||||||
$badgeSuccess ='#28a745';
|
$badgeSuccess = '#28a745';
|
||||||
$badgeDanger ='#9f4705';
|
$badgeDanger = '#9f4705';
|
||||||
$badgeWarning ='#ffc107';
|
$badgeWarning = '#ffc107';
|
||||||
$badgeInfo ='#aaaabb';
|
$badgeInfo = '#aaaabb';
|
||||||
$badgeDark ='#343a40';
|
$badgeDark = '#343a40';
|
||||||
$badgeLight ='#f8f9fa';
|
$badgeLight = '#f8f9fa';
|
||||||
|
|
||||||
// badge color ajustement for color blind
|
// badge color ajustement for color blind
|
||||||
$colorblind_deuteranopes_badgeSuccess ='#37de5d'; //! text color black
|
$colorblind_deuteranopes_badgeSuccess = '#37de5d'; //! text color black
|
||||||
$colorblind_deuteranopes_badgeSuccess_textColor7='#000';
|
$colorblind_deuteranopes_badgeSuccess_textColor7 = '#000';
|
||||||
$colorblind_deuteranopes_badgeWarning ='#e4e411';
|
$colorblind_deuteranopes_badgeWarning = '#e4e411';
|
||||||
|
|
||||||
/* default color for status : After a quick check, somme status can have oposite function according to objects
|
/* default color for status : After a quick check, somme status can have oposite function according to objects
|
||||||
* So this badges status uses default value according to theme eldy status img
|
* So this badges status uses default value according to theme eldy status img
|
||||||
* TODO: use color definition vars above for define badges color status X -> exemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
|
* TODO: use color definition vars above for define badges color status X -> exemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
|
||||||
*/
|
*/
|
||||||
$badgeStatus0='#cbd3d3';
|
$badgeStatus0 = '#cbd3d3';
|
||||||
$badgeStatus1='#bc9526';
|
$badgeStatus1 = '#bc9526';
|
||||||
$badgeStatus2='#e6f0f0';
|
$badgeStatus2 = '#e6f0f0';
|
||||||
$badgeStatus3='#bca52b';
|
$badgeStatus3 = '#bca52b';
|
||||||
$badgeStatus4='#277d1e';
|
$badgeStatus4 = '#277d1e';
|
||||||
$badgeStatus5='#cad2d2';
|
$badgeStatus5 = '#cad2d2';
|
||||||
$badgeStatus6='#cad2d2';
|
$badgeStatus6 = '#cad2d2';
|
||||||
$badgeStatus7='#baa32b';
|
$badgeStatus7 = '#baa32b';
|
||||||
$badgeStatus8='#be3013';
|
$badgeStatus8 = '#be3013';
|
||||||
$badgeStatus9='#e7f0f0';
|
$badgeStatus9 = '#e7f0f0';
|
||||||
|
|
||||||
// status color ajustement for color blind
|
// status color ajustement for color blind
|
||||||
$colorblind_deuteranopes_badgeStatus4=$colorblind_deuteranopes_badgeStatus7=$colorblind_deuteranopes_badgeSuccess; //! text color black
|
$colorblind_deuteranopes_badgeStatus4 = $colorblind_deuteranopes_badgeStatus7 = $colorblind_deuteranopes_badgeSuccess; //! text color black
|
||||||
$colorblind_deuteranopes_badgeStatus_textColor4=$colorblind_deuteranopes_badgeStatus_textColor7='#000';
|
$colorblind_deuteranopes_badgeStatus_textColor4 = $colorblind_deuteranopes_badgeStatus_textColor7 = '#000';
|
||||||
$colorblind_deuteranopes_badgeStatus1=$colorblind_deuteranopes_badgeWarning;
|
$colorblind_deuteranopes_badgeStatus1 = $colorblind_deuteranopes_badgeWarning;
|
||||||
$colorblind_deuteranopes_badgeStatus_textColor1='#000';
|
$colorblind_deuteranopes_badgeStatus_textColor1 = '#000';
|
||||||
|
|||||||
@ -28,20 +28,20 @@
|
|||||||
|
|
||||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
||||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||||
if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
|
|
||||||
define('ISLOADEDBYSTEELSHEET', '1');
|
define('ISLOADEDBYSTEELSHEET', '1');
|
||||||
|
|
||||||
|
|
||||||
require __DIR__ . '/theme_vars.inc.php';
|
require __DIR__.'/theme_vars.inc.php';
|
||||||
if (defined('THEME_ONLY_CONSTANT')) return;
|
if (defined('THEME_ONLY_CONSTANT')) return;
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||||||
|
|
||||||
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
||||||
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
|
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
|
||||||
if (empty($user->id) && ! empty($_SESSION['dol_login']))
|
if (empty($user->id) && !empty($_SESSION['dol_login']))
|
||||||
{
|
{
|
||||||
$user->fetch('', $_SESSION['dol_login'], '', 1);
|
$user->fetch('', $_SESSION['dol_login'], '', 1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
@ -66,135 +66,135 @@ top_httphead('text/css');
|
|||||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||||
else header('Cache-Control: no-cache');
|
else header('Cache-Control: no-cache');
|
||||||
|
|
||||||
if (GETPOST('theme', 'alpha')) $conf->theme=GETPOST('theme', 'alpha'); // If theme was forced on URL
|
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
||||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||||
|
|
||||||
$langs->load("main", 0, 1);
|
$langs->load("main", 0, 1);
|
||||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
||||||
|
|
||||||
$path=''; // This value may be used in future for external module to overwrite theme
|
$path = ''; // This value may be used in future for external module to overwrite theme
|
||||||
$theme='md'; // Value of theme
|
$theme = 'md'; // Value of theme
|
||||||
if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; }
|
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; }
|
||||||
|
|
||||||
// Define image path files and other constants
|
// Define image path files and other constants
|
||||||
$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif';
|
$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif';
|
||||||
$img_head='';
|
$img_head = '';
|
||||||
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
$dol_hide_topmenu = $conf->dol_hide_topmenu;
|
||||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
$dol_hide_leftmenu = $conf->dol_hide_leftmenu;
|
||||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen;
|
||||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
$dol_no_mouse_hover = $conf->dol_no_mouse_hover;
|
||||||
|
|
||||||
|
|
||||||
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||||
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||||
//var_dump($user->conf->THEME_ELDY_RGB);
|
//var_dump($user->conf->THEME_ELDY_RGB);
|
||||||
|
|
||||||
$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0);
|
$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0);
|
||||||
$borderwidth=2;
|
$borderwidth = 2;
|
||||||
|
|
||||||
// Case of option always editable
|
// Case of option always editable
|
||||||
if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody;
|
if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
|
||||||
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
|
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
|
||||||
if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1;
|
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
|
||||||
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1;
|
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
|
||||||
if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover;
|
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
|
||||||
if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked;
|
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
|
||||||
if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak;
|
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
|
||||||
if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
|
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
|
||||||
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
|
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
|
||||||
|
|
||||||
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
// 90A4AE, 607D8B, 455A64, 37474F
|
// 90A4AE, 607D8B, 455A64, 37474F
|
||||||
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
|
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
|
||||||
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
|
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
|
||||||
$conf->global->THEME_ELDY_TEXT='0,0,0';
|
$conf->global->THEME_ELDY_TEXT = '0,0,0';
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE1='14';
|
$conf->global->THEME_ELDY_FONT_SIZE1 = '14';
|
||||||
$conf->global->THEME_ELDY_FONT_SIZE2='11';
|
$conf->global->THEME_ELDY_FONT_SIZE2 = '11';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
// Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||||
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
|
$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
|
||||||
$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1);
|
$colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $conf->global->THEME_ELDY_VERMENU_BACK1) : (empty($user->conf->THEME_ELDY_VERMENU_BACK1) ? $colorbackvmenu1 : $user->conf->THEME_ELDY_VERMENU_BACK1);
|
||||||
$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1);
|
$colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $conf->global->THEME_ELDY_TOPBORDER_TITLE1) : (empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1) ? $colortopbordertitle1 : $user->conf->THEME_ELDY_TOPBORDER_TITLE1);
|
||||||
$colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1);
|
$colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $conf->global->THEME_ELDY_BACKTITLE1) : (empty($user->conf->THEME_ELDY_BACKTITLE1) ? $colorbacktitle1 : $user->conf->THEME_ELDY_BACKTITLE1);
|
||||||
$colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1);
|
$colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $conf->global->THEME_ELDY_BACKTABCARD1) : (empty($user->conf->THEME_ELDY_BACKTABCARD1) ? $colorbacktabcard1 : $user->conf->THEME_ELDY_BACKTABCARD1);
|
||||||
$colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE);
|
$colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $conf->global->THEME_ELDY_BACKTABACTIVE) : (empty($user->conf->THEME_ELDY_BACKTABACTIVE) ? $colorbacktabactive : $user->conf->THEME_ELDY_BACKTABACTIVE);
|
||||||
$colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR1) ?$colorbacklineimpair1:$conf->global->THEME_ELDY_LINEIMPAIR1):(empty($user->conf->THEME_ELDY_LINEIMPAIR1)?$colorbacklineimpair1:$user->conf->THEME_ELDY_LINEIMPAIR1);
|
$colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $conf->global->THEME_ELDY_LINEIMPAIR1) : (empty($user->conf->THEME_ELDY_LINEIMPAIR1) ? $colorbacklineimpair1 : $user->conf->THEME_ELDY_LINEIMPAIR1);
|
||||||
$colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2);
|
$colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $conf->global->THEME_ELDY_LINEIMPAIR2) : (empty($user->conf->THEME_ELDY_LINEIMPAIR2) ? $colorbacklineimpair2 : $user->conf->THEME_ELDY_LINEIMPAIR2);
|
||||||
$colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1);
|
$colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $conf->global->THEME_ELDY_LINEPAIR1) : (empty($user->conf->THEME_ELDY_LINEPAIR1) ? $colorbacklinepair1 : $user->conf->THEME_ELDY_LINEPAIR1);
|
||||||
$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
|
$colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $conf->global->THEME_ELDY_LINEPAIR2) : (empty($user->conf->THEME_ELDY_LINEPAIR2) ? $colorbacklinepair2 : $user->conf->THEME_ELDY_LINEPAIR2);
|
||||||
$colorbacklinebreak =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEBREAK) ?$colorbacklinebreak:$conf->global->THEME_ELDY_LINEBREAK) :(empty($user->conf->THEME_ELDY_LINEBREAK)?$colorbacklinebreak:$user->conf->THEME_ELDY_LINEBREAK);
|
$colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $conf->global->THEME_ELDY_LINEBREAK) : (empty($user->conf->THEME_ELDY_LINEBREAK) ? $colorbacklinebreak : $user->conf->THEME_ELDY_LINEBREAK);
|
||||||
$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
|
$colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY);
|
||||||
$colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB);
|
$colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB);
|
||||||
$colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortext:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE);
|
$colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortext : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE);
|
||||||
$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
|
$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT);
|
||||||
$colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortext:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK);
|
$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortext : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK);
|
||||||
$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
|
$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1);
|
||||||
$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
|
$fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE2) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE2) : (empty($user->conf->THEME_ELDY_FONT_SIZE2) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE2);
|
||||||
|
|
||||||
// Hover color
|
// Hover color
|
||||||
$colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $conf->global->THEME_ELDY_USE_HOVER));
|
||||||
$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_CHECKED));
|
$colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'edf4fb' : $conf->global->THEME_ELDY_USE_CHECKED));
|
||||||
if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||||
{
|
{
|
||||||
$colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '255,255,255')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER));
|
$colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'edf4fb' : $user->conf->THEME_ELDY_USE_HOVER));
|
||||||
$colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '255,255,255')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_CHECKED));
|
$colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'edf4fb' : $user->conf->THEME_ELDY_USE_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1;
|
if (empty($colortopbordertitle1)) $colortopbordertitle1 = $colorbackhmenu1;
|
||||||
|
|
||||||
// Set text color to black or white
|
// Set text color to black or white
|
||||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbackhmenu1);
|
$tmppart = explode(',', $colorbackhmenu1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
|
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF';
|
||||||
else $colortextbackhmenu='000000';
|
else $colortextbackhmenu = '000000';
|
||||||
|
|
||||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbackvmenu1);
|
$tmppart = explode(',', $colorbackvmenu1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
|
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; }
|
||||||
else { $colortextbackvmenu='000000'; }
|
else { $colortextbackvmenu = '000000'; }
|
||||||
|
|
||||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbacktitle1);
|
$tmppart = explode(',', $colorbacktitle1);
|
||||||
if ($colortexttitle == '')
|
if ($colortexttitle == '')
|
||||||
{
|
{
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
|
if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; }
|
||||||
else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; }
|
else { $colortexttitle = '101010'; $colorshadowtitle = 'FFFFFF'; }
|
||||||
}
|
}
|
||||||
else $colorshadowtitle='888888';
|
else $colorshadowtitle = '888888';
|
||||||
|
|
||||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||||
$tmppart=explode(',', $colorbacktabcard1);
|
$tmppart = explode(',', $colorbacktabcard1);
|
||||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||||
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
|
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; }
|
||||||
else { $colortextbacktab='111111'; }
|
else { $colortextbacktab = '111111'; }
|
||||||
|
|
||||||
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
||||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1));
|
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1));
|
||||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1));
|
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1));
|
||||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1));
|
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1));
|
||||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1));
|
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1));
|
||||||
$colorbacktabactive=join(',', colorStringToArray($colorbacktabactive));
|
$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive));
|
||||||
$colorbacklineimpair1=join(',', colorStringToArray($colorbacklineimpair1));
|
$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
|
||||||
$colorbacklineimpair2=join(',', colorStringToArray($colorbacklineimpair2));
|
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
|
||||||
$colorbacklinepair1=join(',', colorStringToArray($colorbacklinepair1));
|
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
|
||||||
$colorbacklinepair2=join(',', colorStringToArray($colorbacklinepair2));
|
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
|
||||||
if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',', colorStringToArray($colorbacklinepairhover));
|
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
|
||||||
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',', colorStringToArray($colorbacklinepairchecked));
|
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
|
||||||
$colorbackbody=join(',', colorStringToArray($colorbackbody));
|
$colorbackbody = join(',', colorStringToArray($colorbackbody));
|
||||||
$colortexttitlenotab=join(',', colorStringToArray($colortexttitlenotab));
|
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
|
||||||
$colortexttitle=join(',', colorStringToArray($colortexttitle));
|
$colortexttitle = join(',', colorStringToArray($colortexttitle));
|
||||||
$colortext=join(',', colorStringToArray($colortext));
|
$colortext = join(',', colorStringToArray($colortext));
|
||||||
$colortextlink=join(',', colorStringToArray($colortextlink));
|
$colortextlink = join(',', colorStringToArray($colortextlink));
|
||||||
|
|
||||||
$nbtopmenuentries=$menumanager->showmenu('topnb');
|
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||||
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
||||||
|
|
||||||
print '/*'."\n";
|
print '/*'."\n";
|
||||||
@ -249,7 +249,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.thumbstat { font-weight: bold !important; }
|
.thumbstat { font-weight: bold !important; }
|
||||||
th a { font-weight: <?php echo ($useboldtitle?'bold':'normal'); ?> !important; }
|
th a { font-weight: <?php echo ($useboldtitle ? 'bold' : 'normal'); ?> !important; }
|
||||||
a.tab { font-weight: 500 !important; }
|
a.tab { font-weight: 500 !important; }
|
||||||
|
|
||||||
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
|
a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; font-weight: normal; color: rgb(<?php print $colortextlink; ?>); text-decoration: none; }
|
||||||
@ -303,7 +303,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
|
|||||||
font-size: <?php print $fontsize ?>px;
|
font-size: <?php print $fontsize ?>px;
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
border: none;
|
border: none;
|
||||||
border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT)?'-bottom':''; ?>: solid 1px rgba(0,0,0,.2);
|
border<?php echo empty($conf->global->THEME_HIDE_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px rgba(0,0,0,.2);
|
||||||
outline: none;
|
outline: none;
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ textarea.centpercent {
|
|||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
.nowrap {
|
.nowrap {
|
||||||
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
white-space: <?php print ($dol_optimize_smallscreen ? 'normal' : 'nowrap'); ?>;
|
||||||
}
|
}
|
||||||
.liste_titre .nowrap {
|
.liste_titre .nowrap {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -706,20 +706,20 @@ textarea.centpercent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text-warning{
|
.text-warning{
|
||||||
color : <?php print $textWarning ; ?>
|
color : <?php print $textWarning; ?>
|
||||||
}
|
}
|
||||||
body[class*="colorblind-"] .text-warning{
|
body[class*="colorblind-"] .text-warning{
|
||||||
color : <?php print $colorblind_deuteranopes_textWarning ; ?>
|
color : <?php print $colorblind_deuteranopes_textWarning; ?>
|
||||||
}
|
}
|
||||||
.text-success{
|
.text-success{
|
||||||
color : <?php print $textSuccess ; ?>
|
color : <?php print $textSuccess; ?>
|
||||||
}
|
}
|
||||||
body[class*="colorblind-"] .text-success{
|
body[class*="colorblind-"] .text-success{
|
||||||
color : <?php print $colorblind_deuteranopes_textSuccess ; ?>
|
color : <?php print $colorblind_deuteranopes_textSuccess; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-danger{
|
.text-danger{
|
||||||
color : <?php print $textDanger ; ?>
|
color : <?php print $textDanger; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
.editfielda span.fa-pencil-alt {
|
.editfielda span.fa-pencil-alt {
|
||||||
@ -938,7 +938,7 @@ div.fiche>form>div.div-table-responsive {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.flexcontainer {
|
.flexcontainer {
|
||||||
<?php if (in_array($conf->browser->browsername, array('chrome','firefox'))) echo 'display: inline-flex;' ?>
|
<?php if (in_array($conf->browser->browsername, array('chrome', 'firefox'))) echo 'display: inline-flex;' ?>
|
||||||
flex-flow: row wrap;
|
flex-flow: row wrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
@ -1058,10 +1058,10 @@ table[summary="list_of_modules"] .fa-cog {
|
|||||||
@media only screen and (max-width: 767px)
|
@media only screen and (max-width: 767px)
|
||||||
{
|
{
|
||||||
body {
|
body {
|
||||||
font-size: <?php print is_numeric($fontsize) ? ($fontsize+3).'px' : $fontsize; ?>;
|
font-size: <?php print is_numeric($fontsize) ? ($fontsize + 3).'px' : $fontsize; ?>;
|
||||||
}
|
}
|
||||||
div.refidno {
|
div.refidno {
|
||||||
font-size: <?php print is_numeric($fontsize) ? ($fontsize+3).'px' : $fontsize; ?> !important;
|
font-size: <?php print is_numeric($fontsize) ? ($fontsize + 3).'px' : $fontsize; ?> !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1069,10 +1069,10 @@ table[summary="list_of_modules"] .fa-cog {
|
|||||||
@media only screen and (max-width: 570px)
|
@media only screen and (max-width: 570px)
|
||||||
{
|
{
|
||||||
body {
|
body {
|
||||||
font-size: <?php print $fontsize+3; ?>px;
|
font-size: <?php print $fontsize + 3; ?>px;
|
||||||
}
|
}
|
||||||
div.refidno {
|
div.refidno {
|
||||||
font-size: <?php print $fontsize+3; ?>px !important;
|
font-size: <?php print $fontsize + 3; ?>px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login_vertical_align {
|
.login_vertical_align {
|
||||||
@ -1088,7 +1088,7 @@ table[summary="list_of_modules"] .fa-cog {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
div.fiche {
|
div.fiche {
|
||||||
margin-top: <?php print ($dol_hide_topmenu?'12':'6'); ?>px !important;
|
margin-top: <?php print ($dol_hide_topmenu ? '12' : '6'); ?>px !important;
|
||||||
}
|
}
|
||||||
.border tbody tr, .border tbody tr td, div.tabBar table.border tr {
|
.border tbody tr, .border tbody tr td, div.tabBar table.border tr {
|
||||||
height: 40px !important;
|
height: 40px !important;
|
||||||
@ -1243,7 +1243,7 @@ td.showDragHandle {
|
|||||||
font-family: "RobotoDraft","Roboto",sans-serif;
|
font-family: "RobotoDraft","Roboto",sans-serif;
|
||||||
left: 0;
|
left: 0;
|
||||||
<?php
|
<?php
|
||||||
if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
} else { ?>
|
} else { ?>
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50px;
|
top: 50px;
|
||||||
@ -1273,7 +1273,7 @@ td.showDragHandle {
|
|||||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
<?php
|
<?php
|
||||||
if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
} else { ?>
|
} else { ?>
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
@ -1302,7 +1302,7 @@ body.sidebar-collapse .side-nav-vert, body.sidebar-collapse #id-right {
|
|||||||
margin-left: 228px;
|
margin-left: 228px;
|
||||||
}
|
}
|
||||||
body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block {
|
body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block {
|
||||||
<?php if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
||||||
left: -240px;
|
left: -240px;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
left: -229px;
|
left: -229px;
|
||||||
@ -1317,7 +1317,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
/* For smartphone (testmenuhider is on) */
|
/* For smartphone (testmenuhider is on) */
|
||||||
<?php if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
||||||
#id-container {
|
#id-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@ -1331,7 +1331,7 @@ div.login_block {
|
|||||||
|
|
||||||
.side-nav {
|
.side-nav {
|
||||||
<?php
|
<?php
|
||||||
if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
} else { ?>
|
} else { ?>
|
||||||
overflow-x: initial !important;
|
overflow-x: initial !important;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
@ -1380,7 +1380,7 @@ div.login_block {
|
|||||||
background: rgb(<?php echo $colorbackvmenu1; ?>);
|
background: rgb(<?php echo $colorbackvmenu1; ?>);
|
||||||
border-right: 1px solid rgba(0,0,0,0.3);
|
border-right: 1px solid rgba(0,0,0,0.3);
|
||||||
<?php
|
<?php
|
||||||
if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
||||||
top: 50px ! important;
|
top: 50px ! important;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
top: 60px ! important;
|
top: 60px ! important;
|
||||||
@ -1393,9 +1393,9 @@ div.fiche {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
div.fiche {
|
div.fiche {
|
||||||
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'24':'6')); ?>px;
|
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '24' : '6')); ?>px;
|
||||||
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print'?6:(empty($conf->dol_optimize_smallscreen)?'22':'6')); ?>px;
|
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '22' : '6')); ?>px;
|
||||||
<?php if (! empty($dol_hide_leftmenu) && ! empty($dol_hide_topmenu)) print 'margin-top: 12px;'; ?>
|
<?php if (!empty($dol_hide_leftmenu) && !empty($dol_hide_topmenu)) print 'margin-top: 12px;'; ?>
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
body.onlinepaymentbody div.fiche { /* For online payment page */
|
body.onlinepaymentbody div.fiche { /* For online payment page */
|
||||||
@ -1409,28 +1409,28 @@ div.fichecenterbis {
|
|||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
div.fichethirdleft {
|
div.fichethirdleft {
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
|
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
|
||||||
}
|
}
|
||||||
div.fichetwothirdright {
|
div.fichetwothirdright {
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
|
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
|
||||||
}
|
}
|
||||||
div.fichetwothirdright div.ficheaddleft {
|
div.fichetwothirdright div.ficheaddleft {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
div.fichehalfleft {
|
div.fichehalfleft {
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
||||||
}
|
}
|
||||||
div.fichehalfright {
|
div.fichehalfright {
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
||||||
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
||||||
}
|
}
|
||||||
div.fichehalfright {
|
div.fichehalfright {
|
||||||
<?php if ($conf->browser->layout == 'phone') { print "margin-top: 10px;\n"; } ?>
|
<?php if ($conf->browser->layout == 'phone') { print "margin-top: 10px;\n"; } ?>
|
||||||
}
|
}
|
||||||
div.firstcolumn div.box {
|
div.firstcolumn div.box {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
@ -1442,9 +1442,9 @@ div.secondcolumn div.box {
|
|||||||
@media only screen and (max-width: 900px)
|
@media only screen and (max-width: 900px)
|
||||||
{
|
{
|
||||||
div.fiche {
|
div.fiche {
|
||||||
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print'?6:($dol_hide_leftmenu?'4':'20')); ?>px;
|
margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : ($dol_hide_leftmenu ? '4' : '20')); ?>px;
|
||||||
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print'?8:16); ?>px;
|
margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 8 : 16); ?>px;
|
||||||
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
<?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
div.fichecenter {
|
div.fichecenter {
|
||||||
@ -1638,12 +1638,12 @@ img.photorefnoborder {
|
|||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$minwidthtmenu=66; /* minimum width for one top menu entry */
|
$minwidthtmenu = 66; /* minimum width for one top menu entry */
|
||||||
$heightmenu=48; /* height of top menu, part with image */
|
$heightmenu = 48; /* height of top menu, part with image */
|
||||||
$heightmenu2=48; /* height of top menu, ârt with login */
|
$heightmenu2 = 48; /* height of top menu, ârt with login */
|
||||||
$disableimages = 0;
|
$disableimages = 0;
|
||||||
$maxwidthloginblock = 110;
|
$maxwidthloginblock = 110;
|
||||||
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; }
|
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu = 0; }
|
||||||
?>
|
?>
|
||||||
|
|
||||||
div#tmenu_tooltip {
|
div#tmenu_tooltip {
|
||||||
@ -1742,12 +1742,12 @@ ul.tmenu li {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
li.tmenu, li.tmenusel {
|
li.tmenu, li.tmenusel {
|
||||||
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
|
<?php print $minwidthtmenu ? 'min-width: '.$minwidthtmenu.'px;' : ''; ?>
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
<?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?>
|
<?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?>
|
||||||
float: <?php print $left; ?>;
|
float: <?php print $left; ?>;
|
||||||
<?php if (! $disableimages) { ?>
|
<?php if (!$disableimages) { ?>
|
||||||
height: <?php print $heightmenu; ?>px;
|
height: <?php print $heightmenu; ?>px;
|
||||||
padding: 0px 0px 2px 0px;
|
padding: 0px 0px 2px 0px;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -1773,8 +1773,8 @@ div.tmenuleft
|
|||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
<?php if (empty($conf->dol_optimize_smallscreen)) { ?>
|
<?php if (empty($conf->dol_optimize_smallscreen)) { ?>
|
||||||
width: 5px;
|
width: 5px;
|
||||||
<?php if (! $disableimages) { ?>
|
<?php if (!$disableimages) { ?>
|
||||||
height: <?php print $heightmenu+4; ?>px;
|
height: <?php print $heightmenu + 4; ?>px;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
}
|
}
|
||||||
@ -1806,14 +1806,14 @@ div.mainmenu {
|
|||||||
position : relative;
|
position : relative;
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
background-position:center top;
|
background-position:center top;
|
||||||
height: <?php echo ($heightmenu-22); ?>px;
|
height: <?php echo ($heightmenu - 22); ?>px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
min-width: 40px;
|
min-width: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not load menu img if hidden to save bandwidth */
|
/* Do not load menu img if hidden to save bandwidth */
|
||||||
<?php if (empty($dol_hide_topmenu)) { ?>
|
<?php if (empty($dol_hide_topmenu)) { ?>
|
||||||
<?php if (! defined('DISABLE_FONT_AWSOME')) { ?>
|
<?php if (!defined('DISABLE_FONT_AWSOME')) { ?>
|
||||||
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
|
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
@ -1907,55 +1907,55 @@ div.mainmenu.website {
|
|||||||
<?php
|
<?php
|
||||||
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
|
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
|
||||||
|
|
||||||
$moduletomainmenu=array(
|
$moduletomainmenu = array(
|
||||||
'user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial',
|
'user'=>'', 'syslog'=>'', 'societe'=>'companies', 'projet'=>'project', 'propale'=>'commercial', 'commande'=>'commercial',
|
||||||
'produit'=>'products','service'=>'products','stock'=>'products',
|
'produit'=>'products', 'service'=>'products', 'stock'=>'products',
|
||||||
'don'=>'accountancy','tax'=>'accountancy','banque'=>'accountancy','facture'=>'accountancy','compta'=>'accountancy','accounting'=>'accountancy','adherent'=>'members','import'=>'tools','export'=>'tools','mailing'=>'tools',
|
'don'=>'accountancy', 'tax'=>'accountancy', 'banque'=>'accountancy', 'facture'=>'accountancy', 'compta'=>'accountancy', 'accounting'=>'accountancy', 'adherent'=>'members', 'import'=>'tools', 'export'=>'tools', 'mailing'=>'tools',
|
||||||
'contrat'=>'commercial','ficheinter'=>'commercial','ticket'=>'ticket','deplacement'=>'commercial',
|
'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticket'=>'ticket', 'deplacement'=>'commercial',
|
||||||
'fournisseur'=>'companies',
|
'fournisseur'=>'companies',
|
||||||
'barcode'=>'',
|
'barcode'=>'',
|
||||||
'fckeditor'=>'',
|
'fckeditor'=>'',
|
||||||
'categorie'=>'',
|
'categorie'=>'',
|
||||||
);
|
);
|
||||||
$mainmenuused='home';
|
$mainmenuused = 'home';
|
||||||
foreach($conf->modules as $val)
|
foreach ($conf->modules as $val)
|
||||||
{
|
{
|
||||||
$mainmenuused.=','.(isset($moduletomainmenu[$val])?$moduletomainmenu[$val]:$val);
|
$mainmenuused .= ','.(isset($moduletomainmenu[$val]) ? $moduletomainmenu[$val] : $val);
|
||||||
}
|
}
|
||||||
$mainmenuusedarray=array_unique(explode(',', $mainmenuused));
|
$mainmenuusedarray = array_unique(explode(',', $mainmenuused));
|
||||||
|
|
||||||
$generic=1;
|
$generic = 1;
|
||||||
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
|
// Put here list of menu entries when the div.mainmenu.menuentry was previously defined
|
||||||
$divalreadydefined=array('home','companies','products','mrp','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website');
|
$divalreadydefined = array('home', 'companies', 'products', 'mrp', 'commercial', 'externalsite', 'accountancy', 'project', 'tools', 'members', 'agenda', 'ftp', 'holiday', 'hrm', 'bookmark', 'cashdesk', 'takepos', 'ecm', 'geoipmaxmind', 'gravatar', 'clicktodial', 'paypal', 'stripe', 'webservices', 'website');
|
||||||
// Put here list of menu entries we are sure we don't want
|
// Put here list of menu entries we are sure we don't want
|
||||||
$divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
|
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
|
||||||
foreach($mainmenuusedarray as $val)
|
foreach ($mainmenuusedarray as $val)
|
||||||
{
|
{
|
||||||
if (empty($val) || in_array($val, $divalreadydefined)) continue;
|
if (empty($val) || in_array($val, $divalreadydefined)) continue;
|
||||||
if (in_array($val, $divnotrequired)) continue;
|
if (in_array($val, $divnotrequired)) continue;
|
||||||
//print "XXX".$val;
|
//print "XXX".$val;
|
||||||
|
|
||||||
// Search img file in module dir
|
// Search img file in module dir
|
||||||
$found=0; $url='';
|
$found = 0; $url = '';
|
||||||
foreach($conf->file->dol_document_root as $dirroot)
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
{
|
{
|
||||||
if (file_exists($dirroot."/".$val."/img/".$val."_over.png"))
|
if (file_exists($dirroot."/".$val."/img/".$val."_over.png"))
|
||||||
{
|
{
|
||||||
$url=dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
|
$url = dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
|
||||||
$found=1;
|
$found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
|
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
|
||||||
{
|
{
|
||||||
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||||
$found=1;
|
$found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Img file not found
|
// Img file not found
|
||||||
if (! $found)
|
if (!$found)
|
||||||
{
|
{
|
||||||
if (! defined('DISABLE_FONT_AWSOME')) {
|
if (!defined('DISABLE_FONT_AWSOME')) {
|
||||||
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
||||||
print 'div.mainmenu.'.$val.'::before {
|
print 'div.mainmenu.'.$val.'::before {
|
||||||
content: "\f249";
|
content: "\f249";
|
||||||
@ -1964,7 +1964,7 @@ div.mainmenu.website {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n";
|
||||||
$url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic, 4))."_over.png", 1);
|
$url = dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic, 4))."_over.png", 1);
|
||||||
print "div.mainmenu.".$val." {\n";
|
print "div.mainmenu.".$val." {\n";
|
||||||
print " background-image: url(".$url.");\n";
|
print " background-image: url(".$url.");\n";
|
||||||
print "}\n";
|
print "}\n";
|
||||||
@ -2132,7 +2132,7 @@ div.login_block {
|
|||||||
padding-bottom: 3px;
|
padding-bottom: 3px;
|
||||||
<?php print $left; ?>: 0;
|
<?php print $left; ?>: 0;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
<?php if (in_array($conf->browser->layout, array('phone','tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
<?php if (in_array($conf->browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?>
|
||||||
position: absolute;
|
position: absolute;
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -2278,11 +2278,11 @@ div.blockvmenulogo
|
|||||||
border-bottom: 0 !important;
|
border-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
.menulogocontainer {
|
.menulogocontainer {
|
||||||
margin: <?php echo $disableimages?'0':'6'; ?>px;
|
margin: <?php echo $disableimages ? '0' : '6'; ?>px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: <?php echo $disableimages?'20':'32'; ?>px;
|
height: <?php echo $disableimages ? '20' : '32'; ?>px;
|
||||||
/* width: 100px; */
|
/* width: 100px; */
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
@ -2629,7 +2629,7 @@ span.tabspan {
|
|||||||
|
|
||||||
#undertopmenu {
|
#undertopmenu {
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
margin-top: <?php echo ($dol_hide_topmenu?'6':'0'); ?>px;
|
margin-top: <?php echo ($dol_hide_topmenu ? '6' : '0'); ?>px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paddingrightonly {
|
.paddingrightonly {
|
||||||
@ -3142,7 +3142,7 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl
|
|||||||
div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, .tagtr.liste_titre, .tagtr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
|
div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, .tagtr.liste_titre, .tagtr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
|
||||||
{
|
{
|
||||||
background: rgb(<?php echo $colorbacktitle1; ?>);
|
background: rgb(<?php echo $colorbacktitle1; ?>);
|
||||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
|
||||||
border-bottom: 1px solid #FDFFFF;
|
border-bottom: 1px solid #FDFFFF;
|
||||||
|
|
||||||
color: rgb(<?php echo $colortexttitle; ?>);
|
color: rgb(<?php echo $colortexttitle; ?>);
|
||||||
@ -3160,7 +3160,7 @@ tr:first-child th.liste_titre, tr:first-child th.liste_titre_sel {
|
|||||||
tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre
|
tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre
|
||||||
{
|
{
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
}
|
}
|
||||||
@ -3456,7 +3456,7 @@ tr.box_titre {
|
|||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
color: rgb(<?php echo $colortexttitle; ?>);
|
color: rgb(<?php echo $colortexttitle; ?>);
|
||||||
font-family: <?php print $fontlist ?>, sans-serif;
|
font-family: <?php print $fontlist ?>, sans-serif;
|
||||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
|
||||||
border-bottom: 1px solid #FDFFFF;
|
border-bottom: 1px solid #FDFFFF;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@ -3648,7 +3648,7 @@ div.titre {
|
|||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
/* text-shadow: 1px 1px 2px #FFFFFF; */
|
/* text-shadow: 1px 1px 2px #FFFFFF; */
|
||||||
<?php print (empty($conf->dol_optimize_smallscreen)?'':'margin-top: 4px;'); ?>
|
<?php print (empty($conf->dol_optimize_smallscreen) ? '' : 'margin-top: 4px;'); ?>
|
||||||
}
|
}
|
||||||
div.titre, .secondary {
|
div.titre, .secondary {
|
||||||
font-family: <?php print $fontlist ?>;
|
font-family: <?php print $fontlist ?>;
|
||||||
@ -4246,7 +4246,7 @@ A.none, A.none:active, A.none:visited, A.none:hover {
|
|||||||
font-family:<?php echo $fontlist; ?>;
|
font-family:<?php echo $fontlist; ?>;
|
||||||
font-size:<?php echo $fontsize; ?>px;
|
font-size:<?php echo $fontsize; ?>px;
|
||||||
}
|
}
|
||||||
.ui-button { margin-left: -2px; <?php print (preg_match('/chrome/', $conf->browser->name)?'padding-top: 1px;':''); ?> }
|
.ui-button { margin-left: -2px; <?php print (preg_match('/chrome/', $conf->browser->name) ? 'padding-top: 1px;' : ''); ?> }
|
||||||
.ui-button-icon-only .ui-button-text { height: 8px; }
|
.ui-button-icon-only .ui-button-text { height: 8px; }
|
||||||
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 2px 0px 6px 0px; }
|
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: 2px 0px 6px 0px; }
|
||||||
.ui-button-text
|
.ui-button-text
|
||||||
@ -4375,7 +4375,7 @@ pre#editfilecontentaceeditorid {
|
|||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
div.scroll2 {
|
div.scroll2 {
|
||||||
width: <?php print isset($_SESSION['dol_screenwidth'])?max($_SESSION['dol_screenwidth']-830, 450):'450'; ?>px !important;
|
width: <?php print isset($_SESSION['dol_screenwidth']) ?max($_SESSION['dol_screenwidth'] - 830, 450) : '450'; ?>px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gtaskname div, .gtaskname {
|
.gtaskname div, .gtaskname {
|
||||||
@ -4526,12 +4526,12 @@ div#ecm-layout-center {
|
|||||||
|
|
||||||
.jnotify-container {
|
.jnotify-container {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
<?php if (! empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?>
|
<?php if (!empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?>
|
||||||
top: auto !important;
|
top: auto !important;
|
||||||
bottom: 4px !important;
|
bottom: 4px !important;
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
text-align: center;
|
text-align: center;
|
||||||
min-width: <?php echo $dol_optimize_smallscreen?'200':'480'; ?>px;
|
min-width: <?php echo $dol_optimize_smallscreen ? '200' : '480'; ?>px;
|
||||||
width: auto;
|
width: auto;
|
||||||
max-width: 1024px;
|
max-width: 1024px;
|
||||||
padding-left: 10px !important;
|
padding-left: 10px !important;
|
||||||
@ -5855,7 +5855,7 @@ border-top-right-radius: 6px;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php if (! defined('DISABLE_FONT_AWSOME')) { ?>
|
<?php if (!defined('DISABLE_FONT_AWSOME')) { ?>
|
||||||
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
|
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Put here all includes required by your class file
|
// Put here all includes required by your class file
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class Website extends CommonObject
|
|||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (isset($this->entity)) {
|
if (isset($this->entity)) {
|
||||||
@ -158,39 +158,39 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||||
$sql.= 'entity,';
|
$sql .= 'entity,';
|
||||||
$sql.= 'ref,';
|
$sql .= 'ref,';
|
||||||
$sql.= 'description,';
|
$sql .= 'description,';
|
||||||
$sql.= 'status,';
|
$sql .= 'status,';
|
||||||
$sql.= 'fk_default_home,';
|
$sql .= 'fk_default_home,';
|
||||||
$sql.= 'virtualhost,';
|
$sql .= 'virtualhost,';
|
||||||
$sql.= 'fk_user_creat,';
|
$sql .= 'fk_user_creat,';
|
||||||
$sql.= 'date_creation,';
|
$sql .= 'date_creation,';
|
||||||
$sql.= 'tms';
|
$sql .= 'tms';
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql .= ' '.((empty($this->entity) && $this->entity != '0')?'NULL':$this->entity).',';
|
$sql .= ' '.((empty($this->entity) && $this->entity != '0') ? 'NULL' : $this->entity).',';
|
||||||
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
|
$sql .= ' '.(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").',';
|
||||||
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
|
$sql .= ' '.(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").',';
|
||||||
$sql .= ' '.(! isset($this->status)?'1':$this->status).',';
|
$sql .= ' '.(!isset($this->status) ? '1' : $this->status).',';
|
||||||
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
|
$sql .= ' '.(!isset($this->fk_default_home) ? 'NULL' : $this->fk_default_home).',';
|
||||||
$sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").",";
|
$sql .= ' '.(!isset($this->virtualhost) ? 'NULL' : "'".$this->db->escape($this->virtualhost)."'").",";
|
||||||
$sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).',';
|
$sql .= ' '.(!isset($this->fk_user_creat) ? $user->id : $this->fk_user_creat).',';
|
||||||
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").",";
|
$sql .= ' '.(!isset($this->date_creation) || dol_strlen($this->date_creation) == 0 ? 'NULL' : "'".$this->db->idate($this->date_creation)."'").",";
|
||||||
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
|
$sql .= ' '.(!isset($this->date_modification) || dol_strlen($this->date_modification) == 0 ? 'NULL' : "'".$this->db->idate($this->date_modification)."'");
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||||
|
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action to call a trigger.
|
// want this action to call a trigger.
|
||||||
@ -207,7 +207,7 @@ class Website extends CommonObject
|
|||||||
if ($error) {
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return - 1 * $error;
|
return -1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -238,12 +238,12 @@ class Website extends CommonObject
|
|||||||
$sql .= " t.fk_user_modif,";
|
$sql .= " t.fk_user_modif,";
|
||||||
$sql .= " t.date_creation,";
|
$sql .= " t.date_creation,";
|
||||||
$sql .= " t.tms as date_modification";
|
$sql .= " t.tms as date_modification";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
|
||||||
if (! empty($ref)) {
|
if (!empty($ref)) {
|
||||||
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
|
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||||
} else {
|
} else {
|
||||||
$sql .= ' AND t.rowid = ' . (int) $id;
|
$sql .= ' AND t.rowid = '.(int) $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -278,10 +278,10 @@ class Website extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,11 +292,11 @@ class Website extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetchLines()
|
public function fetchLines()
|
||||||
{
|
{
|
||||||
$this->lines=array();
|
$this->lines = array();
|
||||||
|
|
||||||
// Load lines with object MyObjectLine
|
// Load lines with object MyObjectLine
|
||||||
|
|
||||||
return count($this->lines)?1:0;
|
return count($this->lines) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,24 +328,24 @@ class Website extends CommonObject
|
|||||||
$sql .= " t.fk_user_modif,";
|
$sql .= " t.fk_user_modif,";
|
||||||
$sql .= " t.date_creation,";
|
$sql .= " t.date_creation,";
|
||||||
$sql .= " t.tms as date_modification";
|
$sql .= " t.tms as date_modification";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
|
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere [] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
$sql .= ' '.$this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
$this->records = array();
|
$this->records = array();
|
||||||
|
|
||||||
@ -375,10 +375,10 @@ class Website extends CommonObject
|
|||||||
|
|
||||||
return $num;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,25 +415,25 @@ class Website extends CommonObject
|
|||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||||
$sql .= ' entity = '.(isset($this->entity)?$this->entity:"null").',';
|
$sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").',';
|
||||||
$sql .= ' ref = '.(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").',';
|
$sql .= ' ref = '.(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").',';
|
||||||
$sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").',';
|
$sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").',';
|
||||||
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
|
$sql .= ' status = '.(isset($this->status) ? $this->status : "null").',';
|
||||||
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").',';
|
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0) ? $this->fk_default_home : "null").',';
|
||||||
$sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").',';
|
$sql .= ' virtualhost = '.(($this->virtualhost != '') ? "'".$this->db->escape($this->virtualhost)."'" : "null").',';
|
||||||
$sql .= ' fk_user_modif = '.(! isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).',';
|
$sql .= ' fk_user_modif = '.(!isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).',';
|
||||||
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
$sql .= ' date_creation = '.(!isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
||||||
$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
|
$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
|
||||||
$sql .= ' WHERE rowid=' . $this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
@ -450,7 +450,7 @@ class Website extends CommonObject
|
|||||||
if ($error) {
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return - 1 * $error;
|
return -1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -487,20 +487,20 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= ' WHERE rowid=' . $this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ! empty($this->ref))
|
if (!$error && !empty($this->ref))
|
||||||
{
|
{
|
||||||
$pathofwebsite=DOL_DATA_ROOT.'/website/'.$this->ref;
|
$pathofwebsite = DOL_DATA_ROOT.'/website/'.$this->ref;
|
||||||
|
|
||||||
dol_delete_dir_recursive($pathofwebsite);
|
dol_delete_dir_recursive($pathofwebsite);
|
||||||
}
|
}
|
||||||
@ -509,7 +509,7 @@ class Website extends CommonObject
|
|||||||
if ($error) {
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return - 1 * $error;
|
return -1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -533,7 +533,7 @@ class Website extends CommonObject
|
|||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ class Website extends CommonObject
|
|||||||
// Check no site with ref exists
|
// Check no site with ref exists
|
||||||
if ($object->fetch(0, $newref) > 0)
|
if ($object->fetch(0, $newref) > 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorNewRefIsAlreadyUsed';
|
$this->error = 'ErrorNewRefIsAlreadyUsed';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,14 +551,14 @@ class Website extends CommonObject
|
|||||||
// Load source object
|
// Load source object
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
|
|
||||||
$oldidforhome=$object->fk_default_home;
|
$oldidforhome = $object->fk_default_home;
|
||||||
$oldref=$object->ref;
|
$oldref = $object->ref;
|
||||||
|
|
||||||
$pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$oldref;
|
$pathofwebsiteold = $dolibarr_main_data_root.'/website/'.$oldref;
|
||||||
$pathofwebsitenew=$dolibarr_main_data_root.'/website/'.$newref;
|
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$newref;
|
||||||
dol_delete_dir_recursive($pathofwebsitenew);
|
dol_delete_dir_recursive($pathofwebsitenew);
|
||||||
|
|
||||||
$fileindex=$pathofwebsitenew.'/index.php';
|
$fileindex = $pathofwebsitenew.'/index.php';
|
||||||
|
|
||||||
// Reset some properties
|
// Reset some properties
|
||||||
unset($object->id);
|
unset($object->id);
|
||||||
@ -566,9 +566,9 @@ class Website extends CommonObject
|
|||||||
unset($object->import_key);
|
unset($object->import_key);
|
||||||
|
|
||||||
// Clear fields
|
// Clear fields
|
||||||
$object->ref=$newref;
|
$object->ref = $newref;
|
||||||
$object->fk_default_home=0;
|
$object->fk_default_home = 0;
|
||||||
$object->virtualhost='';
|
$object->virtualhost = '';
|
||||||
$object->date_creation = $now;
|
$object->date_creation = $now;
|
||||||
$object->fk_user_creat = $user->id;
|
$object->fk_user_creat = $user->id;
|
||||||
|
|
||||||
@ -576,43 +576,43 @@ class Website extends CommonObject
|
|||||||
$object->context['createfromclone'] = 'createfromclone';
|
$object->context['createfromclone'] = 'createfromclone';
|
||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
dolCopyDir($pathofwebsiteold, $pathofwebsitenew, $conf->global->MAIN_UMASK, 0);
|
dolCopyDir($pathofwebsiteold, $pathofwebsitenew, $conf->global->MAIN_UMASK, 0);
|
||||||
|
|
||||||
// Check symlink to medias and restore it if ko
|
// Check symlink to medias and restore it if ko
|
||||||
$pathtomedias=DOL_DATA_ROOT.'/medias'; // Target
|
$pathtomedias = DOL_DATA_ROOT.'/medias'; // Target
|
||||||
$pathtomediasinwebsite=$pathofwebsitenew.'/medias'; // Source / Link name
|
$pathtomediasinwebsite = $pathofwebsitenew.'/medias'; // Source / Link name
|
||||||
if (! is_link(dol_osencode($pathtomediasinwebsite)))
|
if (!is_link(dol_osencode($pathtomediasinwebsite)))
|
||||||
{
|
{
|
||||||
dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite);
|
dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite);
|
||||||
dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists
|
dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists
|
||||||
$result = symlink($pathtomedias, $pathtomediasinwebsite);
|
$result = symlink($pathtomedias, $pathtomediasinwebsite);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy images and js dir
|
// Copy images and js dir
|
||||||
$pathofmediasjsold=DOL_DATA_ROOT.'/medias/js/'.$oldref;
|
$pathofmediasjsold = DOL_DATA_ROOT.'/medias/js/'.$oldref;
|
||||||
$pathofmediasjsnew=DOL_DATA_ROOT.'/medias/js/'.$newref;
|
$pathofmediasjsnew = DOL_DATA_ROOT.'/medias/js/'.$newref;
|
||||||
dolCopyDir($pathofmediasjsold, $pathofmediasjsnew, $conf->global->MAIN_UMASK, 0);
|
dolCopyDir($pathofmediasjsold, $pathofmediasjsnew, $conf->global->MAIN_UMASK, 0);
|
||||||
|
|
||||||
$pathofmediasimageold=DOL_DATA_ROOT.'/medias/image/'.$oldref;
|
$pathofmediasimageold = DOL_DATA_ROOT.'/medias/image/'.$oldref;
|
||||||
$pathofmediasimagenew=DOL_DATA_ROOT.'/medias/image/'.$newref;
|
$pathofmediasimagenew = DOL_DATA_ROOT.'/medias/image/'.$newref;
|
||||||
dolCopyDir($pathofmediasimageold, $pathofmediasimagenew, $conf->global->MAIN_UMASK, 0);
|
dolCopyDir($pathofmediasimageold, $pathofmediasimagenew, $conf->global->MAIN_UMASK, 0);
|
||||||
|
|
||||||
$newidforhome=0;
|
$newidforhome = 0;
|
||||||
|
|
||||||
// Duplicate pages
|
// Duplicate pages
|
||||||
$objectpages = new WebsitePage($this->db);
|
$objectpages = new WebsitePage($this->db);
|
||||||
$listofpages = $objectpages->fetchAll($fromid);
|
$listofpages = $objectpages->fetchAll($fromid);
|
||||||
foreach($listofpages as $pageid => $objectpageold)
|
foreach ($listofpages as $pageid => $objectpageold)
|
||||||
{
|
{
|
||||||
// Delete old file
|
// Delete old file
|
||||||
$filetplold=$pathofwebsitenew.'/page'.$pageid.'.tpl.php';
|
$filetplold = $pathofwebsitenew.'/page'.$pageid.'.tpl.php';
|
||||||
dol_delete_file($filetplold);
|
dol_delete_file($filetplold);
|
||||||
|
|
||||||
// Create new file
|
// Create new file
|
||||||
@ -621,15 +621,15 @@ class Website extends CommonObject
|
|||||||
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
||||||
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
||||||
{
|
{
|
||||||
$filealias=$pathofwebsitenew.'/'.$objectpagenew->pageurl.'.php';
|
$filealias = $pathofwebsitenew.'/'.$objectpagenew->pageurl.'.php';
|
||||||
$filetplnew=$pathofwebsitenew.'/page'.$objectpagenew->id.'.tpl.php';
|
$filetplnew = $pathofwebsitenew.'/page'.$objectpagenew->id.'.tpl.php';
|
||||||
|
|
||||||
// Save page alias
|
// Save page alias
|
||||||
$result=dolSavePageAlias($filealias, $object, $objectpagenew);
|
$result = dolSavePageAlias($filealias, $object, $objectpagenew);
|
||||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
if (!$result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
|
|
||||||
$result=dolSavePageContent($filetplnew, $object, $objectpagenew);
|
$result = dolSavePageContent($filetplnew, $object, $objectpagenew);
|
||||||
if (! $result) setEventMessages('Failed to write file '.$filetplnew, null, 'errors');
|
if (!$result) setEventMessages('Failed to write file '.$filetplnew, null, 'errors');
|
||||||
|
|
||||||
if ($pageid == $oldidforhome)
|
if ($pageid == $oldidforhome)
|
||||||
{
|
{
|
||||||
@ -644,21 +644,21 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Restore id of home page
|
// Restore id of home page
|
||||||
$object->fk_default_home = $newidforhome;
|
$object->fk_default_home = $newidforhome;
|
||||||
$res = $object->update($user);
|
$res = $object->update($user);
|
||||||
if (! $res > 0)
|
if (!$res > 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$filetpl=$pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
|
$filetpl = $pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
|
||||||
$filewrapper=$pathofwebsitenew.'/wrapper.php';
|
$filewrapper = $pathofwebsitenew.'/wrapper.php';
|
||||||
|
|
||||||
// Generate the index.php page to be the home page
|
// Generate the index.php page to be the home page
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -676,7 +676,7 @@ class Website extends CommonObject
|
|||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,23 +701,23 @@ class Website extends CommonObject
|
|||||||
$result = '';
|
$result = '';
|
||||||
$companylink = '';
|
$companylink = '';
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("WebSite") . '</u>';
|
$label = '<u>'.$langs->trans("WebSite").'</u>';
|
||||||
$label.= '<br>';
|
$label .= '<br>';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
|
|
||||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
|
||||||
$linkstart.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
|
$linkstart .= ($notooltip ? '' : ' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss ? ' '.$morecss : '').'"');
|
||||||
$linkstart.= '>';
|
$linkstart .= '>';
|
||||||
$linkend='</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
$linkstart = $linkend = '';
|
$linkstart = $linkend = '';
|
||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto)
|
||||||
{
|
{
|
||||||
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
|
$result .= ($linkstart.img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
|
||||||
if ($withpicto != 2) $result.=' ';
|
if ($withpicto != 2) $result .= ' ';
|
||||||
}
|
}
|
||||||
$result.= $linkstart . $this->ref . $linkend;
|
$result .= $linkstart.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ class Website extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("Create temp dir ".$conf->website->dir_temp);
|
dol_syslog("Create temp dir ".$conf->website->dir_temp);
|
||||||
dol_mkdir($conf->website->dir_temp);
|
dol_mkdir($conf->website->dir_temp);
|
||||||
if (! is_writable($conf->website->dir_temp))
|
if (!is_writable($conf->website->dir_temp))
|
||||||
{
|
{
|
||||||
setEventMessages("Temporary dir ".$conf->website->dir_temp." is not writable", null, 'errors');
|
setEventMessages("Temporary dir ".$conf->website->dir_temp." is not writable", null, 'errors');
|
||||||
return '';
|
return '';
|
||||||
@ -815,7 +815,7 @@ class Website extends CommonObject
|
|||||||
$destdir = $conf->website->dir_temp.'/'.$website->ref;
|
$destdir = $conf->website->dir_temp.'/'.$website->ref;
|
||||||
|
|
||||||
dol_syslog("Clear temp dir ".$destdir);
|
dol_syslog("Clear temp dir ".$destdir);
|
||||||
$count=0; $countreallydeleted=0;
|
$count = 0; $countreallydeleted = 0;
|
||||||
$counttodelete = dol_delete_dir_recursive($destdir, $count, 1, 0, $countreallydeleted);
|
$counttodelete = dol_delete_dir_recursive($destdir, $count, 1, 0, $countreallydeleted);
|
||||||
if ($counttodelete != $countreallydeleted)
|
if ($counttodelete != $countreallydeleted)
|
||||||
{
|
{
|
||||||
@ -823,8 +823,8 @@ class Website extends CommonObject
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayreplacementinfilename=array();
|
$arrayreplacementinfilename = array();
|
||||||
$arrayreplacementincss=array();
|
$arrayreplacementincss = array();
|
||||||
$arrayreplacementincss['file=image/'.$website->ref.'/'] = "file=image/__WEBSITE_KEY__/";
|
$arrayreplacementincss['file=image/'.$website->ref.'/'] = "file=image/__WEBSITE_KEY__/";
|
||||||
$arrayreplacementincss['file=js/'.$website->ref.'/'] = "file=js/__WEBSITE_KEY__/";
|
$arrayreplacementincss['file=js/'.$website->ref.'/'] = "file=js/__WEBSITE_KEY__/";
|
||||||
$arrayreplacementincss['medias/image/'.$website->ref.'/'] = "medias/image/__WEBSITE_KEY__/";
|
$arrayreplacementincss['medias/image/'.$website->ref.'/'] = "medias/image/__WEBSITE_KEY__/";
|
||||||
@ -876,18 +876,18 @@ class Website extends CommonObject
|
|||||||
$listofpages = $objectpages->fetchAll($website->id);
|
$listofpages = $objectpages->fetchAll($website->id);
|
||||||
|
|
||||||
// Assign ->newid and ->newfk_page
|
// Assign ->newid and ->newfk_page
|
||||||
$i=1;
|
$i = 1;
|
||||||
foreach($listofpages as $pageid => $objectpageold)
|
foreach ($listofpages as $pageid => $objectpageold)
|
||||||
{
|
{
|
||||||
$objectpageold->newid=$i;
|
$objectpageold->newid = $i;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$i=1;
|
$i = 1;
|
||||||
foreach($listofpages as $pageid => $objectpageold)
|
foreach ($listofpages as $pageid => $objectpageold)
|
||||||
{
|
{
|
||||||
// Search newid
|
// Search newid
|
||||||
$newfk_page=0;
|
$newfk_page = 0;
|
||||||
foreach($listofpages as $pageid2 => $objectpageold2)
|
foreach ($listofpages as $pageid2 => $objectpageold2)
|
||||||
{
|
{
|
||||||
if ($pageid2 == $objectpageold->fk_page)
|
if ($pageid2 == $objectpageold->fk_page)
|
||||||
{
|
{
|
||||||
@ -895,41 +895,41 @@ class Website extends CommonObject
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$objectpageold->newfk_page=$newfk_page;
|
$objectpageold->newfk_page = $newfk_page;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
foreach($listofpages as $pageid => $objectpageold)
|
foreach ($listofpages as $pageid => $objectpageold)
|
||||||
{
|
{
|
||||||
$allaliases = $objectpageold->pageurl;
|
$allaliases = $objectpageold->pageurl;
|
||||||
$allaliases.= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : '');
|
$allaliases .= ($objectpageold->aliasalt ? ','.$objectpageold->aliasalt : '');
|
||||||
|
|
||||||
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
|
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
|
||||||
$line.= "\n";
|
$line .= "\n";
|
||||||
fputs($fp, $line);
|
fputs($fp, $line);
|
||||||
|
|
||||||
// Warning: We must keep llx_ here. It is a generic SQL.
|
// Warning: We must keep llx_ here. It is a generic SQL.
|
||||||
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)';
|
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, image, keywords, status, date_creation, tms, lang, import_key, grabbed_from, type_container, htmlheader, content)';
|
||||||
|
|
||||||
$line.= " VALUES(";
|
$line .= " VALUES(";
|
||||||
$line.= $objectpageold->newid."__+MAX_llx_website_page__, ";
|
$line .= $objectpageold->newid."__+MAX_llx_website_page__, ";
|
||||||
$line.= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", ";
|
$line .= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", ";
|
||||||
$line.= "__WEBSITE_ID__, ";
|
$line .= "__WEBSITE_ID__, ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->pageurl)."', ";
|
$line .= "'".$this->db->escape($objectpageold->pageurl)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->aliasalt)."', ";
|
$line .= "'".$this->db->escape($objectpageold->aliasalt)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->title)."', ";
|
$line .= "'".$this->db->escape($objectpageold->title)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->description)."', ";
|
$line .= "'".$this->db->escape($objectpageold->description)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->image)."', ";
|
$line .= "'".$this->db->escape($objectpageold->image)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->keywords)."', ";
|
$line .= "'".$this->db->escape($objectpageold->keywords)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->status)."', ";
|
$line .= "'".$this->db->escape($objectpageold->status)."', ";
|
||||||
$line.= "'".$this->db->idate($objectpageold->date_creation)."', ";
|
$line .= "'".$this->db->idate($objectpageold->date_creation)."', ";
|
||||||
$line.= "'".$this->db->idate($objectpageold->date_modification)."', ";
|
$line .= "'".$this->db->idate($objectpageold->date_modification)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->lang)."', ";
|
$line .= "'".$this->db->escape($objectpageold->lang)."', ";
|
||||||
$line.= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", ";
|
$line .= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
|
$line .= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
|
||||||
$line.= "'".$this->db->escape($objectpageold->type_container)."', ";
|
$line .= "'".$this->db->escape($objectpageold->type_container)."', ";
|
||||||
|
|
||||||
$stringtoexport = $objectpageold->htmlheader;
|
$stringtoexport = $objectpageold->htmlheader;
|
||||||
$stringtoexport = str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport);
|
$stringtoexport = str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
@ -937,10 +937,10 @@ class Website extends CommonObject
|
|||||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
|
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
|
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
|
$stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport);
|
||||||
$line.= "'".$this->db->escape(str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line
|
$line .= "'".$this->db->escape(str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line
|
||||||
|
|
||||||
$stringtoexport = $objectpageold->content;
|
$stringtoexport = $objectpageold->content;
|
||||||
$stringtoexport = str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport);
|
$stringtoexport = str_replace(array("\r\n", "\r", "\n"), "__N__", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('file=image/'.$website->ref.'/', "file=image/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
$stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport);
|
||||||
@ -952,9 +952,9 @@ class Website extends CommonObject
|
|||||||
// When we have a link src="image/websiteref/file.png" into html content
|
// When we have a link src="image/websiteref/file.png" into html content
|
||||||
$stringtoexport = str_replace('="image/'.$website->ref.'/', '="image/__WEBSITE_KEY__/', $stringtoexport);
|
$stringtoexport = str_replace('="image/'.$website->ref.'/', '="image/__WEBSITE_KEY__/', $stringtoexport);
|
||||||
|
|
||||||
$line.= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line
|
$line .= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line
|
||||||
$line.= ");";
|
$line .= ");";
|
||||||
$line.= "\n";
|
$line .= "\n";
|
||||||
fputs($fp, $line);
|
fputs($fp, $line);
|
||||||
|
|
||||||
// Add line to update home page id during import
|
// Add line to update home page id during import
|
||||||
@ -963,13 +963,13 @@ class Website extends CommonObject
|
|||||||
{
|
{
|
||||||
// Warning: We must keep llx_ here. It is a generic SQL.
|
// Warning: We must keep llx_ here. It is a generic SQL.
|
||||||
$line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;";
|
$line = "UPDATE llx_website SET fk_default_home = ".($objectpageold->newid > 0 ? $this->db->escape($objectpageold->newid)."__+MAX_llx_website_page__" : "null")." WHERE rowid = __WEBSITE_ID__;";
|
||||||
$line.= "\n";
|
$line .= "\n";
|
||||||
fputs($fp, $line);
|
fputs($fp, $line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (!empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
|
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
// Build zip file
|
// Build zip file
|
||||||
@ -1016,49 +1016,49 @@ class Website extends CommonObject
|
|||||||
dol_mkdir($conf->website->dir_temp.'/'.$object->ref);
|
dol_mkdir($conf->website->dir_temp.'/'.$object->ref);
|
||||||
|
|
||||||
$filename = basename($pathtofile);
|
$filename = basename($pathtofile);
|
||||||
if (! preg_match('/^website_(.*)-(.*)$/', $filename, $reg))
|
if (!preg_match('/^website_(.*)-(.*)$/', $filename, $reg))
|
||||||
{
|
{
|
||||||
$this->errors[]='Bad format for filename '.$filename.'. Must be website_XXX-VERSION.';
|
$this->errors[] = 'Bad format for filename '.$filename.'. Must be website_XXX-VERSION.';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = dol_uncompress($pathtofile, $conf->website->dir_temp.'/'.$object->ref);
|
$result = dol_uncompress($pathtofile, $conf->website->dir_temp.'/'.$object->ref);
|
||||||
|
|
||||||
if (! empty($result['error']))
|
if (!empty($result['error']))
|
||||||
{
|
{
|
||||||
$this->errors[]='Failed to unzip file '.$pathtofile.'.';
|
$this->errors[] = 'Failed to unzip file '.$pathtofile.'.';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayreplacement = array();
|
$arrayreplacement = array();
|
||||||
$arrayreplacement['__WEBSITE_ID__'] = $object->id;
|
$arrayreplacement['__WEBSITE_ID__'] = $object->id;
|
||||||
$arrayreplacement['__WEBSITE_KEY__'] = $object->ref;
|
$arrayreplacement['__WEBSITE_KEY__'] = $object->ref;
|
||||||
$arrayreplacement['__N__'] = $this->db->escape("\n"); // Restore \n
|
$arrayreplacement['__N__'] = $this->db->escape("\n"); // Restore \n
|
||||||
$arrayreplacement['__LOGO_SMALL_KEY__'] = $this->db->escape($mysoc->logo_small);
|
$arrayreplacement['__LOGO_SMALL_KEY__'] = $this->db->escape($mysoc->logo_small);
|
||||||
$arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini);
|
$arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini);
|
||||||
$arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo);
|
$arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo);
|
||||||
|
|
||||||
// Copy containers
|
// Copy containers
|
||||||
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/containers', $conf->website->dir_output.'/'.$object->ref, 0, 1); // Overwrite if exists
|
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/containers', $conf->website->dir_output.'/'.$object->ref, 0, 1); // Overwrite if exists
|
||||||
|
|
||||||
// Make replacement into css and htmlheader file
|
// Make replacement into css and htmlheader file
|
||||||
$cssindestdir = $conf->website->dir_output.'/'.$object->ref.'/styles.css.php';
|
$cssindestdir = $conf->website->dir_output.'/'.$object->ref.'/styles.css.php';
|
||||||
$result=dolReplaceInFile($cssindestdir, $arrayreplacement);
|
$result = dolReplaceInFile($cssindestdir, $arrayreplacement);
|
||||||
|
|
||||||
$htmldeaderindestdir = $conf->website->dir_output.'/'.$object->ref.'/htmlheader.html';
|
$htmldeaderindestdir = $conf->website->dir_output.'/'.$object->ref.'/htmlheader.html';
|
||||||
$result = dolReplaceInFile($htmldeaderindestdir, $arrayreplacement);
|
$result = dolReplaceInFile($htmldeaderindestdir, $arrayreplacement);
|
||||||
|
|
||||||
// Now generate the master.inc.php page
|
// Now generate the master.inc.php page
|
||||||
$filemaster=$conf->website->dir_output.'/'.$object->ref.'/master.inc.php';
|
$filemaster = $conf->website->dir_output.'/'.$object->ref.'/master.inc.php';
|
||||||
$result = dolSaveMasterFile($filemaster);
|
$result = dolSaveMasterFile($filemaster);
|
||||||
if (! $result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
$this->errors[]='Failed to write file '.$filemaster;
|
$this->errors[] = 'Failed to write file '.$filemaster;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/image/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/image/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
||||||
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
dolCopyDir($conf->website->dir_temp.'/'.$object->ref.'/medias/js/websitekey', $conf->website->dir_output.'/'.$object->ref.'/medias/js/'.$object->ref, 0, 1); // Medias can be shared, do not overwrite if exists
|
||||||
|
|
||||||
$sqlfile = $conf->website->dir_temp.'/'.$object->ref.'/website_pages.sql';
|
$sqlfile = $conf->website->dir_temp.'/'.$object->ref.'/website_pages.sql';
|
||||||
|
|
||||||
@ -1067,19 +1067,19 @@ class Website extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Search the $maxrowid because we need it later
|
// Search the $maxrowid because we need it later
|
||||||
$sqlgetrowid='SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
|
$sqlgetrowid = 'SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
|
||||||
$resql=$this->db->query($sqlgetrowid);
|
$resql = $this->db->query($sqlgetrowid);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj=$this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$maxrowid=$obj->max;
|
$maxrowid = $obj->max;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load sql record
|
// Load sql record
|
||||||
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
|
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
|
||||||
if ($runsql <= 0)
|
if ($runsql <= 0)
|
||||||
{
|
{
|
||||||
$this->errors[]='Failed to load sql file '.$sqlfile;
|
$this->errors[] = 'Failed to load sql file '.$sqlfile;
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1089,7 +1089,7 @@ class Website extends CommonObject
|
|||||||
$fp = fopen($sqlfile, "r");
|
$fp = fopen($sqlfile, "r");
|
||||||
if ($fp)
|
if ($fp)
|
||||||
{
|
{
|
||||||
while (! feof($fp))
|
while (!feof($fp))
|
||||||
{
|
{
|
||||||
$reg = array();
|
$reg = array();
|
||||||
|
|
||||||
@ -1108,17 +1108,17 @@ class Website extends CommonObject
|
|||||||
dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0);
|
dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0);
|
||||||
|
|
||||||
// The move is not enough, so we regenerate page
|
// The move is not enough, so we regenerate page
|
||||||
$filetpl=$conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php';
|
$filetpl = $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php';
|
||||||
dolSavePageContent($filetpl, $object, $objectpagestatic);
|
dolSavePageContent($filetpl, $object, $objectpagestatic);
|
||||||
|
|
||||||
// Regenerate alternative aliases pages
|
// Regenerate alternative aliases pages
|
||||||
if (is_array($aliasesarray))
|
if (is_array($aliasesarray))
|
||||||
{
|
{
|
||||||
foreach($aliasesarray as $aliasshortcuttocreate)
|
foreach ($aliasesarray as $aliasshortcuttocreate)
|
||||||
{
|
{
|
||||||
if (trim($aliasshortcuttocreate))
|
if (trim($aliasshortcuttocreate))
|
||||||
{
|
{
|
||||||
$filealias=$conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php';
|
$filealias = $conf->website->dir_output.'/'.$object->ref.'/'.trim($aliasshortcuttocreate).'.php';
|
||||||
dolSavePageAlias($filealias, $object, $objectpagestatic);
|
dolSavePageAlias($filealias, $object, $objectpagestatic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1156,15 +1156,15 @@ class Website extends CommonObject
|
|||||||
{
|
{
|
||||||
global $websitepagefile, $website;
|
global $websitepagefile, $website;
|
||||||
|
|
||||||
if (! is_object($weblangs)) return 'ERROR componentSelectLang called with parameter $weblangs not defined';
|
if (!is_object($weblangs)) return 'ERROR componentSelectLang called with parameter $weblangs not defined';
|
||||||
|
|
||||||
// Load tmppage if we have $websitepagefile defined
|
// Load tmppage if we have $websitepagefile defined
|
||||||
$tmppage=new WebsitePage($this->db);
|
$tmppage = new WebsitePage($this->db);
|
||||||
|
|
||||||
$pageid = 0;
|
$pageid = 0;
|
||||||
if (! empty($websitepagefile))
|
if (!empty($websitepagefile))
|
||||||
{
|
{
|
||||||
$websitepagefileshort=basename($websitepagefile);
|
$websitepagefileshort = basename($websitepagefile);
|
||||||
if ($websitepagefileshort == 'index.php') $pageid = $website->fk_default_home;
|
if ($websitepagefileshort == 'index.php') $pageid = $website->fk_default_home;
|
||||||
else $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), $websitepagefileshort);
|
else $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), $websitepagefileshort);
|
||||||
if ($pageid > 0)
|
if ($pageid > 0)
|
||||||
@ -1174,16 +1174,16 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill with existing translation, nothing if none
|
// Fill with existing translation, nothing if none
|
||||||
if (! is_array($languagecodes) && $pageid > 0)
|
if (!is_array($languagecodes) && $pageid > 0)
|
||||||
{
|
{
|
||||||
$languagecodes = array();
|
$languagecodes = array();
|
||||||
|
|
||||||
$sql ="SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
|
$sql = "SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."website_page as wp";
|
$sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp";
|
||||||
$sql.=" WHERE wp.fk_website = ".$website->id;
|
$sql .= " WHERE wp.fk_website = ".$website->id;
|
||||||
$sql.=" AND (wp.fk_page = ".$pageid." OR wp.rowid = ".$pageid;
|
$sql .= " AND (wp.fk_page = ".$pageid." OR wp.rowid = ".$pageid;
|
||||||
if ($tmppage->fk_page > 0) $sql.=" OR wp.fk_page = ".$tmppage->fk_page." OR wp.rowid = ".$tmppage->fk_page;
|
if ($tmppage->fk_page > 0) $sql .= " OR wp.fk_page = ".$tmppage->fk_page." OR wp.rowid = ".$tmppage->fk_page;
|
||||||
$sql.=")";
|
$sql .= ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1192,20 +1192,20 @@ class Website extends CommonObject
|
|||||||
{
|
{
|
||||||
$newlang = $obj->lang;
|
$newlang = $obj->lang;
|
||||||
if ($obj->rowid == $pageid) $newlang = $obj->lang;
|
if ($obj->rowid == $pageid) $newlang = $obj->lang;
|
||||||
if (! in_array($newlang, $languagecodes)) $languagecodes[]=$newlang;
|
if (!in_array($newlang, $languagecodes)) $languagecodes[] = $newlang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now $languagecodes is always an array
|
// Now $languagecodes is always an array
|
||||||
|
|
||||||
$languagecodeselected= $weblangs->defaultlang; // Because we must init with a value, but real value is the lang of main parent container
|
$languagecodeselected = $weblangs->defaultlang; // Because we must init with a value, but real value is the lang of main parent container
|
||||||
if (! empty($websitepagefile))
|
if (!empty($websitepagefile))
|
||||||
{
|
{
|
||||||
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
|
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
|
||||||
if ($pageid > 0)
|
if ($pageid > 0)
|
||||||
{
|
{
|
||||||
$languagecodeselected=$tmppage->lang;
|
$languagecodeselected = $tmppage->lang;
|
||||||
if (! in_array($tmppage->lang, $languagecodes)) $languagecodes[]=$tmppage->lang; // We add language code of page into combo list
|
if (!in_array($tmppage->lang, $languagecodes)) $languagecodes[] = $tmppage->lang; // We add language code of page into combo list
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,20 +1213,20 @@ class Website extends CommonObject
|
|||||||
//var_dump($weblangs->defaultlang);
|
//var_dump($weblangs->defaultlang);
|
||||||
|
|
||||||
$url = $_SERVER["REQUEST_URI"];
|
$url = $_SERVER["REQUEST_URI"];
|
||||||
$url = preg_replace('/(\?|&)l=([a-zA-Z_]*)/', '', $url); // We remove param l from url
|
$url = preg_replace('/(\?|&)l=([a-zA-Z_]*)/', '', $url); // We remove param l from url
|
||||||
//$url = preg_replace('/(\?|&)lang=([a-zA-Z_]*)/', '', $url); // We remove param lang from url
|
//$url = preg_replace('/(\?|&)lang=([a-zA-Z_]*)/', '', $url); // We remove param lang from url
|
||||||
$url.= (preg_match('/\?/', $url) ? '&' : '?').'l=';
|
$url .= (preg_match('/\?/', $url) ? '&' : '?').'l=';
|
||||||
|
|
||||||
$HEIGHTOPTION=40;
|
$HEIGHTOPTION = 40;
|
||||||
$MAXHEIGHT = 4 * $HEIGHTOPTION;
|
$MAXHEIGHT = 4 * $HEIGHTOPTION;
|
||||||
$nboflanguage = count($languagecodes);
|
$nboflanguage = count($languagecodes);
|
||||||
|
|
||||||
$out ='<!-- componentSelectLang'.$htmlname.' -->'."\n";
|
$out = '<!-- componentSelectLang'.$htmlname.' -->'."\n";
|
||||||
|
|
||||||
$out.= '<style>';
|
$out .= '<style>';
|
||||||
$out.= '.componentSelectLang'.$htmlname.':hover { height: '.min($MAXHEIGHT, ($HEIGHTOPTION * $nboflanguage)).'px; overflow-x: hidden; overflow-y: '.((($HEIGHTOPTION * $nboflanguage) > $MAXHEIGHT) ? ' scroll' : 'hidden').'; }'."\n";
|
$out .= '.componentSelectLang'.$htmlname.':hover { height: '.min($MAXHEIGHT, ($HEIGHTOPTION * $nboflanguage)).'px; overflow-x: hidden; overflow-y: '.((($HEIGHTOPTION * $nboflanguage) > $MAXHEIGHT) ? ' scroll' : 'hidden').'; }'."\n";
|
||||||
$out.= '.componentSelectLang'.$htmlname.' li { line-height: '.$HEIGHTOPTION.'px; }'."\n";
|
$out .= '.componentSelectLang'.$htmlname.' li { line-height: '.$HEIGHTOPTION.'px; }'."\n";
|
||||||
$out.= '.componentSelectLang'.$htmlname.' {
|
$out .= '.componentSelectLang'.$htmlname.' {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: '.$HEIGHTOPTION.'px;
|
height: '.$HEIGHTOPTION.'px;
|
||||||
@ -1242,33 +1242,33 @@ class Website extends CommonObject
|
|||||||
.componentSelectLang'.$htmlname.' li { display: block; padding: 0px 20px; }
|
.componentSelectLang'.$htmlname.' li { display: block; padding: 0px 20px; }
|
||||||
.componentSelectLang'.$htmlname.' li:hover { background-color: #EEE; }
|
.componentSelectLang'.$htmlname.' li:hover { background-color: #EEE; }
|
||||||
';
|
';
|
||||||
$out.= '</style>';
|
$out .= '</style>';
|
||||||
$out.= '<ul class="componentSelectLang'.$htmlname.($morecss?' '.$morecss:'').'">';
|
$out .= '<ul class="componentSelectLang'.$htmlname.($morecss ? ' '.$morecss : '').'">';
|
||||||
if ($languagecodeselected)
|
if ($languagecodeselected)
|
||||||
{
|
{
|
||||||
$shortcode = strtolower(substr($languagecodeselected, -2));
|
$shortcode = strtolower(substr($languagecodeselected, -2));
|
||||||
$label = $weblangs->trans("Language_".$languagecodeselected);
|
$label = $weblangs->trans("Language_".$languagecodeselected);
|
||||||
if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
|
if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
|
||||||
$out.= '<a href="'.$url.$languagecodeselected.'"><li><img height="12px" src="medias/image/common/flags/'.$shortcode.'.png" style="margin-right: 5px;"/>'.$label;
|
$out .= '<a href="'.$url.$languagecodeselected.'"><li><img height="12px" src="medias/image/common/flags/'.$shortcode.'.png" style="margin-right: 5px;"/>'.$label;
|
||||||
$out.= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
$out .= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
||||||
$out.= '</li></a>';
|
$out .= '</li></a>';
|
||||||
}
|
}
|
||||||
$i=0;
|
$i = 0;
|
||||||
if (is_array($languagecodes))
|
if (is_array($languagecodes))
|
||||||
{
|
{
|
||||||
foreach($languagecodes as $languagecode)
|
foreach ($languagecodes as $languagecode)
|
||||||
{
|
{
|
||||||
if ($languagecode == $languagecodeselected) continue; // Already output
|
if ($languagecode == $languagecodeselected) continue; // Already output
|
||||||
$shortcode = strtolower(substr($languagecode, -2));
|
$shortcode = strtolower(substr($languagecode, -2));
|
||||||
$label = $weblangs->trans("Language_".$languagecode);
|
$label = $weblangs->trans("Language_".$languagecode);
|
||||||
if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
|
if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label);
|
||||||
$out.= '<a href="'.$url.$languagecode.'"><li><img height="12px" src="medias/image/common/flags/'.$shortcode.'.png" style="margin-right: 5px;"/>'.$label;
|
$out .= '<a href="'.$url.$languagecode.'"><li><img height="12px" src="medias/image/common/flags/'.$shortcode.'.png" style="margin-right: 5px;"/>'.$label;
|
||||||
if (empty($i) && empty($languagecodeselected)) $out.= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
if (empty($i) && empty($languagecodeselected)) $out .= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
||||||
$out.= '</li></a>';
|
$out .= '</li></a>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.= '</ul>';
|
$out .= '</ul>';
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Put here all includes required by your class file
|
// Put here all includes required by your class file
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
@ -97,29 +97,29 @@ class WebsitePage extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
*/
|
*/
|
||||||
public $fields=array(
|
public $fields = array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||||
'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Ref/alias of page'),
|
'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Ref/alias of page'),
|
||||||
'aliasalt' =>array('type'=>'varchar(255)', 'label'=>'AliasAlt', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>0, 'position'=>11, 'searchall'=>0, 'comment'=>'Alias alternative of page'),
|
'aliasalt' =>array('type'=>'varchar(255)', 'label'=>'AliasAlt', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>0, 'position'=>11, 'searchall'=>0, 'comment'=>'Alias alternative of page'),
|
||||||
'type_container' =>array('type'=>'varchar(16)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>0, 'position'=>12, 'comment'=>'Type of container'),
|
'type_container' =>array('type'=>'varchar(16)', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>0, 'position'=>12, 'comment'=>'Type of container'),
|
||||||
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
|
||||||
'image' =>array('type'=>'varchar(255)', 'label'=>'Image', 'enabled'=>1, 'visible'=>1, 'position'=>32, 'searchall'=>0, 'help'=>'Relative path of media. Used if Type is "blogpost"'),
|
'image' =>array('type'=>'varchar(255)', 'label'=>'Image', 'enabled'=>1, 'visible'=>1, 'position'=>32, 'searchall'=>0, 'help'=>'Relative path of media. Used if Type is "blogpost"'),
|
||||||
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||||
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
|
//'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
|
||||||
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
|
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
|
||||||
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
|
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
|
||||||
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
|
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
|
||||||
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
|
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
|
||||||
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
|
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
|
||||||
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502),
|
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502),
|
||||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
|
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510),
|
||||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
|
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511),
|
||||||
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
||||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1),
|
||||||
);
|
);
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class WebsitePage extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->description = dol_trunc($this->description, 255, 'right', 'utf-8', 1);
|
$this->description = dol_trunc($this->description, 255, 'right', 'utf-8', 1);
|
||||||
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
|
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
|
||||||
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
|
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
|
||||||
|
|
||||||
return $this->createCommon($user, $notrigger);
|
return $this->createCommon($user, $notrigger);
|
||||||
}
|
}
|
||||||
@ -186,20 +186,20 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= " t.tms as date_modification,";
|
$sql .= " t.tms as date_modification,";
|
||||||
$sql .= " t.fk_user_creat,";
|
$sql .= " t.fk_user_creat,";
|
||||||
$sql .= " t.fk_user_modif";
|
$sql .= " t.fk_user_modif";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
|
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$sql .= ' AND t.rowid = ' . $id;
|
$sql .= ' AND t.rowid = '.$id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($id < 0) $sql .= ' AND t.rowid <> ' . abs($id);
|
if ($id < 0) $sql .= ' AND t.rowid <> '.abs($id);
|
||||||
if (null !== $website_id) {
|
if (null !== $website_id) {
|
||||||
$sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'";
|
$sql .= " AND t.fk_website = '".$this->db->escape($website_id)."'";
|
||||||
if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'";
|
if ($page) $sql .= " AND t.pageurl = '".$this->db->escape($page)."'";
|
||||||
if ($aliasalt) $sql .= " AND (t.aliasalt LIKE '%," . $this->db->escape($aliasalt) . ",%' OR t.aliasalt LIKE '%, " . $this->db->escape($aliasalt) . ",%')";
|
if ($aliasalt) $sql .= " AND (t.aliasalt LIKE '%,".$this->db->escape($aliasalt).",%' OR t.aliasalt LIKE '%, ".$this->db->escape($aliasalt).",%')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= $this->db->plimit(1);
|
$sql .= $this->db->plimit(1);
|
||||||
@ -242,10 +242,10 @@ class WebsitePage extends CommonObject
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ class WebsitePage extends CommonObject
|
|||||||
{
|
{
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$records=array();
|
$records = array();
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
$sql .= ' t.rowid,';
|
$sql .= ' t.rowid,';
|
||||||
@ -287,28 +287,28 @@ class WebsitePage extends CommonObject
|
|||||||
$sql .= " t.tms as date_modification,";
|
$sql .= " t.tms as date_modification,";
|
||||||
$sql .= " t.fk_user_creat,";
|
$sql .= " t.fk_user_creat,";
|
||||||
$sql .= " t.fk_user_modif";
|
$sql .= " t.fk_user_modif";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||||
$sql .= ' WHERE t.fk_website = '.$websiteid;
|
$sql .= ' WHERE t.fk_website = '.$websiteid;
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key=='t.rowid' || $key=='t.fk_website') {
|
if ($key == 't.rowid' || $key == 't.fk_website') {
|
||||||
$sqlwhere[] = $key . '='. $value;
|
$sqlwhere[] = $key.'='.$value;
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
|
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
if (!empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
$sql .= ' '.$this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -345,9 +345,9 @@ class WebsitePage extends CommonObject
|
|||||||
|
|
||||||
return $records;
|
return $records;
|
||||||
} else {
|
} else {
|
||||||
$this->error = 'Error ' . $this->db->lasterror();
|
$this->error = 'Error '.$this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ class WebsitePage extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->description = dol_trunc($this->description, 255, 'right', 'utf-8', 1);
|
$this->description = dol_trunc($this->description, 255, 'right', 'utf-8', 1);
|
||||||
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
|
$this->keywords = dol_trunc($this->keywords, 255, 'right', 'utf-8', 1);
|
||||||
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
|
if ($this->aliasalt) $this->aliasalt = ','.preg_replace('/,+$/', '', preg_replace('/^,+/', '', $this->aliasalt)).','; // content in database must be ',xxx,...,yyy,'
|
||||||
|
|
||||||
return $this->updateCommon($user, $notrigger);
|
return $this->updateCommon($user, $notrigger);
|
||||||
}
|
}
|
||||||
@ -382,16 +382,16 @@ class WebsitePage extends CommonObject
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$websiteobj=new Website($this->db);
|
$websiteobj = new Website($this->db);
|
||||||
$result = $websiteobj->fetch($this->fk_website);
|
$result = $websiteobj->fetch($this->fk_website);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websiteobj->ref;
|
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteobj->ref;
|
||||||
|
|
||||||
$filealias=$pathofwebsite.'/'.$this->pageurl.'.php';
|
$filealias = $pathofwebsite.'/'.$this->pageurl.'.php';
|
||||||
$filetpl=$pathofwebsite.'/page'.$this->id.'.tpl.php';
|
$filetpl = $pathofwebsite.'/page'.$this->id.'.tpl.php';
|
||||||
|
|
||||||
dol_delete_file($filealias);
|
dol_delete_file($filealias);
|
||||||
dol_delete_file($filetpl);
|
dol_delete_file($filetpl);
|
||||||
@ -438,10 +438,10 @@ class WebsitePage extends CommonObject
|
|||||||
$object->fk_user_creat = $user->id;
|
$object->fk_user_creat = $user->id;
|
||||||
$object->date_creation = $now;
|
$object->date_creation = $now;
|
||||||
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
|
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
|
||||||
if (! empty($newlang)) $object->lang=$newlang;
|
if (!empty($newlang)) $object->lang = $newlang;
|
||||||
if ($istranslation) $object->fk_page = $fromid;
|
if ($istranslation) $object->fk_page = $fromid;
|
||||||
else $object->fk_page = 0;
|
else $object->fk_page = 0;
|
||||||
if (! empty($newwebsite)) $object->fk_website=$newwebsite;
|
if (!empty($newwebsite)) $object->fk_website = $newwebsite;
|
||||||
|
|
||||||
// Create clone
|
// Create clone
|
||||||
$object->context['createfromclone'] = 'createfromclone';
|
$object->context['createfromclone'] = 'createfromclone';
|
||||||
@ -450,7 +450,7 @@ class WebsitePage extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($object->context['createfromclone']);
|
unset($object->context['createfromclone']);
|
||||||
@ -486,36 +486,36 @@ class WebsitePage extends CommonObject
|
|||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("Page") . '</u>';
|
$label = '<u>'.$langs->trans("Page").'</u>';
|
||||||
$label.= '<br>';
|
$label .= '<br>';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref.'<br>';
|
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
|
||||||
$label.= '<b>' . $langs->trans('ID') . ':</b> ' . $this->id.'<br>';
|
$label .= '<b>'.$langs->trans('ID').':</b> '.$this->id.'<br>';
|
||||||
$label.= '<b>' . $langs->trans('Title') . ':</b> ' . $this->title;
|
$label .= '<b>'.$langs->trans('Title').':</b> '.$this->title;
|
||||||
|
|
||||||
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;
|
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose = '';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowMyObject");
|
$label = $langs->trans("ShowMyObject");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
}
|
}
|
||||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart .= $linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
//$linkstart = $linkend = '';
|
//$linkstart = $linkend = '';
|
||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) $result.=img_picto(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
if ($withpicto) $result .= img_picto(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
if ($withpicto != 2) $result.= $this->ref;
|
if ($withpicto != 2) $result .= $this->ref;
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -574,7 +574,7 @@ class WebsitePage extends CommonObject
|
|||||||
|
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$this->fk_website = '';
|
$this->fk_website = '';
|
||||||
$this->type_container = 'page';
|
$this->type_container = 'page';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user