Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
2fa82d1bfb
commit
812d0af1d9
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
@ -47,14 +47,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstbom=GETPOST('maskconstBom', 'alpha');
|
||||
$maskbom=GETPOST('maskBom', 'alpha');
|
||||
$maskconstbom = GETPOST('maskconstBom', 'alpha');
|
||||
$maskbom = GETPOST('maskBom', 'alpha');
|
||||
|
||||
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');
|
||||
}
|
||||
@ -66,20 +66,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$bom = new BOM($db);
|
||||
$bom->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
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))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@ -155,9 +155,9 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
|
||||
$draft = GETPOST("BOM_DRAFT_WATERMARK");
|
||||
$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');
|
||||
}
|
||||
@ -169,13 +169,13 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
|
||||
|
||||
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);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -190,13 +190,13 @@ elseif ($action == 'set_BOM_FREE_TEXT')
|
||||
* 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"));
|
||||
|
||||
$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');
|
||||
|
||||
$head = bomAdminPrepareHead();
|
||||
@ -229,18 +229,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
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';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// 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->isEnabled())
|
||||
@ -251,9 +251,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
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;
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -270,22 +270,22 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$bom=new BOM($db);
|
||||
$bom = new BOM($db);
|
||||
$bom->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$bom->type=0;
|
||||
$nextval=$module->getNextValue($mysoc, $bom);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$bom->type = 0;
|
||||
$nextval = $module->getNextValue($mysoc, $bom);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} 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
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@ -348,43 +348,43 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
foreach (array('', '/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
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 ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
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";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -419,15 +419,15 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
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>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
@ -471,18 +471,18 @@ print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
|
||||
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>';
|
||||
$variablename='BOM_FREE_TEXT';
|
||||
$variablename = 'BOM_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
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
|
||||
{
|
||||
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 '</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';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp","other"));
|
||||
$langs->loadLangs(array("mrp", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$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');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
// PDF
|
||||
$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));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 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));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new BOM($db);
|
||||
$object = new BOM($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$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
|
||||
$search_all=trim(GETPOST("search_all", 'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||
$search = array();
|
||||
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
|
||||
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
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
@ -85,13 +85,13 @@ $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$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 (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$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;
|
||||
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
|
||||
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';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='BOM_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
|
||||
$trackid='bom'.$object->id;
|
||||
$trigger_name = 'BOM_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_BOM_TO';
|
||||
$trackid = 'bom'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Add line
|
||||
@ -140,12 +140,12 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! ($idprod > 0)) {
|
||||
if (!($idprod > 0)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Product')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
@ -176,10 +176,10 @@ if (empty($reshook))
|
||||
$error = 0;
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$qty=GETPOST('qty', 'int');
|
||||
$qty = GETPOST('qty', 'int');
|
||||
$qty_frozen = GETPOST('qty_frozen', 'int');
|
||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
$efficiency=GETPOST('efficiency', 'int');
|
||||
$efficiency = GETPOST('efficiency', 'int');
|
||||
|
||||
if ($qty == '') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
@ -212,8 +212,8 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
llxHeader('', $langs->trans("BOM"), '');
|
||||
|
||||
@ -248,10 +248,10 @@ if ($action == 'create')
|
||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||
|
||||
// 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";
|
||||
|
||||
@ -260,7 +260,7 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
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 '</form>';
|
||||
@ -284,10 +284,10 @@ if (($id || $ref) && $action == 'edit')
|
||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -313,7 +313,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Confirmation to 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
|
||||
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);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
$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);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// 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
|
||||
@ -372,14 +372,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
$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);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// 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
|
||||
@ -402,14 +402,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
$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);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// 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
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$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
|
||||
@ -432,15 +432,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
||||
|
||||
$formquestion=array();
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||
$formquestion = array();
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
@ -448,9 +448,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// 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
|
||||
$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);
|
||||
@ -500,11 +500,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak='description';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
||||
$keyforbreak = 'description';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
// 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 '</div>';
|
||||
@ -574,8 +574,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$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 (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)
|
||||
{
|
||||
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
|
||||
@ -668,11 +668,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Documents
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref . '/' . $objref . '.pdf';
|
||||
$filedir = $conf->bom->dir_output . '/' . $objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$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
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->bom->dir_output.'/'.$objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$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
|
||||
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang);
|
||||
|
||||
// Show links to link elements
|
||||
@ -685,11 +685,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
|
||||
$morehtmlright.= $langs->trans("SeeAll");
|
||||
$morehtmlright.= '</a>';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
|
||||
// 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);
|
||||
$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';
|
||||
|
||||
// Presend form
|
||||
$modelmail='bom';
|
||||
$defaulttopic='InformationMessage';
|
||||
$modelmail = 'bom';
|
||||
$defaulttopic = 'InformationMessage';
|
||||
$diroutput = $conf->bom->dir_output;
|
||||
$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);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -108,7 +108,7 @@ if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||
// bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
$object->fetch($id);
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -118,7 +118,7 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: list.php");
|
||||
@ -134,22 +134,22 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
// Add social contribution
|
||||
if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||
{
|
||||
$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'));
|
||||
$amount=price2num(GETPOST('amount'));
|
||||
$actioncode=GETPOST('actioncode');
|
||||
$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'));
|
||||
$amount = price2num(GETPOST('amount'));
|
||||
$actioncode = GETPOST('actioncode');
|
||||
|
||||
if (! $dateech)
|
||||
if (!$dateech)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
elseif (! $dateperiod)
|
||||
elseif (!$dateperiod)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
elseif (! $actioncode > 0)
|
||||
elseif (!$actioncode > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
|
||||
$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');
|
||||
$action = 'edit';
|
||||
}
|
||||
elseif (! is_numeric($amount))
|
||||
elseif (!is_numeric($amount))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$object->date_ech = $dateech;
|
||||
$object->date_ech = $dateech;
|
||||
$object->periode = $dateperiod;
|
||||
$object->amount = price2num($amount);
|
||||
|
||||
$result=$object->update($user);
|
||||
$result = $object->update($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -228,7 +228,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
@ -274,7 +274,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
}
|
||||
else
|
||||
{
|
||||
$id=$originalId;
|
||||
$id = $originalId;
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -299,10 +299,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
|
||||
$form = new Form($db);
|
||||
$formsocialcontrib = new FormSocialContrib($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");
|
||||
$help_url='EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
||||
$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)';
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ if ($action == 'create')
|
||||
print $langs->trans("Type");
|
||||
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 '</tr>';
|
||||
|
||||
@ -343,7 +343,7 @@ if ($action == 'create')
|
||||
print $form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo"));
|
||||
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 '</tr>';
|
||||
|
||||
@ -353,7 +353,7 @@ if ($action == 'create')
|
||||
print $langs->trans("DateDue");
|
||||
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 "</tr>\n";
|
||||
|
||||
@ -366,29 +366,29 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
// Associated project
|
||||
$langs->load("projects");
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
// 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');
|
||||
print '</td></tr>';
|
||||
|
||||
// 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);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -400,7 +400,7 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
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 '</form>';
|
||||
@ -414,28 +414,28 @@ if ($action == 'create')
|
||||
if ($id > 0)
|
||||
{
|
||||
$object = new ChargeSociales($db);
|
||||
$result=$object->fetch($id);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$head=tax_prepare_head($object);
|
||||
$head = tax_prepare_head($object);
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
// Clone confirmation
|
||||
if ($action === 'clone')
|
||||
{
|
||||
$formquestion=array(
|
||||
$formquestion = array(
|
||||
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
|
||||
{
|
||||
$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_period', 'label' => $langs->trans("PeriodEndDate"), '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);
|
||||
@ -558,18 +558,18 @@ if ($id > 0)
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
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 '</td><td>';
|
||||
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 {
|
||||
$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>';
|
||||
|
||||
// Bank Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<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">';
|
||||
|
||||
$nbcols = 3;
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$nbcols ++;
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$nbcols++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Payments
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||
$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.= " 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_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.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " WHERE p.fk_charge = ".$id;
|
||||
$sql.= " AND p.fk_charge = cs.rowid";
|
||||
$sql.= " AND cs.entity IN (".getEntity('tax').")";
|
||||
$sql.= " ORDER BY dp DESC";
|
||||
$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 .= " 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_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 .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE p.fk_charge = ".$id;
|
||||
$sql .= " AND p.fk_charge = cs.rowid";
|
||||
$sql .= " AND cs.entity IN (".getEntity('tax').")";
|
||||
$sql .= " ORDER BY dp DESC";
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
@ -624,14 +624,14 @@ if ($id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
$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 '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("RefPayment").'</td>';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
print '<td class="liste_titre right">' . $langs->trans('BankAccount') . '</td>';
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
||||
print '</tr>';
|
||||
@ -645,16 +645,16 @@ if ($id > 0)
|
||||
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 '<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";
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
$bankaccountstatic->label = $objp->baref;
|
||||
$bankaccountstatic->number = $objp->banumber;
|
||||
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$bankaccountstatic->account_number = $objp->account_number;
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
@ -687,7 +687,7 @@ if ($id > 0)
|
||||
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
|
||||
|
||||
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 '</div>';
|
||||
@ -730,7 +730,7 @@ if ($id > 0)
|
||||
// Reopen
|
||||
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
|
||||
@ -746,7 +746,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// 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>";
|
||||
}
|
||||
@ -754,7 +754,7 @@ if ($id > 0)
|
||||
// Clone
|
||||
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
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
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
|
||||
*/
|
||||
public $element='don';
|
||||
public $element = 'don';
|
||||
|
||||
/**
|
||||
* @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
|
||||
@ -167,14 +167,14 @@ class Don extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("donations");
|
||||
$this->labelStatus[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatus[0]=$langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelStatus[1]=$langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelStatus[2]=$langs->trans("DonationStatusPaid");
|
||||
$this->labelStatusShort[-1]=$langs->trans("Canceled");
|
||||
$this->labelStatusShort[0]=$langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelStatusShort[1]=$langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelStatusShort[2]=$langs->trans("DonationStatusPaidShort");
|
||||
$this->labelStatus[-1] = $langs->trans("Canceled");
|
||||
$this->labelStatus[0] = $langs->trans("DonationStatusPromiseNotValidated");
|
||||
$this->labelStatus[1] = $langs->trans("DonationStatusPromiseValidated");
|
||||
$this->labelStatus[2] = $langs->trans("DonationStatusPaid");
|
||||
$this->labelStatusShort[-1] = $langs->trans("Canceled");
|
||||
$this->labelStatusShort[0] = $langs->trans("DonationStatusPromiseNotValidatedShort");
|
||||
$this->labelStatusShort[1] = $langs->trans("DonationStatusPromiseValidatedShort");
|
||||
$this->labelStatusShort[2] = $langs->trans("DonationStatusPaidShort");
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
@ -194,7 +194,7 @@ class Don extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $conf, $user,$langs;
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -202,10 +202,10 @@ class Don extends CommonObject
|
||||
$socids = array();
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql.= " WHERE client IN (1, 3)";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " LIMIT 10";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE client IN (1, 3)";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " LIMIT 10";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -222,9 +222,9 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
// Initialise parametres
|
||||
$this->id=0;
|
||||
$this->id = 0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->specimen = 1;
|
||||
$this->lastname = 'Doe';
|
||||
$this->firstname = 'John';
|
||||
$this->socid = 1;
|
||||
@ -236,11 +236,11 @@ class Don extends CommonObject
|
||||
$this->address = 'Twist road';
|
||||
$this->zip = '99999';
|
||||
$this->town = 'Town';
|
||||
$this->note_private='Private note';
|
||||
$this->note_public='Public note';
|
||||
$this->email='email@email.com';
|
||||
$this->note='';
|
||||
$this->statut=1;
|
||||
$this->note_private = 'Private note';
|
||||
$this->note_public = 'Public note';
|
||||
$this->email = 'email@email.com';
|
||||
$this->note = '';
|
||||
$this->statut = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ class Don extends CommonObject
|
||||
$this->amount = trim($this->amount);
|
||||
|
||||
$map = range(0, 9);
|
||||
$len=dol_strlen($this->amount);
|
||||
$len = dol_strlen($this->amount);
|
||||
for ($i = 0; $i < $len; $i++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -350,64 +350,64 @@ class Don extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
$ret = 0;
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->address=($this->address>0?$this->address:$this->address);
|
||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
||||
$this->town=($this->town>0?$this->town:$this->town);
|
||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
||||
$this->country=($this->country?$this->country:$this->country);
|
||||
$this->address = ($this->address > 0 ? $this->address : $this->address);
|
||||
$this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
|
||||
$this->town = ($this->town > 0 ? $this->town : $this->town);
|
||||
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||
$this->country = ($this->country ? $this->country : $this->country);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
|
||||
$sql.= "datec";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", fk_payment";
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", firstname";
|
||||
$sql.= ", lastname";
|
||||
$sql.= ", societe";
|
||||
$sql.= ", address";
|
||||
$sql.= ", zip";
|
||||
$sql.= ", town";
|
||||
$sql.= ", fk_country";
|
||||
$sql.= ", public";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", fk_user_valid";
|
||||
$sql.= ", datedon";
|
||||
$sql.= ", email";
|
||||
$sql.= ", phone";
|
||||
$sql.= ", phone_mobile";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->idate($now)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".price2num($this->amount);
|
||||
$sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null");
|
||||
$sql.= ", ".($this->socid > 0 ? $this->socid : "null");
|
||||
$sql.= ", '".$this->db->escape($this->firstname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->lastname)."'";
|
||||
$sql.= ", '".$this->db->escape($this->societe)."'";
|
||||
$sql.= ", '".$this->db->escape($this->address)."'";
|
||||
$sql.= ", '".$this->db->escape($this->zip)."'";
|
||||
$sql.= ", '".$this->db->escape($this->town)."'";
|
||||
$sql.= ", ".($this->country_id > 0 ? $this->country_id : '0');
|
||||
$sql.= ", ".((int) $this->public);
|
||||
$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_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", null";
|
||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
||||
$sql.= ", '".$this->db->escape($this->email)."'";
|
||||
$sql.= ", '".$this->db->escape($this->phone)."'";
|
||||
$sql.= ", '".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql.= ")";
|
||||
$sql .= "datec";
|
||||
$sql .= ", entity";
|
||||
$sql .= ", amount";
|
||||
$sql .= ", fk_payment";
|
||||
$sql .= ", fk_soc";
|
||||
$sql .= ", firstname";
|
||||
$sql .= ", lastname";
|
||||
$sql .= ", societe";
|
||||
$sql .= ", address";
|
||||
$sql .= ", zip";
|
||||
$sql .= ", town";
|
||||
$sql .= ", fk_country";
|
||||
$sql .= ", public";
|
||||
$sql .= ", fk_projet";
|
||||
$sql .= ", note_private";
|
||||
$sql .= ", note_public";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", fk_user_valid";
|
||||
$sql .= ", datedon";
|
||||
$sql .= ", email";
|
||||
$sql .= ", phone";
|
||||
$sql .= ", phone_mobile";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($now)."'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".price2num($this->amount);
|
||||
$sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");
|
||||
$sql .= ", ".($this->socid > 0 ? $this->socid : "null");
|
||||
$sql .= ", '".$this->db->escape($this->firstname)."'";
|
||||
$sql .= ", '".$this->db->escape($this->lastname)."'";
|
||||
$sql .= ", '".$this->db->escape($this->societe)."'";
|
||||
$sql .= ", '".$this->db->escape($this->address)."'";
|
||||
$sql .= ", '".$this->db->escape($this->zip)."'";
|
||||
$sql .= ", '".$this->db->escape($this->town)."'";
|
||||
$sql .= ", ".($this->country_id > 0 ? $this->country_id : '0');
|
||||
$sql .= ", ".((int) $this->public);
|
||||
$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_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||
$sql .= ", ".$user->id;
|
||||
$sql .= ", null";
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
$sql .= ", '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", '".$this->db->escape($this->phone)."'";
|
||||
$sql .= ", '".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -418,7 +418,7 @@ class Don extends CommonObject
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_CREATE', $user);
|
||||
$result = $this->call_trigger('DON_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
@ -431,10 +431,10 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
// Update extrafield
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -471,20 +471,20 @@ class Don extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
$this->address=($this->address>0?$this->address:$this->address);
|
||||
$this->zip=($this->zip>0?$this->zip:$this->zip);
|
||||
$this->town=($this->town>0?$this->town:$this->town);
|
||||
$this->country_id=($this->country_id>0?$this->country_id:$this->country_id);
|
||||
$this->country=($this->country?$this->country:$this->country);
|
||||
$this->address = ($this->address > 0 ? $this->address : $this->address);
|
||||
$this->zip = ($this->zip > 0 ? $this->zip : $this->zip);
|
||||
$this->town = ($this->town > 0 ? $this->town : $this->town);
|
||||
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||
$this->country = ($this->country ? $this->country : $this->country);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
|
||||
$sql .= "amount = " . price2num($this->amount);
|
||||
$sql .= ",fk_payment = ".($this->modepaymentid?$this->modepaymentid:"null");
|
||||
$sql .= "amount = ".price2num($this->amount);
|
||||
$sql .= ",fk_payment = ".($this->modepaymentid ? $this->modepaymentid : "null");
|
||||
$sql .= ",firstname = '".$this->db->escape($this->firstname)."'";
|
||||
$sql .= ",lastname='".$this->db->escape($this->lastname)."'";
|
||||
$sql .= ",societe='".$this->db->escape($this->societe)."'";
|
||||
@ -493,11 +493,11 @@ class Don extends CommonObject
|
||||
$sql .= ",town='".$this->db->escape($this->town)."'";
|
||||
$sql .= ",fk_country = ".($this->country_id > 0 ? $this->country_id : '0');
|
||||
$sql .= ",public=".$this->public;
|
||||
$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_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"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_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||
$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 .= ",phone='".$this->db->escape($this->phone)."'";
|
||||
$sql .= ",phone_mobile='".$this->db->escape($this->phone_mobile)."'";
|
||||
@ -505,23 +505,23 @@ class Don extends CommonObject
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_MODIFY', $user);
|
||||
$result = $this->call_trigger('DON_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
// Update extrafield
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -529,7 +529,7 @@ class Don extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error )
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
$result = 1;
|
||||
@ -545,7 +545,7 @@ class Don extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
$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;
|
||||
}
|
||||
return $result;
|
||||
@ -561,18 +561,18 @@ class Don extends CommonObject
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
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;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_DELETE', $user);
|
||||
$result = $this->call_trigger('DON_DELETE', $user);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
@ -582,23 +582,10 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
// Delete donation
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "don_extrafields";
|
||||
$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;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don_extrafields";
|
||||
$sql .= " WHERE fk_object=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
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();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$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();
|
||||
return -1;
|
||||
}
|
||||
@ -638,28 +638,28 @@ class Don extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$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_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.= " p.ref as project_ref,";
|
||||
$sql.= " cp.libelle as payment_label, cp.code as payment_code,";
|
||||
$sql.= " c.code as country_code, c.label as country";
|
||||
$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."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.= " WHERE d.entity IN (".getEntity('donation').")";
|
||||
if (! empty($id))
|
||||
$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.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
|
||||
$sql .= " p.ref as project_ref,";
|
||||
$sql .= " cp.libelle as payment_label, cp.code as payment_code,";
|
||||
$sql .= " c.code as country_code, c.label as country";
|
||||
$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."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 .= " WHERE d.entity IN (".getEntity('donation').")";
|
||||
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);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
@ -671,7 +671,7 @@ class Don extends CommonObject
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$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->datem = $this->db->jdate($obj->datem);
|
||||
$this->date = $this->db->jdate($obj->datedon);
|
||||
@ -686,21 +686,21 @@ class Don extends CommonObject
|
||||
$this->country_id = $obj->fk_country;
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->country = $obj->country;
|
||||
$this->country_olddata = $obj->country_olddata; // deprecated
|
||||
$this->country_olddata = $obj->country_olddata; // deprecated
|
||||
$this->email = $obj->email;
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
$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->public = $obj->public;
|
||||
$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->paid = $obj->paid;
|
||||
$this->paid = $obj->paid;
|
||||
$this->amount = $obj->amount;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
// Retreive all extrafield
|
||||
@ -742,13 +742,13 @@ class Don extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs, $user;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$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 ($this->db->affected_rows($resql))
|
||||
@ -756,7 +756,7 @@ class Don extends CommonObject
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DON_VALIDATE', $user);
|
||||
$result = $this->call_trigger('DON_VALIDATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
@ -796,9 +796,9 @@ class Don extends CommonObject
|
||||
{
|
||||
$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 ($this->db->affected_rows($resql))
|
||||
@ -829,10 +829,10 @@ class Don extends CommonObject
|
||||
// phpcs:enable
|
||||
$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 ( $this->db->affected_rows($resql) )
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -860,18 +860,18 @@ class Don extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$result=0;
|
||||
$result = 0;
|
||||
|
||||
$sql = "SELECT sum(amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don";
|
||||
$sql.= " WHERE fk_statut = ".$param;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don";
|
||||
$sql .= " WHERE fk_statut = ".$param;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$result=$obj->total;
|
||||
$result = $obj->total;
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -888,19 +888,19 @@ class Don extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$this->nb=array();
|
||||
$this->nb = array();
|
||||
|
||||
$sql = "SELECT count(d.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " WHERE d.fk_statut > 0";
|
||||
$sql.= " AND d.entity IN (".getEntity('donation').")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql .= " WHERE d.fk_statut > 0";
|
||||
$sql .= " AND d.entity IN (".getEntity('donation').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
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);
|
||||
return 1;
|
||||
@ -908,7 +908,7 @@ class Don extends CommonObject
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -924,15 +924,15 @@ class Don extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowDonation").': '.$this->id;
|
||||
$result = '';
|
||||
$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">';
|
||||
$linkend='</a>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$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 != 2) $result.= $this->ref;
|
||||
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;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
@ -947,9 +947,9 @@ class Don extends CommonObject
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
|
||||
$sql.= ' d.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'don as d';
|
||||
$sql.= ' WHERE d.rowid = '.$id;
|
||||
$sql .= ' d.tms';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'don as d';
|
||||
$sql .= ' WHERE d.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -996,16 +996,16 @@ class Don extends CommonObject
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
if (! dol_strlen($modele)) {
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'html_cerfafr';
|
||||
|
||||
if ($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;
|
||||
}
|
||||
}
|
||||
@ -1016,37 +1016,37 @@ class Don extends CommonObject
|
||||
//return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
$err = error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$srctemplatepath='';
|
||||
$srctemplatepath = '';
|
||||
|
||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||
$tmp=explode(':', $modele, 2);
|
||||
if (! empty($tmp[1]))
|
||||
$tmp = explode(':', $modele, 2);
|
||||
if (!empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
$modele = $tmp[0];
|
||||
$srctemplatepath = $tmp[1];
|
||||
}
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array('/');
|
||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels, $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array('/');
|
||||
if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']);
|
||||
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";
|
||||
|
||||
// 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))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
$filefound = 1;
|
||||
$classname = $prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1058,17 +1058,17 @@ class Don extends CommonObject
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$object=$this;
|
||||
$object = $this;
|
||||
|
||||
$classname = $modele;
|
||||
$obj = new $classname($this->db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// 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)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
$outputlangs->charset_output = $sav_charset_output;
|
||||
|
||||
// we delete preview files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -1077,7 +1077,7 @@ class Don extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
$outputlangs->charset_output = $sav_charset_output;
|
||||
dol_syslog("Erreur dans don_create");
|
||||
dol_print_error($this->db, $obj->error);
|
||||
return 0;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* \ingroup 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
|
||||
@ -40,7 +40,7 @@ class modMyModule extends DolibarrModules
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs, $conf;
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
@ -73,7 +73,7 @@ class modMyModule extends DolibarrModules
|
||||
// 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 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...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
@ -121,13 +121,13 @@ class modMyModule extends DolibarrModules
|
||||
$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'...)
|
||||
$this->depends = array();
|
||||
$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->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->langfiles = array("mymodule@mymodule");
|
||||
$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->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->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->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->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$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'
|
||||
)*/
|
||||
|
||||
if (! isset($conf->mymodule) || ! isset($conf->mymodule->enabled)) {
|
||||
$conf->mymodule=new stdClass();
|
||||
$conf->mymodule->enabled=0;
|
||||
if (!isset($conf->mymodule) || !isset($conf->mymodule->enabled)) {
|
||||
$conf->mymodule = new stdClass();
|
||||
$conf->mymodule->enabled = 0;
|
||||
}
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
@ -180,7 +180,7 @@ class modMyModule extends DolibarrModules
|
||||
// 'user' to add a tab in user view
|
||||
|
||||
// Dictionaries
|
||||
$this->dictionaries=array();
|
||||
$this->dictionaries = array();
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs'=>'mymodule@mymodule',
|
||||
@ -241,44 +241,44 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Permissions provided by this module
|
||||
$this->rights = array();
|
||||
$r=0;
|
||||
$r = 0;
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$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][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][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$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][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||
$r++;
|
||||
$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][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][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][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)
|
||||
$r++;
|
||||
$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][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][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$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][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||
$r++;
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
|
||||
// Main menu entries to add
|
||||
$this->menu = array();
|
||||
$r=0;
|
||||
$r = 0;
|
||||
// Add here entries to declare new menus
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
$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
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
$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
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>'MyModule',
|
||||
'mainmenu'=>'mymodule',
|
||||
'leftmenu'=>'',
|
||||
'url'=>'/mymodule/mymoduleindex.php',
|
||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'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.
|
||||
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'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.
|
||||
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'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 */
|
||||
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
||||
@ -327,7 +327,7 @@ class modMyModule extends DolibarrModules
|
||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||
|
||||
// Exports profiles provided by this module
|
||||
$r=1;
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("mymodule@mymodule");
|
||||
@ -352,7 +352,7 @@ class modMyModule extends DolibarrModules
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
|
||||
// Imports profiles provided by this module
|
||||
$r=1;
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER IMPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("mymodule@mymodule");
|
||||
@ -384,7 +384,7 @@ class modMyModule extends DolibarrModules
|
||||
{
|
||||
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')
|
||||
|
||||
// Create extrafields during init
|
||||
|
||||
@ -43,19 +43,19 @@
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res=0;
|
||||
$res = 0;
|
||||
// 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
|
||||
$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--; }
|
||||
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";
|
||||
$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--; }
|
||||
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";
|
||||
// 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) die("Include of main fails");
|
||||
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");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.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');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mymodule@mymodule","other"));
|
||||
$langs->loadLangs(array("mymodule@mymodule", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$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');
|
||||
//$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new MyObject($db);
|
||||
$object = new MyObject($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction=$conf->mymodule->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('myobjectcard','globalcard')); // Note that conf->hooks_modules contains array
|
||||
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('myobjectcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$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
|
||||
$search_all=trim(GETPOST("search_all", 'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
$search_all = trim(GETPOST("search_all", 'alpha'));
|
||||
$search = array();
|
||||
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
|
||||
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
|
||||
//if ($user->socid > 0) access_forbidden();
|
||||
@ -117,13 +117,13 @@ $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the in
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$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 (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$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;
|
||||
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
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
@ -158,9 +158,9 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid='myobject'.$object->id;
|
||||
$trigger_name = 'MYOBJECT_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid = 'myobject'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
@ -173,8 +173,8 @@ if (empty($reshook))
|
||||
* Put here all code to build page
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
llxHeader('', $langs->trans('MyObject'), '');
|
||||
|
||||
@ -209,10 +209,10 @@ if ($action == 'create')
|
||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||
|
||||
// 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";
|
||||
|
||||
@ -221,7 +221,7 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
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 '</form>';
|
||||
@ -245,10 +245,10 @@ if (($id || $ref) && $action == 'edit')
|
||||
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -274,7 +274,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Confirmation to 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
|
||||
if ($action == 'deleteline')
|
||||
@ -285,13 +285,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$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
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
$formquestion = array();
|
||||
/*
|
||||
$forcecombo=0;
|
||||
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))
|
||||
);
|
||||
*/
|
||||
$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
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
@ -317,9 +317,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// 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
|
||||
$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);
|
||||
@ -372,10 +372,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
|
||||
//unset($object->fields['fk_project']); // 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.
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
@ -533,13 +533,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id.'">';
|
||||
$morehtmlright.= $langs->trans("SeeAll");
|
||||
$morehtmlright.= '</a>';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
|
||||
// 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);
|
||||
$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>';
|
||||
}
|
||||
|
||||
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.'/commande/class/commande.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;
|
||||
|
||||
$sql = "SELECT tokenstring";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND service = '".$mode."'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " AND service = '".$mode."'";
|
||||
if ($fk_soc > 0) {
|
||||
$sql.= " AND fk_soc = ".$fk_soc;
|
||||
$sql .= " AND fk_soc = ".$fk_soc;
|
||||
}
|
||||
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);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$tokenstring=$obj->tokenstring;
|
||||
$tokenstring = $obj->tokenstring;
|
||||
|
||||
$tmparray = dol_json_decode($tokenstring);
|
||||
$key = $tmparray->stripe_user_id;
|
||||
} else {
|
||||
$tokenstring='';
|
||||
$tokenstring = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -133,7 +133,7 @@ class Stripe extends CommonObject
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
|
||||
$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;
|
||||
|
||||
$sql = "SELECT sa.key_account as key_account, sa.entity"; // key_account is cus_....
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa";
|
||||
$sql.= " WHERE sa.fk_soc = " . $object->id;
|
||||
$sql.= " AND sa.entity IN (".getEntity('societe').")";
|
||||
$sql.= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
||||
$sql.= " AND key_account IS NOT NULL AND key_account <> ''";
|
||||
$sql = "SELECT sa.key_account as key_account, sa.entity"; // key_account is cus_....
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
|
||||
$sql .= " WHERE sa.fk_soc = ".$object->id;
|
||||
$sql .= " AND sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
|
||||
$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);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -174,7 +174,7 @@ class Stripe extends CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$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
|
||||
global $stripearrayofkeysbyenv;
|
||||
@ -187,7 +187,7 @@ class Stripe extends CommonObject
|
||||
$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.'
|
||||
$this->error = $e->getMessage();
|
||||
@ -230,11 +230,11 @@ class Stripe extends CommonObject
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
//$taxids = $customer->allTaxIds($customer->id);
|
||||
@ -244,15 +244,15 @@ class Stripe extends CommonObject
|
||||
}
|
||||
|
||||
// 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 .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', " . $status . ", " . $conf->entity . ", '".$this->db->idate(dol_now())."', ".$user->id.")";
|
||||
$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.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
}
|
||||
@ -288,7 +288,7 @@ class Stripe extends CommonObject
|
||||
$stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
}
|
||||
@ -332,8 +332,8 @@ class Stripe extends CommonObject
|
||||
if (empty($status)) $service = 'StripeTest';
|
||||
else $service = 'StripeLive';
|
||||
|
||||
$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;
|
||||
$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;
|
||||
else $stripeamount = $amount;
|
||||
|
||||
$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) {
|
||||
$fee = $conf->global->STRIPE_APPLICATION_FEE_MINIMAL;
|
||||
}
|
||||
if (! in_array($currency_code, $arrayzerounitcurrency)) {
|
||||
if (!in_array($currency_code, $arrayzerounitcurrency)) {
|
||||
$stripefee = round($fee * 100);
|
||||
} else {
|
||||
$stripefee = round($fee);
|
||||
@ -398,7 +398,7 @@ class Stripe extends CommonObject
|
||||
|
||||
if (empty($paymentintent))
|
||||
{
|
||||
$ipaddress=getUserRemoteIP();
|
||||
$ipaddress = getUserRemoteIP();
|
||||
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
||||
if (is_object($object))
|
||||
{
|
||||
@ -408,17 +408,17 @@ class Stripe extends CommonObject
|
||||
}
|
||||
|
||||
$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,
|
||||
"amount" => $stripeamount,
|
||||
"currency" => $currency_code,
|
||||
"payment_method_types" => array("card"),
|
||||
"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",
|
||||
"metadata" => $metadata
|
||||
);
|
||||
if (! is_null($customer)) $dataforintent["customer"]=$customer;
|
||||
if (!is_null($customer)) $dataforintent["customer"] = $customer;
|
||||
// payment_method =
|
||||
// payment_method_types = array('card')
|
||||
//var_dump($dataforintent);
|
||||
@ -427,13 +427,13 @@ class Stripe extends CommonObject
|
||||
unset($dataforintent['setup_future_usage']);
|
||||
$dataforintent["off_session"] = true;
|
||||
}
|
||||
if (! is_null($payment_method))
|
||||
if (!is_null($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;
|
||||
}
|
||||
@ -452,7 +452,7 @@ class Stripe extends CommonObject
|
||||
$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.
|
||||
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;
|
||||
}
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions);
|
||||
@ -463,12 +463,12 @@ class Stripe extends CommonObject
|
||||
$paymentintentalreadyexists = 0;
|
||||
// Check that payment intent $paymentintent->id is not already recorded.
|
||||
$sql = "SELECT pi.rowid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
|
||||
$sql.= " WHERE pi.entity IN (".getEntity('societe').")";
|
||||
$sql.= " AND pi.ext_payment_site = '" . $service . "'";
|
||||
$sql.= " AND pi.ext_payment_id = '".$this->db->escape($paymentintent->id)."'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi";
|
||||
$sql .= " WHERE pi.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND pi.ext_payment_site = '".$service."'";
|
||||
$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);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -481,17 +481,17 @@ class Stripe extends CommonObject
|
||||
else dol_print_error($this->db);
|
||||
|
||||
// If not, we create it.
|
||||
if (! $paymentintentalreadyexists)
|
||||
if (!$paymentintentalreadyexists)
|
||||
{
|
||||
$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 .= " VALUES ('".$this->db->idate($now)."', '0', '".$this->db->escape($paymentintent->id)."', ".$object->id.", '".$this->db->escape($object->element)."', " . $conf->entity . ", '" . $service . "')";
|
||||
$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 .= " 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);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
catch(Stripe\Error\Card $e)
|
||||
catch (Stripe\Error\Card $e)
|
||||
{
|
||||
$error++;
|
||||
$this->error = $e->getMessage();
|
||||
$this->code = $e->getStripeCode();
|
||||
$this->declinecode = $e->getDeclineCode();
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
/*var_dump($dataforintent);
|
||||
var_dump($description);
|
||||
@ -524,7 +524,7 @@ class Stripe extends CommonObject
|
||||
|
||||
dol_syslog("getPaymentIntent return error=".$error." this->error=".$this->error, LOG_INFO, -1);
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
return $paymentintent;
|
||||
}
|
||||
@ -568,7 +568,7 @@ class Stripe extends CommonObject
|
||||
|
||||
if (empty($setupintent))
|
||||
{
|
||||
$ipaddress=getUserRemoteIP();
|
||||
$ipaddress = getUserRemoteIP();
|
||||
$metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress);
|
||||
if (is_object($object))
|
||||
{
|
||||
@ -578,13 +578,13 @@ class Stripe extends CommonObject
|
||||
}
|
||||
|
||||
$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"),
|
||||
"description" => $description,
|
||||
"usage" => "off_session",
|
||||
"metadata" => $metadata
|
||||
);
|
||||
if (! is_null($customer)) $dataforintent["customer"]=$customer;
|
||||
if (!is_null($customer)) $dataforintent["customer"] = $customer;
|
||||
// payment_method =
|
||||
// payment_method_types = array('card')
|
||||
//var_dump($dataforintent);
|
||||
@ -652,7 +652,7 @@ class Stripe extends CommonObject
|
||||
$_SESSION["stripe_setup_intent"] = $setupintent;
|
||||
}*/
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
/*var_dump($dataforintent);
|
||||
var_dump($description);
|
||||
@ -666,7 +666,7 @@ class Stripe extends CommonObject
|
||||
|
||||
dol_syslog("getSetupIntent return error=".$error, LOG_INFO, -1);
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
return $setupintent;
|
||||
}
|
||||
@ -693,12 +693,12 @@ class Stripe extends CommonObject
|
||||
|
||||
$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.= " 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.= " AND sa.type = '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 .= " WHERE sa.rowid = ".$object->id; // We get record from ID, no need for filter on entity
|
||||
$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);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -706,12 +706,12 @@ class Stripe extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$cardref = $obj->stripe_card_ref;
|
||||
dol_syslog(get_class($this) . "::cardStripe cardref=".$cardref);
|
||||
dol_syslog(get_class($this)."::cardStripe cardref=".$cardref);
|
||||
if ($cardref)
|
||||
{
|
||||
try {
|
||||
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);
|
||||
}
|
||||
@ -720,7 +720,7 @@ class Stripe extends CommonObject
|
||||
$card = \Stripe\PaymentMethod::retrieve($cardref);
|
||||
}
|
||||
} 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);
|
||||
@ -731,7 +731,7 @@ class Stripe extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
@ -739,15 +739,15 @@ class Stripe extends CommonObject
|
||||
}
|
||||
elseif ($createifnotlinkedtostripe)
|
||||
{
|
||||
$exp_date_month=$obj->exp_date_month;
|
||||
$exp_date_year=$obj->exp_date_year;
|
||||
$number=$obj->number;
|
||||
$cvc=$obj->cvn; // cvn in database, cvc for stripe
|
||||
$cardholdername=$obj->proprio;
|
||||
$exp_date_month = $obj->exp_date_month;
|
||||
$exp_date_year = $obj->exp_date_year;
|
||||
$number = $obj->number;
|
||||
$cvc = $obj->cvn; // cvn in database, cvc for stripe
|
||||
$cardholdername = $obj->proprio;
|
||||
|
||||
$dataforcard = array(
|
||||
"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();
|
||||
@ -778,14 +778,14 @@ class Stripe extends CommonObject
|
||||
|
||||
if ($card)
|
||||
{
|
||||
$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.= " country_code = '".$this->db->escape($card->country)."',";
|
||||
$sql.= " approved = ".($card->cvc_check == 'pass' ? 1 : 0);
|
||||
$sql.= " WHERE rowid = " . $object->id;
|
||||
$sql.= " AND type = 'card'";
|
||||
$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 .= " country_code = '".$this->db->escape($card->country)."',";
|
||||
$sql .= " approved = ".($card->cvc_check == 'pass' ? 1 : 0);
|
||||
$sql .= " WHERE rowid = ".$object->id;
|
||||
$sql .= " AND type = 'card'";
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
@ -795,7 +795,7 @@ class Stripe extends CommonObject
|
||||
$this->error = 'Call to cu->source->create return empty card';
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
@ -837,12 +837,12 @@ class Stripe extends CommonObject
|
||||
else $service = 'StripeLive';
|
||||
|
||||
$sql = "SELECT sa.key_account as key_account, sa.fk_soc, sa.entity";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa";
|
||||
$sql.= " WHERE sa.key_account = '" . $this->db->escape($customer) . "'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
|
||||
$sql .= " WHERE sa.key_account = '".$this->db->escape($customer)."'";
|
||||
//$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);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
@ -855,8 +855,8 @@ class Stripe extends CommonObject
|
||||
$key = null;
|
||||
}
|
||||
|
||||
$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;
|
||||
$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;
|
||||
else $stripeamount = $amount;
|
||||
|
||||
$societe = new Societe($this->db);
|
||||
@ -868,22 +868,22 @@ class Stripe extends CommonObject
|
||||
$order = new Commande($this->db);
|
||||
$order->fetch($item);
|
||||
$ref = $order->ref;
|
||||
$description = "ORD=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
||||
$description = "ORD=".$ref.".CUS=".$societe->id.".PM=stripe";
|
||||
} elseif ($origin == 'invoice') {
|
||||
$invoice = new Facture($this->db);
|
||||
$invoice->fetch($item);
|
||||
$ref = $invoice->ref;
|
||||
$description = "INV=" . $ref . ".CUS=" . $societe->id.".PM=stripe";
|
||||
$description = "INV=".$ref.".CUS=".$societe->id.".PM=stripe";
|
||||
}
|
||||
|
||||
$metadata = array(
|
||||
"dol_id" => "" . $item . "",
|
||||
"dol_type" => "" . $origin . "",
|
||||
"dol_thirdparty_id" => "" . $societe->id . "",
|
||||
"dol_id" => "".$item."",
|
||||
"dol_type" => "".$origin."",
|
||||
"dol_thirdparty_id" => "".$societe->id."",
|
||||
'dol_thirdparty_name' => $societe->name,
|
||||
'dol_version'=>DOL_VERSION,
|
||||
'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);
|
||||
try {
|
||||
@ -897,13 +897,13 @@ class Stripe extends CommonObject
|
||||
{
|
||||
$stripecard = $source;
|
||||
$amountstripe = $stripeamount;
|
||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||
$stripe = $return;
|
||||
$amounttopay = $amount;
|
||||
$servicestatus = $status;
|
||||
|
||||
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);
|
||||
|
||||
@ -931,7 +931,7 @@ class Stripe extends CommonObject
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
"amount" => "$stripeamount",
|
||||
"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,
|
||||
"capture" => $capture,
|
||||
"metadata" => $metadata,
|
||||
@ -941,7 +941,7 @@ class Stripe extends CommonObject
|
||||
$paymentarray = array(
|
||||
"amount" => "$stripeamount",
|
||||
"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,
|
||||
"capture" => $capture,
|
||||
"metadata" => $metadata,
|
||||
@ -965,20 +965,20 @@ class Stripe extends CommonObject
|
||||
$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);
|
||||
|
||||
$paymentarray = array(
|
||||
"amount" => "$stripeamount",
|
||||
"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,
|
||||
"capture" => $capture,
|
||||
"metadata" => $metadata,
|
||||
"source" => "$source",
|
||||
"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;
|
||||
}
|
||||
@ -991,13 +991,13 @@ class Stripe extends CommonObject
|
||||
{
|
||||
$stripecard = $source;
|
||||
$amountstripe = $stripeamount;
|
||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||
$FULLTAG = 'PFBO'; // Payment From Back Office
|
||||
$stripe = $return;
|
||||
$amounttopay = $amount;
|
||||
$servicestatus = $status;
|
||||
|
||||
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);
|
||||
|
||||
@ -1035,13 +1035,13 @@ class Stripe extends CommonObject
|
||||
else
|
||||
{
|
||||
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') {
|
||||
$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)
|
||||
));
|
||||
$return->message = $src->card->brand . " ...." . $src->card->last4;
|
||||
$return->message = $src->card->brand." ....".$src->card->last4;
|
||||
} else {
|
||||
$return->message = $charge->id;
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ class Stripe extends CommonObject
|
||||
$return->type = $err['type'];
|
||||
$return->code = $err['code'];
|
||||
$return->message = $err['message'];
|
||||
$body = "Error: <br>" . $return->id . " " . $return->message . " ";
|
||||
$body = "Error: <br>".$return->id." ".$return->message." ";
|
||||
$subject = '[Alert] Payment error using Stripe';
|
||||
$cmailfile = new CMailFile($subject, $conf->global->ONLINE_PAYMENT_SENDEMAIL, $conf->global->MAIN_INFO_SOCIETE_MAIL, $body);
|
||||
$cmailfile->sendfile();
|
||||
|
||||
@ -26,49 +26,49 @@
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '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.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.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');
|
||||
$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);
|
||||
|
||||
$maxcategbydefaultforthisdevice=16;
|
||||
$maxproductbydefaultforthisdevice=32;
|
||||
$maxcategbydefaultforthisdevice = 16;
|
||||
$maxproductbydefaultforthisdevice = 32;
|
||||
if ($conf->browser->layout == 'phone')
|
||||
{
|
||||
$maxcategbydefaultforthisdevice=8;
|
||||
$maxproductbydefaultforthisdevice=16;
|
||||
$maxcategbydefaultforthisdevice = 8;
|
||||
$maxproductbydefaultforthisdevice = 16;
|
||||
//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");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$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);
|
||||
$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);
|
||||
|
||||
|
||||
/*
|
||||
@ -76,9 +76,9 @@ $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultf
|
||||
*/
|
||||
|
||||
// Title
|
||||
$title='TakePOS - Dolibarr '.DOL_VERSION;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
$head='<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
|
||||
$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
|
||||
<meta name="apple-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"/>';
|
||||
@ -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 language="javascript">
|
||||
<?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
|
||||
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
|
||||
$levelofrootcategory=0;
|
||||
$levelofrootcategory = 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)
|
||||
{
|
||||
@ -111,7 +111,7 @@ $levelofmaincategories = $levelofrootcategory + 1;
|
||||
|
||||
$maincategories = array();
|
||||
$subcategories = array();
|
||||
foreach($categories as $key => $categorycursor)
|
||||
foreach ($categories as $key => $categorycursor)
|
||||
{
|
||||
if ($categorycursor['level'] == $levelofmaincategories)
|
||||
{
|
||||
@ -134,7 +134,7 @@ var currentcat;
|
||||
var pageproducts=0;
|
||||
var pagecategories=0;
|
||||
var pageactions=0;
|
||||
var place="<?php echo $place;?>";
|
||||
var place="<?php echo $place; ?>";
|
||||
var editaction="qty";
|
||||
var editnumber="";
|
||||
|
||||
@ -367,13 +367,13 @@ function deleteline() {
|
||||
|
||||
function Customer() {
|
||||
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()
|
||||
{
|
||||
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() {
|
||||
@ -384,17 +384,17 @@ function CloseBill() {
|
||||
|
||||
function Floors() {
|
||||
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() {
|
||||
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() {
|
||||
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() {
|
||||
@ -575,7 +575,7 @@ function TerminalsDialog()
|
||||
{
|
||||
jQuery("#dialog-info").dialog({
|
||||
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); ?>,
|
||||
modal: true,
|
||||
buttons: {
|
||||
@ -598,7 +598,7 @@ function TerminalsDialog()
|
||||
|
||||
function 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();
|
||||
<?php
|
||||
//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();";
|
||||
}
|
||||
?>
|
||||
@ -619,7 +619,7 @@ $( document ).ready(function() {
|
||||
|
||||
<body style="overflow: hidden; background-color:#D1D1D1;">
|
||||
<?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="row1">
|
||||
@ -650,21 +650,21 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS!="1" && $_SESSION["takeposterminal"]=="
|
||||
|
||||
// TakePOS setup check
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND active = 1";
|
||||
$sql.= " ORDER BY libelle";
|
||||
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql .= " AND active = 1";
|
||||
$sql .= " ORDER BY libelle";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$paiementsModes = array();
|
||||
if ($resql){
|
||||
while ($obj = $db->fetch_object($resql)){
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$paycode = $obj->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'CASH';
|
||||
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);
|
||||
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("ProblemIsInSetupOfTerminal").' '.$_SESSION["takeposterminal"], null, 'errors');
|
||||
}
|
||||
if (count($maincategories)==0) {
|
||||
if (count($maincategories) == 0) {
|
||||
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
|
||||
}
|
||||
// User menu and external TakePOS modules
|
||||
$menus = array();
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
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
|
||||
{
|
||||
// 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="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="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">'.$langs->trans("Payment").'</div>', 'action'=>'CloseBill();');
|
||||
$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-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();');
|
||||
|
||||
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();');
|
||||
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();');
|
||||
}
|
||||
|
||||
// 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="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>';
|
||||
}
|
||||
|
||||
@ -773,17 +773,17 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
||||
<!-- Show categories -->
|
||||
<div class="div4">
|
||||
<?php
|
||||
$count=0;
|
||||
$count = 0;
|
||||
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
|
||||
if ($count==($MAXCATEG-2)) {
|
||||
if ($count == ($MAXCATEG - 2)) {
|
||||
//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>';
|
||||
}
|
||||
elseif ($count==($MAXCATEG-1)) {
|
||||
elseif ($count == ($MAXCATEG - 1)) {
|
||||
//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>';
|
||||
}
|
||||
@ -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.'" />';
|
||||
}
|
||||
?>
|
||||
<?php if ($count!=($MAXCATEG-2) && $count!=($MAXCATEG-1)) { ?>
|
||||
<div class="description" id="catdivdesc<?php echo $count;?>">
|
||||
<div class="description_content" id="catdesc<?php echo $count;?>"></div>
|
||||
<?php if ($count != ($MAXCATEG - 2) && $count != ($MAXCATEG - 1)) { ?>
|
||||
<div class="description" id="catdivdesc<?php echo $count; ?>">
|
||||
<div class="description_content" id="catdesc<?php echo $count; ?>"></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="catwatermark" id='catwatermark<?php echo $count;?>'>+</div>
|
||||
<div class="catwatermark" id='catwatermark<?php echo $count; ?>'>+</div>
|
||||
</div>
|
||||
<?php
|
||||
$count++;
|
||||
@ -808,17 +808,17 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
|
||||
<!-- Show product -->
|
||||
<div class="div5">
|
||||
<?php
|
||||
$count=0;
|
||||
$count = 0;
|
||||
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
|
||||
if ($count==($MAXPRODUCT-2)) {
|
||||
if ($count == ($MAXPRODUCT - 2)) {
|
||||
//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>';
|
||||
}
|
||||
elseif ($count==($MAXPRODUCT-1)) {
|
||||
elseif ($count == ($MAXPRODUCT - 1)) {
|
||||
//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>';
|
||||
}
|
||||
@ -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.'">';
|
||||
}
|
||||
?>
|
||||
<?php if ($count!=($MAXPRODUCT-2) && $count!=($MAXPRODUCT-1)) { ?>
|
||||
<div class="description" id="prodivdesc<?php echo $count;?>">
|
||||
<div class="description_content" id="prodesc<?php echo $count;?>"></div>
|
||||
<?php if ($count != ($MAXPRODUCT - 2) && $count != ($MAXPRODUCT - 1)) { ?>
|
||||
<div class="description" id="prodivdesc<?php echo $count; ?>">
|
||||
<div class="description_content" id="prodesc<?php echo $count; ?>"></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="catwatermark" id='prowatermark<?php echo $count;?>'>+</div>
|
||||
<div class="catwatermark" id='prowatermark<?php echo $count; ?>'>+</div>
|
||||
</div>
|
||||
<?php
|
||||
$count++;
|
||||
|
||||
@ -31,92 +31,92 @@
|
||||
*/
|
||||
|
||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
||||
$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));
|
||||
if (! defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
||||
$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));
|
||||
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 ($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
|
||||
{
|
||||
// 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_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));
|
||||
$theme_bgcolor = array(hexdec('F4'), hexdec('F4'), hexdec('F4'));
|
||||
$theme_bgcoloronglet = array(hexdec('DE'), hexdec('E7'), hexdec('EC'));
|
||||
|
||||
// Colors
|
||||
$colorbackhmenu1='60,70,100'; // topmenu
|
||||
$colorbackvmenu1='250,250,250'; // vmenu
|
||||
$colortopbordertitle1='200,200,200'; // top border of title
|
||||
$colorbacktitle1='233,234,237'; // title of tables,list
|
||||
$colorbacktabcard1='255,255,255'; // card
|
||||
$colorbacktabactive='234,234,234';
|
||||
$colorbacklineimpair1='255,255,255'; // line impair
|
||||
$colorbacklineimpair2='255,255,255'; // line impair
|
||||
$colorbacklinepair1='250,250,250'; // line pair
|
||||
$colorbacklinepair2='250,250,250'; // line pair
|
||||
$colorbacklinepairhover='230,237,244'; // line hover
|
||||
$colorbacklinepairchecked='230,237,244'; // line checked
|
||||
$colorbacklinebreak='233,228,230'; // line break
|
||||
$colorbackbody='255,255,255';
|
||||
$colortexttitlenotab='140,80,10'; // 140,80,10 or 10,140,80
|
||||
$colortexttitle='0,0,0';
|
||||
$colortext='0,0,0';
|
||||
$colortextlink='10, 20, 100';
|
||||
$fontsize='0.86em';
|
||||
$fontsizesmaller='0.75em';
|
||||
$topMenuFontSize='1.2em';
|
||||
$toolTipBgColor='rgba(255, 255, 255, 0.96)';
|
||||
$toolTipFontColor='#333';
|
||||
$colorbackhmenu1 = '60,70,100'; // topmenu
|
||||
$colorbackvmenu1 = '250,250,250'; // vmenu
|
||||
$colortopbordertitle1 = '200,200,200'; // top border of title
|
||||
$colorbacktitle1 = '233,234,237'; // title of tables,list
|
||||
$colorbacktabcard1 = '255,255,255'; // card
|
||||
$colorbacktabactive = '234,234,234';
|
||||
$colorbacklineimpair1 = '255,255,255'; // line impair
|
||||
$colorbacklineimpair2 = '255,255,255'; // line impair
|
||||
$colorbacklinepair1 = '250,250,250'; // line pair
|
||||
$colorbacklinepair2 = '250,250,250'; // line pair
|
||||
$colorbacklinepairhover = '230,237,244'; // line hover
|
||||
$colorbacklinepairchecked = '230,237,244'; // line checked
|
||||
$colorbacklinebreak = '233,228,230'; // line break
|
||||
$colorbackbody = '255,255,255';
|
||||
$colortexttitlenotab = '140,80,10'; // 140,80,10 or 10,140,80
|
||||
$colortexttitle = '0,0,0';
|
||||
$colortext = '0,0,0';
|
||||
$colortextlink = '10, 20, 100';
|
||||
$fontsize = '0.86em';
|
||||
$fontsizesmaller = '0.75em';
|
||||
$topMenuFontSize = '1.2em';
|
||||
$toolTipBgColor = 'rgba(255, 255, 255, 0.96)';
|
||||
$toolTipFontColor = '#333';
|
||||
|
||||
// text color
|
||||
$textSuccess ='#28a745';
|
||||
$colorblind_deuteranopes_textSuccess ='#37de5d';
|
||||
$textDanger ='#dc3545';
|
||||
$textWarning ='#bc9526';
|
||||
$textSuccess = '#28a745';
|
||||
$colorblind_deuteranopes_textSuccess = '#37de5d';
|
||||
$textDanger = '#dc3545';
|
||||
$textWarning = '#bc9526';
|
||||
$colorblind_deuteranopes_textWarning = $textWarning; // currently not tested with a color blind people so use default color
|
||||
|
||||
|
||||
// Badges colors
|
||||
$badgePrimary ='#007bff';
|
||||
$badgeSecondary ='#cccccc';
|
||||
$badgeSuccess ='#28a745';
|
||||
$badgeDanger ='#9f4705';
|
||||
$badgeWarning ='#ffc107';
|
||||
$badgeInfo ='#aaaabb';
|
||||
$badgeDark ='#343a40';
|
||||
$badgeLight ='#f8f9fa';
|
||||
$badgePrimary = '#007bff';
|
||||
$badgeSecondary = '#cccccc';
|
||||
$badgeSuccess = '#28a745';
|
||||
$badgeDanger = '#9f4705';
|
||||
$badgeWarning = '#ffc107';
|
||||
$badgeInfo = '#aaaabb';
|
||||
$badgeDark = '#343a40';
|
||||
$badgeLight = '#f8f9fa';
|
||||
|
||||
// badge color ajustement for color blind
|
||||
$colorblind_deuteranopes_badgeSuccess ='#37de5d'; //! text color black
|
||||
$colorblind_deuteranopes_badgeSuccess_textColor7='#000';
|
||||
$colorblind_deuteranopes_badgeWarning ='#e4e411';
|
||||
$colorblind_deuteranopes_badgeSuccess = '#37de5d'; //! text color black
|
||||
$colorblind_deuteranopes_badgeSuccess_textColor7 = '#000';
|
||||
$colorblind_deuteranopes_badgeWarning = '#e4e411';
|
||||
|
||||
/* 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
|
||||
* TODO: use color definition vars above for define badges color status X -> exemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
|
||||
*/
|
||||
$badgeStatus0='#cbd3d3';
|
||||
$badgeStatus1='#bc9526';
|
||||
$badgeStatus2='#e6f0f0';
|
||||
$badgeStatus3='#bca52b';
|
||||
$badgeStatus4='#277d1e';
|
||||
$badgeStatus5='#cad2d2';
|
||||
$badgeStatus6='#cad2d2';
|
||||
$badgeStatus7='#baa32b';
|
||||
$badgeStatus8='#be3013';
|
||||
$badgeStatus9='#e7f0f0';
|
||||
$badgeStatus0 = '#cbd3d3';
|
||||
$badgeStatus1 = '#bc9526';
|
||||
$badgeStatus2 = '#e6f0f0';
|
||||
$badgeStatus3 = '#bca52b';
|
||||
$badgeStatus4 = '#277d1e';
|
||||
$badgeStatus5 = '#cad2d2';
|
||||
$badgeStatus6 = '#cad2d2';
|
||||
$badgeStatus7 = '#baa32b';
|
||||
$badgeStatus8 = '#be3013';
|
||||
$badgeStatus9 = '#e7f0f0';
|
||||
|
||||
// status color ajustement for color blind
|
||||
$colorblind_deuteranopes_badgeStatus4=$colorblind_deuteranopes_badgeStatus7=$colorblind_deuteranopes_badgeSuccess; //! text color black
|
||||
$colorblind_deuteranopes_badgeStatus_textColor4=$colorblind_deuteranopes_badgeStatus_textColor7='#000';
|
||||
$colorblind_deuteranopes_badgeStatus1=$colorblind_deuteranopes_badgeWarning;
|
||||
$colorblind_deuteranopes_badgeStatus_textColor1='#000';
|
||||
$colorblind_deuteranopes_badgeStatus4 = $colorblind_deuteranopes_badgeStatus7 = $colorblind_deuteranopes_badgeSuccess; //! text color black
|
||||
$colorblind_deuteranopes_badgeStatus_textColor4 = $colorblind_deuteranopes_badgeStatus_textColor7 = '#000';
|
||||
$colorblind_deuteranopes_badgeStatus1 = $colorblind_deuteranopes_badgeWarning;
|
||||
$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('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('NOCSRFCHECK')) define('NOCSRFCHECK', 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('NOCSRFCHECK')) define('NOCSRFCHECK', 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('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
|
||||
define('ISLOADEDBYSTEELSHEET', '1');
|
||||
|
||||
|
||||
require __DIR__ . '/theme_vars.inc.php';
|
||||
require __DIR__.'/theme_vars.inc.php';
|
||||
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)
|
||||
// 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->getrights();
|
||||
@ -66,135 +66,135 @@ top_httphead('text/css');
|
||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||
else header('Cache-Control: no-cache');
|
||||
|
||||
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('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
|
||||
|
||||
$langs->load("main", 0, 1);
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
||||
|
||||
$path=''; // This value may be used in future for external module to overwrite 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; }
|
||||
$path = ''; // This value may be used in future for external module to overwrite 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; }
|
||||
|
||||
// Define image path files and other constants
|
||||
$fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif';
|
||||
$img_head='';
|
||||
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||
$dol_hide_topmenu=$conf->dol_hide_topmenu;
|
||||
$dol_hide_leftmenu=$conf->dol_hide_leftmenu;
|
||||
$dol_optimize_smallscreen=$conf->dol_optimize_smallscreen;
|
||||
$dol_no_mouse_hover=$conf->dol_no_mouse_hover;
|
||||
$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif';
|
||||
$img_head = '';
|
||||
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||
$dol_hide_topmenu = $conf->dol_hide_topmenu;
|
||||
$dol_hide_leftmenu = $conf->dol_hide_leftmenu;
|
||||
$dol_optimize_smallscreen = $conf->dol_optimize_smallscreen;
|
||||
$dol_no_mouse_hover = $conf->dol_no_mouse_hover;
|
||||
|
||||
|
||||
//$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||
//$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0;
|
||||
//var_dump($user->conf->THEME_ELDY_RGB);
|
||||
|
||||
$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0);
|
||||
$borderwidth=2;
|
||||
$useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->THEME_ELDY_USEBOLDTITLE : 0);
|
||||
$borderwidth = 2;
|
||||
|
||||
// Case of option always editable
|
||||
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_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_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_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_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
|
||||
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_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_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_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_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
|
||||
|
||||
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||
{
|
||||
// 90A4AE, 607D8B, 455A64, 37474F
|
||||
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card
|
||||
$conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234';
|
||||
$conf->global->THEME_ELDY_TEXT='0,0,0';
|
||||
$conf->global->THEME_ELDY_FONT_SIZE1='14';
|
||||
$conf->global->THEME_ELDY_FONT_SIZE2='11';
|
||||
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
|
||||
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
|
||||
$conf->global->THEME_ELDY_TEXT = '0,0,0';
|
||||
$conf->global->THEME_ELDY_FONT_SIZE1 = '14';
|
||||
$conf->global->THEME_ELDY_FONT_SIZE2 = '11';
|
||||
}
|
||||
|
||||
// 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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
$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);
|
||||
|
||||
// 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));
|
||||
$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))
|
||||
$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));
|
||||
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));
|
||||
$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));
|
||||
$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));
|
||||
}
|
||||
|
||||
if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1;
|
||||
if (empty($colortopbordertitle1)) $colortopbordertitle1 = $colorbackhmenu1;
|
||||
|
||||
// Set text color to black or white
|
||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart=explode(',', $colorbackhmenu1);
|
||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) $colortextbackhmenu='FFFFFF';
|
||||
else $colortextbackhmenu='000000';
|
||||
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbackhmenu1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF';
|
||||
else $colortextbackhmenu = '000000';
|
||||
|
||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart=explode(',', $colorbackvmenu1);
|
||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbackvmenu='FFFFFF'; }
|
||||
else { $colortextbackvmenu='000000'; }
|
||||
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbackvmenu1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; }
|
||||
else { $colortextbackvmenu = '000000'; }
|
||||
|
||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
||||
$tmppart=explode(',', $colorbacktitle1);
|
||||
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbacktitle1);
|
||||
if ($colortexttitle == '')
|
||||
{
|
||||
$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'; }
|
||||
else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; }
|
||||
$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'; }
|
||||
else { $colortexttitle = '101010'; $colorshadowtitle = 'FFFFFF'; }
|
||||
}
|
||||
else $colorshadowtitle='888888';
|
||||
else $colorshadowtitle = '888888';
|
||||
|
||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||
$tmppart=explode(',', $colorbacktabcard1);
|
||||
$tmpval=(! empty($tmppart[0]) ? $tmppart[0] : 0)+(! empty($tmppart[1]) ? $tmppart[1] : 0)+(! empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbacktab='FFFFFF'; }
|
||||
else { $colortextbacktab='111111'; }
|
||||
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbacktabcard1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; }
|
||||
else { $colortextbacktab = '111111'; }
|
||||
|
||||
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
||||
$colorbackhmenu1=join(',', colorStringToArray($colorbackhmenu1));
|
||||
$colorbackvmenu1=join(',', colorStringToArray($colorbackvmenu1));
|
||||
$colorbacktitle1=join(',', colorStringToArray($colorbacktitle1));
|
||||
$colorbacktabcard1=join(',', colorStringToArray($colorbacktabcard1));
|
||||
$colorbacktabactive=join(',', colorStringToArray($colorbacktabactive));
|
||||
$colorbacklineimpair1=join(',', colorStringToArray($colorbacklineimpair1));
|
||||
$colorbacklineimpair2=join(',', colorStringToArray($colorbacklineimpair2));
|
||||
$colorbacklinepair1=join(',', colorStringToArray($colorbacklinepair1));
|
||||
$colorbacklinepair2=join(',', colorStringToArray($colorbacklinepair2));
|
||||
if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',', colorStringToArray($colorbacklinepairhover));
|
||||
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',', colorStringToArray($colorbacklinepairchecked));
|
||||
$colorbackbody=join(',', colorStringToArray($colorbackbody));
|
||||
$colortexttitlenotab=join(',', colorStringToArray($colortexttitlenotab));
|
||||
$colortexttitle=join(',', colorStringToArray($colortexttitle));
|
||||
$colortext=join(',', colorStringToArray($colortext));
|
||||
$colortextlink=join(',', colorStringToArray($colortextlink));
|
||||
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1));
|
||||
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1));
|
||||
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1));
|
||||
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1));
|
||||
$colorbacktabactive = join(',', colorStringToArray($colorbacktabactive));
|
||||
$colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
|
||||
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
|
||||
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
|
||||
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
|
||||
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
|
||||
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
|
||||
$colorbackbody = join(',', colorStringToArray($colorbackbody));
|
||||
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
|
||||
$colortexttitle = join(',', colorStringToArray($colortexttitle));
|
||||
$colortext = join(',', colorStringToArray($colortext));
|
||||
$colortextlink = join(',', colorStringToArray($colortextlink));
|
||||
|
||||
$nbtopmenuentries=$menumanager->showmenu('topnb');
|
||||
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
||||
|
||||
print '/*'."\n";
|
||||
@ -249,7 +249,7 @@ body {
|
||||
}
|
||||
|
||||
.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: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-family: <?php print $fontlist ?>;
|
||||
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;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
@ -635,7 +635,7 @@ textarea.centpercent {
|
||||
text-align: justify;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: <?php print ($dol_optimize_smallscreen?'normal':'nowrap'); ?>;
|
||||
white-space: <?php print ($dol_optimize_smallscreen ? 'normal' : 'nowrap'); ?>;
|
||||
}
|
||||
.liste_titre .nowrap {
|
||||
white-space: nowrap;
|
||||
@ -706,20 +706,20 @@ textarea.centpercent {
|
||||
}
|
||||
|
||||
.text-warning{
|
||||
color : <?php print $textWarning ; ?>
|
||||
color : <?php print $textWarning; ?>
|
||||
}
|
||||
body[class*="colorblind-"] .text-warning{
|
||||
color : <?php print $colorblind_deuteranopes_textWarning ; ?>
|
||||
color : <?php print $colorblind_deuteranopes_textWarning; ?>
|
||||
}
|
||||
.text-success{
|
||||
color : <?php print $textSuccess ; ?>
|
||||
color : <?php print $textSuccess; ?>
|
||||
}
|
||||
body[class*="colorblind-"] .text-success{
|
||||
color : <?php print $colorblind_deuteranopes_textSuccess ; ?>
|
||||
color : <?php print $colorblind_deuteranopes_textSuccess; ?>
|
||||
}
|
||||
|
||||
.text-danger{
|
||||
color : <?php print $textDanger ; ?>
|
||||
color : <?php print $textDanger; ?>
|
||||
}
|
||||
|
||||
.editfielda span.fa-pencil-alt {
|
||||
@ -938,7 +938,7 @@ div.fiche>form>div.div-table-responsive {
|
||||
}
|
||||
|
||||
.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;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
@ -1058,10 +1058,10 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
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 {
|
||||
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)
|
||||
{
|
||||
body {
|
||||
font-size: <?php print $fontsize+3; ?>px;
|
||||
font-size: <?php print $fontsize + 3; ?>px;
|
||||
}
|
||||
div.refidno {
|
||||
font-size: <?php print $fontsize+3; ?>px !important;
|
||||
font-size: <?php print $fontsize + 3; ?>px !important;
|
||||
}
|
||||
|
||||
.login_vertical_align {
|
||||
@ -1088,7 +1088,7 @@ table[summary="list_of_modules"] .fa-cog {
|
||||
white-space: nowrap;
|
||||
}
|
||||
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 {
|
||||
height: 40px !important;
|
||||
@ -1243,7 +1243,7 @@ td.showDragHandle {
|
||||
font-family: "RobotoDraft","Roboto",sans-serif;
|
||||
left: 0;
|
||||
<?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 { ?>
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
@ -1273,7 +1273,7 @@ td.showDragHandle {
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
-webkit-overflow-scrolling: touch;
|
||||
<?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 { ?>
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
@ -1302,7 +1302,7 @@ body.sidebar-collapse .side-nav-vert, body.sidebar-collapse #id-right {
|
||||
margin-left: 228px;
|
||||
}
|
||||
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;
|
||||
<?php } else { ?>
|
||||
left: -229px;
|
||||
@ -1317,7 +1317,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block {
|
||||
<?php } ?>
|
||||
|
||||
/* 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 {
|
||||
width: 100%;
|
||||
}
|
||||
@ -1331,7 +1331,7 @@ div.login_block {
|
||||
|
||||
.side-nav {
|
||||
<?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 { ?>
|
||||
overflow-x: initial !important;
|
||||
overflow-y: scroll;
|
||||
@ -1380,7 +1380,7 @@ div.login_block {
|
||||
background: rgb(<?php echo $colorbackvmenu1; ?>);
|
||||
border-right: 1px solid rgba(0,0,0,0.3);
|
||||
<?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;
|
||||
<?php } else { ?>
|
||||
top: 60px ! important;
|
||||
@ -1393,9 +1393,9 @@ div.fiche {
|
||||
<?php } ?>
|
||||
|
||||
div.fiche {
|
||||
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;
|
||||
<?php if (! empty($dol_hide_leftmenu) && ! empty($dol_hide_topmenu)) print 'margin-top: 12px;'; ?>
|
||||
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;
|
||||
<?php if (!empty($dol_hide_leftmenu) && !empty($dol_hide_topmenu)) print 'margin-top: 12px;'; ?>
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
body.onlinepaymentbody div.fiche { /* For online payment page */
|
||||
@ -1409,28 +1409,28 @@ div.fichecenterbis {
|
||||
margin-top: 8px;
|
||||
}
|
||||
div.fichethirdleft {
|
||||
<?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 "float: ".$left.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
|
||||
}
|
||||
div.fichetwothirdright {
|
||||
<?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 "float: ".$right.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
|
||||
}
|
||||
div.fichetwothirdright div.ficheaddleft {
|
||||
padding-left: 20px;
|
||||
}
|
||||
div.fichehalfleft {
|
||||
<?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 "float: ".$left.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
||||
}
|
||||
div.fichehalfright {
|
||||
<?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 "float: ".$right.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?>
|
||||
}
|
||||
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 {
|
||||
padding-right: 10px;
|
||||
@ -1442,9 +1442,9 @@ div.secondcolumn div.box {
|
||||
@media only screen and (max-width: 900px)
|
||||
{
|
||||
div.fiche {
|
||||
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;
|
||||
<?php if (! empty($conf->dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
||||
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;
|
||||
<?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?>
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
div.fichecenter {
|
||||
@ -1638,12 +1638,12 @@ img.photorefnoborder {
|
||||
/* ============================================================================== */
|
||||
|
||||
<?php
|
||||
$minwidthtmenu=66; /* minimum width for one top menu entry */
|
||||
$heightmenu=48; /* height of top menu, part with image */
|
||||
$heightmenu2=48; /* height of top menu, ârt with login */
|
||||
$minwidthtmenu = 66; /* minimum width for one top menu entry */
|
||||
$heightmenu = 48; /* height of top menu, part with image */
|
||||
$heightmenu2 = 48; /* height of top menu, ârt with login */
|
||||
$disableimages = 0;
|
||||
$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 {
|
||||
@ -1742,12 +1742,12 @@ ul.tmenu li {
|
||||
*/
|
||||
}
|
||||
li.tmenu, li.tmenusel {
|
||||
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
|
||||
<?php print $minwidthtmenu ? 'min-width: '.$minwidthtmenu.'px;' : ''; ?>
|
||||
text-align: center;
|
||||
vertical-align: bottom;
|
||||
<?php if (empty($conf->global->MAIN_MENU_INVERT)) { ?>
|
||||
float: <?php print $left; ?>;
|
||||
<?php if (! $disableimages) { ?>
|
||||
<?php if (!$disableimages) { ?>
|
||||
height: <?php print $heightmenu; ?>px;
|
||||
padding: 0px 0px 2px 0px;
|
||||
<?php } else { ?>
|
||||
@ -1773,8 +1773,8 @@ div.tmenuleft
|
||||
margin-top: 0px;
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { ?>
|
||||
width: 5px;
|
||||
<?php if (! $disableimages) { ?>
|
||||
height: <?php print $heightmenu+4; ?>px;
|
||||
<?php if (!$disableimages) { ?>
|
||||
height: <?php print $heightmenu + 4; ?>px;
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
}
|
||||
@ -1806,14 +1806,14 @@ div.mainmenu {
|
||||
position : relative;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center top;
|
||||
height: <?php echo ($heightmenu-22); ?>px;
|
||||
height: <?php echo ($heightmenu - 22); ?>px;
|
||||
margin-left: 0px;
|
||||
min-width: 40px;
|
||||
}
|
||||
|
||||
/* Do not load menu img if hidden to save bandwidth */
|
||||
<?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 } ?>
|
||||
|
||||
@ -1907,55 +1907,55 @@ div.mainmenu.website {
|
||||
<?php
|
||||
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')
|
||||
|
||||
$moduletomainmenu=array(
|
||||
'user'=>'','syslog'=>'','societe'=>'companies','projet'=>'project','propale'=>'commercial','commande'=>'commercial',
|
||||
'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',
|
||||
'contrat'=>'commercial','ficheinter'=>'commercial','ticket'=>'ticket','deplacement'=>'commercial',
|
||||
$moduletomainmenu = array(
|
||||
'user'=>'', 'syslog'=>'', 'societe'=>'companies', 'projet'=>'project', 'propale'=>'commercial', 'commande'=>'commercial',
|
||||
'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',
|
||||
'contrat'=>'commercial', 'ficheinter'=>'commercial', 'ticket'=>'ticket', 'deplacement'=>'commercial',
|
||||
'fournisseur'=>'companies',
|
||||
'barcode'=>'',
|
||||
'fckeditor'=>'',
|
||||
'categorie'=>'',
|
||||
);
|
||||
$mainmenuused='home';
|
||||
foreach($conf->modules as $val)
|
||||
$mainmenuused = 'home';
|
||||
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
|
||||
$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
|
||||
$divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition');
|
||||
foreach($mainmenuusedarray as $val)
|
||||
$divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition');
|
||||
foreach ($mainmenuusedarray as $val)
|
||||
{
|
||||
if (empty($val) || in_array($val, $divalreadydefined)) continue;
|
||||
if (in_array($val, $divnotrequired)) continue;
|
||||
//print "XXX".$val;
|
||||
|
||||
// Search img file in module dir
|
||||
$found=0; $url='';
|
||||
foreach($conf->file->dol_document_root as $dirroot)
|
||||
$found = 0; $url = '';
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
if (file_exists($dirroot."/".$val."/img/".$val."_over.png"))
|
||||
{
|
||||
$url=dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
|
||||
$found=1;
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$val.'_over.png', 1);
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
|
||||
{
|
||||
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||
$found=1;
|
||||
$url = dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
|
||||
$found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 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 'div.mainmenu.'.$val.'::before {
|
||||
content: "\f249";
|
||||
@ -1964,7 +1964,7 @@ div.mainmenu.website {
|
||||
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";
|
||||
$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 " background-image: url(".$url.");\n";
|
||||
print "}\n";
|
||||
@ -2132,7 +2132,7 @@ div.login_block {
|
||||
padding-bottom: 3px;
|
||||
<?php print $left; ?>: 0;
|
||||
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;
|
||||
<?php } else { ?>
|
||||
position: fixed;
|
||||
@ -2278,11 +2278,11 @@ div.blockvmenulogo
|
||||
border-bottom: 0 !important;
|
||||
}
|
||||
.menulogocontainer {
|
||||
margin: <?php echo $disableimages?'0':'6'; ?>px;
|
||||
margin: <?php echo $disableimages ? '0' : '6'; ?>px;
|
||||
margin-left: 12px;
|
||||
margin-right: 6px;
|
||||
padding: 0;
|
||||
height: <?php echo $disableimages?'20':'32'; ?>px;
|
||||
height: <?php echo $disableimages ? '20' : '32'; ?>px;
|
||||
/* width: 100px; */
|
||||
max-width: 100px;
|
||||
vertical-align: middle;
|
||||
@ -2629,7 +2629,7 @@ span.tabspan {
|
||||
|
||||
#undertopmenu {
|
||||
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 {
|
||||
@ -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
|
||||
{
|
||||
background: rgb(<?php echo $colorbacktitle1; ?>);
|
||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
||||
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
|
||||
border-bottom: 1px solid #FDFFFF;
|
||||
|
||||
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
|
||||
{
|
||||
font-family: <?php print $fontlist ?>;
|
||||
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
|
||||
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
|
||||
vertical-align: middle;
|
||||
height: 24px;
|
||||
}
|
||||
@ -3456,7 +3456,7 @@ tr.box_titre {
|
||||
background-repeat: repeat-x;
|
||||
color: rgb(<?php echo $colortexttitle; ?>);
|
||||
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;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@ -3648,7 +3648,7 @@ div.titre {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
/* 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 {
|
||||
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-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, .ui-button-icons-only .ui-button-text { padding: 2px 0px 6px 0px; }
|
||||
.ui-button-text
|
||||
@ -4375,7 +4375,7 @@ pre#editfilecontentaceeditorid {
|
||||
/* ============================================================================== */
|
||||
|
||||
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 {
|
||||
@ -4526,12 +4526,12 @@ div#ecm-layout-center {
|
||||
|
||||
.jnotify-container {
|
||||
position: fixed !important;
|
||||
<?php if (! empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?>
|
||||
<?php if (!empty($conf->global->MAIN_JQUERY_JNOTIFY_BOTTOM)) { ?>
|
||||
top: auto !important;
|
||||
bottom: 4px !important;
|
||||
<?php } ?>
|
||||
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;
|
||||
max-width: 1024px;
|
||||
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 }
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
// 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 . '/product/class/product.class.php';
|
||||
|
||||
@ -130,7 +130,7 @@ class Website extends CommonObject
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->entity)) {
|
||||
@ -158,39 +158,39 @@ class Website extends CommonObject
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
$sql.= 'entity,';
|
||||
$sql.= 'ref,';
|
||||
$sql.= 'description,';
|
||||
$sql.= 'status,';
|
||||
$sql.= 'fk_default_home,';
|
||||
$sql.= 'virtualhost,';
|
||||
$sql.= 'fk_user_creat,';
|
||||
$sql.= 'date_creation,';
|
||||
$sql.= 'tms';
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||
$sql .= 'entity,';
|
||||
$sql .= 'ref,';
|
||||
$sql .= 'description,';
|
||||
$sql .= 'status,';
|
||||
$sql .= 'fk_default_home,';
|
||||
$sql .= 'virtualhost,';
|
||||
$sql .= 'fk_user_creat,';
|
||||
$sql .= 'date_creation,';
|
||||
$sql .= 'tms';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' '.((empty($this->entity) && $this->entity != '0')?'NULL':$this->entity).',';
|
||||
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
|
||||
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
|
||||
$sql .= ' '.(! isset($this->status)?'1':$this->status).',';
|
||||
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
|
||||
$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->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 .= ' '.((empty($this->entity) && $this->entity != '0') ? 'NULL' : $this->entity).',';
|
||||
$sql .= ' '.(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").',';
|
||||
$sql .= ' '.(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").',';
|
||||
$sql .= ' '.(!isset($this->status) ? '1' : $this->status).',';
|
||||
$sql .= ' '.(!isset($this->fk_default_home) ? 'NULL' : $this->fk_default_home).',';
|
||||
$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->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 .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
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
|
||||
// want this action to call a trigger.
|
||||
@ -207,7 +207,7 @@ class Website extends CommonObject
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
@ -238,12 +238,12 @@ class Website extends CommonObject
|
||||
$sql .= " t.fk_user_modif,";
|
||||
$sql .= " t.date_creation,";
|
||||
$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').')';
|
||||
if (! empty($ref)) {
|
||||
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
|
||||
if (!empty($ref)) {
|
||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||
} else {
|
||||
$sql .= ' AND t.rowid = ' . (int) $id;
|
||||
$sql .= ' AND t.rowid = '.(int) $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -278,10 +278,10 @@ class Website extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,11 +292,11 @@ class Website extends CommonObject
|
||||
*/
|
||||
public function fetchLines()
|
||||
{
|
||||
$this->lines=array();
|
||||
$this->lines = array();
|
||||
|
||||
// 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.date_creation,";
|
||||
$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').')';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
$sqlwhere [] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
||||
}
|
||||
$this->records = array();
|
||||
|
||||
@ -375,10 +375,10 @@ class Website extends CommonObject
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
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
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
$sql .= ' entity = '.(isset($this->entity)?$this->entity:"null").',';
|
||||
$sql .= ' ref = '.(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").',';
|
||||
$sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").',';
|
||||
$sql .= ' status = '.(isset($this->status)?$this->status:"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 .= ' 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 = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||
$sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").',';
|
||||
$sql .= ' ref = '.(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").',';
|
||||
$sql .= ' description = '.(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").',';
|
||||
$sql .= ' status = '.(isset($this->status) ? $this->status : "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 .= ' 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 .= ' 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();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
@ -450,7 +450,7 @@ class Website extends CommonObject
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
@ -487,20 +487,20 @@ class Website extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
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);
|
||||
}
|
||||
@ -509,7 +509,7 @@ class Website extends CommonObject
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
@ -533,7 +533,7 @@ class Website extends CommonObject
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
$now = dol_now();
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -542,7 +542,7 @@ class Website extends CommonObject
|
||||
// Check no site with ref exists
|
||||
if ($object->fetch(0, $newref) > 0)
|
||||
{
|
||||
$this->error='ErrorNewRefIsAlreadyUsed';
|
||||
$this->error = 'ErrorNewRefIsAlreadyUsed';
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -551,14 +551,14 @@ class Website extends CommonObject
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
|
||||
$oldidforhome=$object->fk_default_home;
|
||||
$oldref=$object->ref;
|
||||
$oldidforhome = $object->fk_default_home;
|
||||
$oldref = $object->ref;
|
||||
|
||||
$pathofwebsiteold=$dolibarr_main_data_root.'/website/'.$oldref;
|
||||
$pathofwebsitenew=$dolibarr_main_data_root.'/website/'.$newref;
|
||||
$pathofwebsiteold = $dolibarr_main_data_root.'/website/'.$oldref;
|
||||
$pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$newref;
|
||||
dol_delete_dir_recursive($pathofwebsitenew);
|
||||
|
||||
$fileindex=$pathofwebsitenew.'/index.php';
|
||||
$fileindex = $pathofwebsitenew.'/index.php';
|
||||
|
||||
// Reset some properties
|
||||
unset($object->id);
|
||||
@ -566,9 +566,9 @@ class Website extends CommonObject
|
||||
unset($object->import_key);
|
||||
|
||||
// Clear fields
|
||||
$object->ref=$newref;
|
||||
$object->fk_default_home=0;
|
||||
$object->virtualhost='';
|
||||
$object->ref = $newref;
|
||||
$object->fk_default_home = 0;
|
||||
$object->virtualhost = '';
|
||||
$object->date_creation = $now;
|
||||
$object->fk_user_creat = $user->id;
|
||||
|
||||
@ -576,43 +576,43 @@ class Website extends CommonObject
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
$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);
|
||||
|
||||
// Check symlink to medias and restore it if ko
|
||||
$pathtomedias=DOL_DATA_ROOT.'/medias'; // Target
|
||||
$pathtomediasinwebsite=$pathofwebsitenew.'/medias'; // Source / Link name
|
||||
if (! is_link(dol_osencode($pathtomediasinwebsite)))
|
||||
$pathtomedias = DOL_DATA_ROOT.'/medias'; // Target
|
||||
$pathtomediasinwebsite = $pathofwebsitenew.'/medias'; // Source / Link name
|
||||
if (!is_link(dol_osencode($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);
|
||||
}
|
||||
|
||||
// Copy images and js dir
|
||||
$pathofmediasjsold=DOL_DATA_ROOT.'/medias/js/'.$oldref;
|
||||
$pathofmediasjsnew=DOL_DATA_ROOT.'/medias/js/'.$newref;
|
||||
$pathofmediasjsold = DOL_DATA_ROOT.'/medias/js/'.$oldref;
|
||||
$pathofmediasjsnew = DOL_DATA_ROOT.'/medias/js/'.$newref;
|
||||
dolCopyDir($pathofmediasjsold, $pathofmediasjsnew, $conf->global->MAIN_UMASK, 0);
|
||||
|
||||
$pathofmediasimageold=DOL_DATA_ROOT.'/medias/image/'.$oldref;
|
||||
$pathofmediasimagenew=DOL_DATA_ROOT.'/medias/image/'.$newref;
|
||||
$pathofmediasimageold = DOL_DATA_ROOT.'/medias/image/'.$oldref;
|
||||
$pathofmediasimagenew = DOL_DATA_ROOT.'/medias/image/'.$newref;
|
||||
dolCopyDir($pathofmediasimageold, $pathofmediasimagenew, $conf->global->MAIN_UMASK, 0);
|
||||
|
||||
$newidforhome=0;
|
||||
$newidforhome = 0;
|
||||
|
||||
// Duplicate pages
|
||||
$objectpages = new WebsitePage($this->db);
|
||||
$listofpages = $objectpages->fetchAll($fromid);
|
||||
foreach($listofpages as $pageid => $objectpageold)
|
||||
foreach ($listofpages as $pageid => $objectpageold)
|
||||
{
|
||||
// Delete old file
|
||||
$filetplold=$pathofwebsitenew.'/page'.$pageid.'.tpl.php';
|
||||
$filetplold = $pathofwebsitenew.'/page'.$pageid.'.tpl.php';
|
||||
dol_delete_file($filetplold);
|
||||
|
||||
// Create new file
|
||||
@ -621,15 +621,15 @@ class Website extends CommonObject
|
||||
//print $pageid.' = '.$objectpageold->pageurl.' -> '.$objectpagenew->id.' = '.$objectpagenew->pageurl.'<br>';
|
||||
if (is_object($objectpagenew) && $objectpagenew->pageurl)
|
||||
{
|
||||
$filealias=$pathofwebsitenew.'/'.$objectpagenew->pageurl.'.php';
|
||||
$filetplnew=$pathofwebsitenew.'/page'.$objectpagenew->id.'.tpl.php';
|
||||
$filealias = $pathofwebsitenew.'/'.$objectpagenew->pageurl.'.php';
|
||||
$filetplnew = $pathofwebsitenew.'/page'.$objectpagenew->id.'.tpl.php';
|
||||
|
||||
// Save page alias
|
||||
$result=dolSavePageAlias($filealias, $object, $objectpagenew);
|
||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||
$result = dolSavePageAlias($filealias, $object, $objectpagenew);
|
||||
if (!$result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||
|
||||
$result=dolSavePageContent($filetplnew, $object, $objectpagenew);
|
||||
if (! $result) setEventMessages('Failed to write file '.$filetplnew, null, 'errors');
|
||||
$result = dolSavePageContent($filetplnew, $object, $objectpagenew);
|
||||
if (!$result) setEventMessages('Failed to write file '.$filetplnew, null, 'errors');
|
||||
|
||||
if ($pageid == $oldidforhome)
|
||||
{
|
||||
@ -644,21 +644,21 @@ class Website extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// Restore id of home page
|
||||
$object->fk_default_home = $newidforhome;
|
||||
$res = $object->update($user);
|
||||
if (! $res > 0)
|
||||
if (!$res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$filetpl=$pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
|
||||
$filewrapper=$pathofwebsitenew.'/wrapper.php';
|
||||
$filetpl = $pathofwebsitenew.'/page'.$newidforhome.'.tpl.php';
|
||||
$filewrapper = $pathofwebsitenew.'/wrapper.php';
|
||||
|
||||
// Generate the index.php page to be the home page
|
||||
//-------------------------------------------------
|
||||
@ -676,7 +676,7 @@ class Website extends CommonObject
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -701,23 +701,23 @@ class Website extends CommonObject
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("WebSite") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = '<u>'.$langs->trans("WebSite").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
||||
$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.= '>';
|
||||
$linkend='</a>';
|
||||
$linkstart .= ($notooltip ? '' : ' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss ? ' '.$morecss : '').'"');
|
||||
$linkstart .= '>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$linkstart = $linkend = '';
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
$result .= ($linkstart.img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result .= ' ';
|
||||
}
|
||||
$result.= $linkstart . $this->ref . $linkend;
|
||||
$result .= $linkstart.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -806,7 +806,7 @@ class Website extends CommonObject
|
||||
|
||||
dol_syslog("Create temp dir ".$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');
|
||||
return '';
|
||||
@ -815,7 +815,7 @@ class Website extends CommonObject
|
||||
$destdir = $conf->website->dir_temp.'/'.$website->ref;
|
||||
|
||||
dol_syslog("Clear temp dir ".$destdir);
|
||||
$count=0; $countreallydeleted=0;
|
||||
$count = 0; $countreallydeleted = 0;
|
||||
$counttodelete = dol_delete_dir_recursive($destdir, $count, 1, 0, $countreallydeleted);
|
||||
if ($counttodelete != $countreallydeleted)
|
||||
{
|
||||
@ -823,8 +823,8 @@ class Website extends CommonObject
|
||||
return '';
|
||||
}
|
||||
|
||||
$arrayreplacementinfilename=array();
|
||||
$arrayreplacementincss=array();
|
||||
$arrayreplacementinfilename = array();
|
||||
$arrayreplacementincss = array();
|
||||
$arrayreplacementincss['file=image/'.$website->ref.'/'] = "file=image/__WEBSITE_KEY__/";
|
||||
$arrayreplacementincss['file=js/'.$website->ref.'/'] = "file=js/__WEBSITE_KEY__/";
|
||||
$arrayreplacementincss['medias/image/'.$website->ref.'/'] = "medias/image/__WEBSITE_KEY__/";
|
||||
@ -876,18 +876,18 @@ class Website extends CommonObject
|
||||
$listofpages = $objectpages->fetchAll($website->id);
|
||||
|
||||
// Assign ->newid and ->newfk_page
|
||||
$i=1;
|
||||
foreach($listofpages as $pageid => $objectpageold)
|
||||
$i = 1;
|
||||
foreach ($listofpages as $pageid => $objectpageold)
|
||||
{
|
||||
$objectpageold->newid=$i;
|
||||
$objectpageold->newid = $i;
|
||||
$i++;
|
||||
}
|
||||
$i=1;
|
||||
foreach($listofpages as $pageid => $objectpageold)
|
||||
$i = 1;
|
||||
foreach ($listofpages as $pageid => $objectpageold)
|
||||
{
|
||||
// Search newid
|
||||
$newfk_page=0;
|
||||
foreach($listofpages as $pageid2 => $objectpageold2)
|
||||
$newfk_page = 0;
|
||||
foreach ($listofpages as $pageid2 => $objectpageold2)
|
||||
{
|
||||
if ($pageid2 == $objectpageold->fk_page)
|
||||
{
|
||||
@ -895,41 +895,41 @@ class Website extends CommonObject
|
||||
break;
|
||||
}
|
||||
}
|
||||
$objectpageold->newfk_page=$newfk_page;
|
||||
$objectpageold->newfk_page = $newfk_page;
|
||||
$i++;
|
||||
}
|
||||
foreach($listofpages as $pageid => $objectpageold)
|
||||
foreach ($listofpages as $pageid => $objectpageold)
|
||||
{
|
||||
$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.= "\n";
|
||||
$line = '-- Page ID '.$objectpageold->id.' -> '.$objectpageold->newid.'__+MAX_llx_website_page__ - Aliases '.$allaliases.' --;'; // newid start at 1, 2...
|
||||
$line .= "\n";
|
||||
fputs($fp, $line);
|
||||
|
||||
// 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.= " VALUES(";
|
||||
$line.= $objectpageold->newid."__+MAX_llx_website_page__, ";
|
||||
$line.= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", ";
|
||||
$line.= "__WEBSITE_ID__, ";
|
||||
$line.= "'".$this->db->escape($objectpageold->pageurl)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->aliasalt)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->title)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->description)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->image)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->keywords)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->status)."', ";
|
||||
$line.= "'".$this->db->idate($objectpageold->date_creation)."', ";
|
||||
$line.= "'".$this->db->idate($objectpageold->date_modification)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->lang)."', ";
|
||||
$line.= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", ";
|
||||
$line.= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
|
||||
$line.= "'".$this->db->escape($objectpageold->type_container)."', ";
|
||||
$line .= " VALUES(";
|
||||
$line .= $objectpageold->newid."__+MAX_llx_website_page__, ";
|
||||
$line .= ($objectpageold->newfk_page ? $this->db->escape($objectpageold->newfk_page)."__+MAX_llx_website_page__" : "null").", ";
|
||||
$line .= "__WEBSITE_ID__, ";
|
||||
$line .= "'".$this->db->escape($objectpageold->pageurl)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->aliasalt)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->title)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->description)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->image)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->keywords)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->status)."', ";
|
||||
$line .= "'".$this->db->idate($objectpageold->date_creation)."', ";
|
||||
$line .= "'".$this->db->idate($objectpageold->date_modification)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->lang)."', ";
|
||||
$line .= ($objectpageold->import_key ? "'".$this->db->escape($objectpageold->import_key)."'" : "null").", ";
|
||||
$line .= "'".$this->db->escape($objectpageold->grabbed_from)."', ";
|
||||
$line .= "'".$this->db->escape($objectpageold->type_container)."', ";
|
||||
|
||||
$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=js/'.$website->ref.'/', "file=js/__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_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);
|
||||
$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 = 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=js/'.$website->ref.'/', "file=js/__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
|
||||
$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.= ");";
|
||||
$line.= "\n";
|
||||
$line .= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line
|
||||
$line .= ");";
|
||||
$line .= "\n";
|
||||
fputs($fp, $line);
|
||||
|
||||
// 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.
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
// Build zip file
|
||||
@ -1016,49 +1016,49 @@ class Website extends CommonObject
|
||||
dol_mkdir($conf->website->dir_temp.'/'.$object->ref);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$arrayreplacement = array();
|
||||
$arrayreplacement['__WEBSITE_ID__'] = $object->id;
|
||||
$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_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini);
|
||||
$arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo);
|
||||
|
||||
// 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
|
||||
$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';
|
||||
$result = dolReplaceInFile($htmldeaderindestdir, $arrayreplacement);
|
||||
|
||||
// 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);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
$this->errors[]='Failed to write file '.$filemaster;
|
||||
$this->errors[] = 'Failed to write file '.$filemaster;
|
||||
$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/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/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
|
||||
|
||||
$sqlfile = $conf->website->dir_temp.'/'.$object->ref.'/website_pages.sql';
|
||||
|
||||
@ -1067,19 +1067,19 @@ class Website extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Search the $maxrowid because we need it later
|
||||
$sqlgetrowid='SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
|
||||
$resql=$this->db->query($sqlgetrowid);
|
||||
$sqlgetrowid = 'SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page';
|
||||
$resql = $this->db->query($sqlgetrowid);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$maxrowid=$obj->max;
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$maxrowid = $obj->max;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$this->errors[]='Failed to load sql file '.$sqlfile;
|
||||
$this->errors[] = 'Failed to load sql file '.$sqlfile;
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -1089,7 +1089,7 @@ class Website extends CommonObject
|
||||
$fp = fopen($sqlfile, "r");
|
||||
if ($fp)
|
||||
{
|
||||
while (! feof($fp))
|
||||
while (!feof($fp))
|
||||
{
|
||||
$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);
|
||||
|
||||
// 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);
|
||||
|
||||
// Regenerate alternative aliases pages
|
||||
if (is_array($aliasesarray))
|
||||
{
|
||||
foreach($aliasesarray as $aliasshortcuttocreate)
|
||||
foreach ($aliasesarray as $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);
|
||||
}
|
||||
}
|
||||
@ -1156,15 +1156,15 @@ class Website extends CommonObject
|
||||
{
|
||||
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
|
||||
$tmppage=new WebsitePage($this->db);
|
||||
$tmppage = new WebsitePage($this->db);
|
||||
|
||||
$pageid = 0;
|
||||
if (! empty($websitepagefile))
|
||||
if (!empty($websitepagefile))
|
||||
{
|
||||
$websitepagefileshort=basename($websitepagefile);
|
||||
$websitepagefileshort = basename($websitepagefile);
|
||||
if ($websitepagefileshort == 'index.php') $pageid = $website->fk_default_home;
|
||||
else $pageid = str_replace(array('.tpl.php', 'page'), array('', ''), $websitepagefileshort);
|
||||
if ($pageid > 0)
|
||||
@ -1174,16 +1174,16 @@ class Website extends CommonObject
|
||||
}
|
||||
|
||||
// Fill with existing translation, nothing if none
|
||||
if (! is_array($languagecodes) && $pageid > 0)
|
||||
if (!is_array($languagecodes) && $pageid > 0)
|
||||
{
|
||||
$languagecodes = array();
|
||||
|
||||
$sql ="SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."website_page as wp";
|
||||
$sql.=" WHERE wp.fk_website = ".$website->id;
|
||||
$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;
|
||||
$sql.=")";
|
||||
$sql = "SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp";
|
||||
$sql .= " WHERE wp.fk_website = ".$website->id;
|
||||
$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;
|
||||
$sql .= ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1192,20 +1192,20 @@ class Website extends CommonObject
|
||||
{
|
||||
$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
|
||||
|
||||
$languagecodeselected= $weblangs->defaultlang; // Because we must init with a value, but real value is the lang of main parent container
|
||||
if (! empty($websitepagefile))
|
||||
$languagecodeselected = $weblangs->defaultlang; // Because we must init with a value, but real value is the lang of main parent container
|
||||
if (!empty($websitepagefile))
|
||||
{
|
||||
$pageid = str_replace(array('.tpl.php', 'page'), array('', ''), basename($websitepagefile));
|
||||
if ($pageid > 0)
|
||||
{
|
||||
$languagecodeselected=$tmppage->lang;
|
||||
if (! in_array($tmppage->lang, $languagecodes)) $languagecodes[]=$tmppage->lang; // We add language code of page into combo list
|
||||
$languagecodeselected = $tmppage->lang;
|
||||
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);
|
||||
|
||||
$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_match('/\?/', $url) ? '&' : '?').'l=';
|
||||
$url .= (preg_match('/\?/', $url) ? '&' : '?').'l=';
|
||||
|
||||
$HEIGHTOPTION=40;
|
||||
$HEIGHTOPTION = 40;
|
||||
$MAXHEIGHT = 4 * $HEIGHTOPTION;
|
||||
$nboflanguage = count($languagecodes);
|
||||
|
||||
$out ='<!-- componentSelectLang'.$htmlname.' -->'."\n";
|
||||
$out = '<!-- componentSelectLang'.$htmlname.' -->'."\n";
|
||||
|
||||
$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.' li { line-height: '.$HEIGHTOPTION.'px; }'."\n";
|
||||
$out.= '.componentSelectLang'.$htmlname.' {
|
||||
$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.' li { line-height: '.$HEIGHTOPTION.'px; }'."\n";
|
||||
$out .= '.componentSelectLang'.$htmlname.' {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
height: '.$HEIGHTOPTION.'px;
|
||||
@ -1242,33 +1242,33 @@ class Website extends CommonObject
|
||||
.componentSelectLang'.$htmlname.' li { display: block; padding: 0px 20px; }
|
||||
.componentSelectLang'.$htmlname.' li:hover { background-color: #EEE; }
|
||||
';
|
||||
$out.= '</style>';
|
||||
$out.= '<ul class="componentSelectLang'.$htmlname.($morecss?' '.$morecss:'').'">';
|
||||
$out .= '</style>';
|
||||
$out .= '<ul class="componentSelectLang'.$htmlname.($morecss ? ' '.$morecss : '').'">';
|
||||
if ($languagecodeselected)
|
||||
{
|
||||
$shortcode = strtolower(substr($languagecodeselected, -2));
|
||||
$label = $weblangs->trans("Language_".$languagecodeselected);
|
||||
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.= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
||||
$out.= '</li></a>';
|
||||
$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 .= '</li></a>';
|
||||
}
|
||||
$i=0;
|
||||
$i = 0;
|
||||
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));
|
||||
$label = $weblangs->trans("Language_".$languagecode);
|
||||
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;
|
||||
if (empty($i) && empty($languagecodeselected)) $out.= '<span class="fa fa-caret-down" style="padding-left: 5px;" />';
|
||||
$out.= '</li></a>';
|
||||
$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;" />';
|
||||
$out .= '</li></a>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$out.= '</ul>';
|
||||
$out .= '</ul>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
// 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 . '/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.
|
||||
*/
|
||||
public $fields=array(
|
||||
'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'),
|
||||
'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'),
|
||||
'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),
|
||||
'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),
|
||||
'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
|
||||
public $fields = array(
|
||||
'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'),
|
||||
'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'),
|
||||
'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),
|
||||
'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),
|
||||
'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),
|
||||
'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'),
|
||||
'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),
|
||||
'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),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
|
||||
'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'),
|
||||
'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),
|
||||
'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),
|
||||
'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),
|
||||
'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_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_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
|
||||
|
||||
@ -145,7 +145,7 @@ class WebsitePage extends CommonObject
|
||||
{
|
||||
$this->description = dol_trunc($this->description, 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);
|
||||
}
|
||||
@ -186,20 +186,20 @@ class WebsitePage extends CommonObject
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.fk_user_creat,";
|
||||
$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 1 = 1';
|
||||
if ($id > 0)
|
||||
{
|
||||
$sql .= ' AND t.rowid = ' . $id;
|
||||
$sql .= ' AND t.rowid = '.$id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($id < 0) $sql .= ' AND t.rowid <> ' . abs($id);
|
||||
if ($id < 0) $sql .= ' AND t.rowid <> '.abs($id);
|
||||
if (null !== $website_id) {
|
||||
$sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'";
|
||||
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) . ",%')";
|
||||
$sql .= " AND t.fk_website = '".$this->db->escape($website_id)."'";
|
||||
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).",%')";
|
||||
}
|
||||
}
|
||||
$sql .= $this->db->plimit(1);
|
||||
@ -242,10 +242,10 @@ class WebsitePage extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
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);
|
||||
|
||||
$records=array();
|
||||
$records = array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
@ -287,28 +287,28 @@ class WebsitePage extends CommonObject
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.fk_user_creat,";
|
||||
$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;
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key=='t.rowid' || $key=='t.fk_website') {
|
||||
$sqlwhere[] = $key . '='. $value;
|
||||
if ($key == 't.rowid' || $key == 't.fk_website') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
} else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
$sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
$sql .= ' '.$this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -345,9 +345,9 @@ class WebsitePage extends CommonObject
|
||||
|
||||
return $records;
|
||||
} else {
|
||||
$this->error = 'Error ' . $this->db->lasterror();
|
||||
$this->error = 'Error '.$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -364,7 +364,7 @@ class WebsitePage extends CommonObject
|
||||
{
|
||||
$this->description = dol_trunc($this->description, 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);
|
||||
}
|
||||
@ -382,16 +382,16 @@ class WebsitePage extends CommonObject
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$websiteobj=new Website($this->db);
|
||||
$websiteobj = new Website($this->db);
|
||||
$result = $websiteobj->fetch($this->fk_website);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
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';
|
||||
$filetpl=$pathofwebsite.'/page'.$this->id.'.tpl.php';
|
||||
$filealias = $pathofwebsite.'/'.$this->pageurl.'.php';
|
||||
$filetpl = $pathofwebsite.'/page'.$this->id.'.tpl.php';
|
||||
|
||||
dol_delete_file($filealias);
|
||||
dol_delete_file($filetpl);
|
||||
@ -438,10 +438,10 @@ class WebsitePage extends CommonObject
|
||||
$object->fk_user_creat = $user->id;
|
||||
$object->date_creation = $now;
|
||||
$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;
|
||||
else $object->fk_page = 0;
|
||||
if (! empty($newwebsite)) $object->fk_website=$newwebsite;
|
||||
if (!empty($newwebsite)) $object->fk_website = $newwebsite;
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
@ -450,7 +450,7 @@ class WebsitePage extends CommonObject
|
||||
$error++;
|
||||
$this->error = $object->error;
|
||||
$this->errors = $object->errors;
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
@ -486,36 +486,36 @@ class WebsitePage extends CommonObject
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("Page") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref.'<br>';
|
||||
$label.= '<b>' . $langs->trans('ID') . ':</b> ' . $this->id.'<br>';
|
||||
$label.= '<b>' . $langs->trans('Title') . ':</b> ' . $this->title;
|
||||
$label = '<u>'.$langs->trans("Page").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
|
||||
$label .= '<b>'.$langs->trans('ID').':</b> '.$this->id.'<br>';
|
||||
$label .= '<b>'.$langs->trans('Title').':</b> '.$this->title;
|
||||
|
||||
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;
|
||||
|
||||
$linkclose='';
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowMyObject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
$label = $langs->trans("ShowMyObject");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
//$linkstart = $linkend = '';
|
||||
|
||||
$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 != 2) $result.= $this->ref;
|
||||
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;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
@ -574,7 +574,7 @@ class WebsitePage extends CommonObject
|
||||
|
||||
$this->id = 0;
|
||||
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
$this->fk_website = '';
|
||||
$this->type_container = 'page';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user