mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
1121d2c1c6
commit
1bf5745286
|
|
@ -368,20 +368,20 @@ foreach ($dirmodels as $reldir)
|
|||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -240,9 +240,9 @@ dol_syslog("select rss boxes", LOG_DEBUG);
|
|||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$boxlist = InfoBox::listBoxes($db, 'activated', -1, null);
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
|
|
@ -350,9 +350,9 @@ $db->close();
|
|||
*/
|
||||
function _isInBoxList($idrss, array $boxlist)
|
||||
{
|
||||
foreach($boxlist as $box)
|
||||
foreach ($boxlist as $box)
|
||||
{
|
||||
if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false)
|
||||
if ($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,19 +48,19 @@ $action = GETPOST('action', 'aZ09');
|
|||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constlineid = GETPOST('rowid', 'int');
|
||||
$constname=GETPOST('constname', 'alpha');
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
|
||||
$constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
|
||||
$consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
|
||||
$constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
|
||||
$constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
|
||||
$consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
|
||||
$constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
|
||||
|
||||
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
|
||||
|
||||
$res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
|
||||
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents();
|
|||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
// Editing global variables not related to a specific theme
|
||||
$constantes=array();
|
||||
$constantes = array();
|
||||
foreach ($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
|
@ -210,7 +210,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
|||
$constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label);
|
||||
}
|
||||
|
||||
$helptext='';
|
||||
$helptext = '';
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
} else {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
|
|
|||
|
|
@ -1426,7 +1426,7 @@ class Setup extends DolibarrApi
|
|||
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
|
||||
}
|
||||
|
||||
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) {
|
||||
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
|
||||
throw new RestException(500, 'Error Bad or unknown value for constantname');
|
||||
}
|
||||
if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class AssetType extends CommonObject
|
|||
$action = 'update';
|
||||
|
||||
// Actions on extra fields
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
|
|
|
|||
|
|
@ -44,26 +44,26 @@ $signature = GETPOST('s');
|
|||
$newblock = GETPOST('b');
|
||||
$hash = GETPOST('h');
|
||||
|
||||
if($auth->fetch(0, $signature)<=0) {
|
||||
if ($auth->fetch(0, $signature) <= 0) {
|
||||
$auth->signature = $signature;
|
||||
$auth->create($user);
|
||||
}
|
||||
|
||||
|
||||
if(!empty($hash)) {
|
||||
if (!empty($hash)) {
|
||||
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
|
||||
}
|
||||
elseif(!empty($newblock)){
|
||||
if($auth->checkBlock($newblock)) {
|
||||
elseif (!empty($newblock)) {
|
||||
if ($auth->checkBlock($newblock)) {
|
||||
$auth->addBlock($newblock);
|
||||
$auth->update($user);
|
||||
|
||||
echo 'blockadded';
|
||||
}
|
||||
else{
|
||||
else {
|
||||
echo 'blockalreadyadded';
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
echo 'idontunderstandwhatihavetodo';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ $ilink = 0;
|
|||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
$product_static= new Product($db);
|
||||
$product_static = new Product($db);
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
echo '<tr class="'.$trclass.'" >';
|
||||
|
|
|
|||
|
|
@ -32,23 +32,23 @@
|
|||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
|
||||
if ( GETPOST('filtre', 'alpha') ) {
|
||||
if (GETPOST('filtre', 'alpha')) {
|
||||
// Avec filtre
|
||||
$ret=array(); $i=0;
|
||||
$ret = array(); $i = 0;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql.= " AND p.tosell = 1";
|
||||
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
||||
$sql.= " AND (";
|
||||
$sql.= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
||||
if (! empty($conf->barcode->enabled))
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND p.tosell = 1";
|
||||
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
|
||||
$sql .= " AND (";
|
||||
$sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
||||
if (!empty($conf->barcode->enabled))
|
||||
{
|
||||
$filtre = GETPOST('filtre', 'alpha');
|
||||
|
||||
|
|
@ -85,23 +85,23 @@ if ( GETPOST('filtre', 'alpha') ) {
|
|||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$tab_designations=$ret;
|
||||
$tab_designations = $ret;
|
||||
} else {
|
||||
// Sans filtre
|
||||
$ret=array();
|
||||
$i=0;
|
||||
$ret = array();
|
||||
$i = 0;
|
||||
|
||||
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql.= " AND p.tosell = 1";
|
||||
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
||||
$sql.= " ORDER BY p.label";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$conf_fkentrepot."'";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND p.tosell = 1";
|
||||
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
|
||||
$sql .= " ORDER BY p.label";
|
||||
|
||||
dol_syslog($sql);
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nbr_enreg = $db->num_rows($resql);
|
||||
|
|
|
|||
|
|
@ -40,20 +40,20 @@ top_httphead();
|
|||
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||
|
||||
// Load original field value
|
||||
if (! empty($output) && isset($amount) && isset($tva_tx))
|
||||
if (!empty($output) && isset($amount) && isset($tva_tx))
|
||||
{
|
||||
$return=array();
|
||||
$price='';
|
||||
$return = array();
|
||||
$price = '';
|
||||
|
||||
if (is_numeric($amount) && $amount != '')
|
||||
{
|
||||
if ($output == 'price_ttc') {
|
||||
$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
|
||||
$price = price2num($amount * (1 + ($tva_tx / 100)), 'MU');
|
||||
$return['price_ht'] = $amount;
|
||||
$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
}
|
||||
elseif ($output == 'price_ht') {
|
||||
$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
|
||||
$price = price2num($amount / (1 + ($tva_tx / 100)), 'MU');
|
||||
$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7130,7 +7130,7 @@ abstract class CommonObject
|
|||
// HTML, select, integer and text add default value
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
|
||||
{
|
||||
if($action=='create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
|
||||
if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
|
||||
else $value = $this->array_options['options_'.$key];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -732,7 +732,7 @@ class dolReceiptPrinter extends Printer
|
|||
break;
|
||||
case 'DOL_PRINT_ORDER_LINES':
|
||||
foreach ($object->lines as $line) {
|
||||
if ($line->special_code==$this->orderprinter)
|
||||
if ($line->special_code == $this->orderprinter)
|
||||
{
|
||||
$spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1;
|
||||
$spaces = str_repeat(' ', $spacestoadd);
|
||||
|
|
|
|||
|
|
@ -90,15 +90,15 @@ class ExtraLanguages
|
|||
|
||||
|
||||
$array_name_label = array();
|
||||
if (! empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
|
||||
if (!empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
|
||||
$tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR);
|
||||
foreach($tmpelement as $elementstring) {
|
||||
$reg=array();
|
||||
foreach ($tmpelement as $elementstring) {
|
||||
$reg = array();
|
||||
preg_match('/^(.*):(.*)$/', $elementstring, $reg);
|
||||
$element = $reg[1];
|
||||
$array_name_label[$element] = array();
|
||||
$tmpfields=explode(',', $reg[2]);
|
||||
foreach($tmpfields as $field) {
|
||||
$tmpfields = explode(',', $reg[2]);
|
||||
foreach ($tmpfields as $field) {
|
||||
//var_dump($fields);
|
||||
//$tmpkeyvar = explode(':', $fields);
|
||||
//$array_name_label[$element][$tmpkeyvar[0]] = $tmpkeyvar[1];
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ class FormActions
|
|||
if ($typeelement == 'project') $projectid = $object->id;
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
|
||||
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
|
||||
{
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ if (is_array($search_groupby) && count($search_groupby)) {
|
|||
if (class_exists($classname)) {
|
||||
$tmpobject = new $classname($db);
|
||||
$tmpobject->fetch($obj->val);
|
||||
foreach($tmpobject->fields as $fieldkey => $field) {
|
||||
foreach ($tmpobject->fields as $fieldkey => $field) {
|
||||
if ($field['showoncombobox']) {
|
||||
$valuetranslated = $tmpobject->$fieldkey;
|
||||
//if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown")
|
||||
|
|
@ -747,7 +747,7 @@ if ($mode == 'graph') {
|
|||
$px1->draw($filenamenb, $fileurlnb);
|
||||
|
||||
$texttoshow = $langs->trans("NoRecordFound");
|
||||
if (! GETPOSTISSET('search_measures') || ! GETPOSTISSET('search_xaxis')) {
|
||||
if (!GETPOSTISSET('search_measures') || !GETPOSTISSET('search_xaxis')) {
|
||||
$texttoshow = $langs->trans("SelectYourGraphOptionsFirst");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,24 +42,24 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
|
|||
function dol_setcache($memoryid, $data)
|
||||
{
|
||||
global $conf;
|
||||
$result=0;
|
||||
$result = 0;
|
||||
|
||||
// Using a memcached server
|
||||
if (! empty($conf->memcached->enabled) && class_exists('Memcached'))
|
||||
if (!empty($conf->memcached->enabled) && class_exists('Memcached'))
|
||||
{
|
||||
global $dolmemcache;
|
||||
if (empty($dolmemcache) || ! is_object($dolmemcache))
|
||||
if (empty($dolmemcache) || !is_object($dolmemcache))
|
||||
{
|
||||
$dolmemcache=new Memcached();
|
||||
$tmparray=explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||
if (! $result) return -1;
|
||||
$dolmemcache = new Memcached();
|
||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||
if (!$result) return -1;
|
||||
}
|
||||
|
||||
$memoryid=session_name().'_'.$memoryid;
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$dolmemcache->add($memoryid, $data); // This fails if key already exists
|
||||
$rescode=$dolmemcache->getResultCode();
|
||||
$dolmemcache->add($memoryid, $data); // This fails if key already exists
|
||||
$rescode = $dolmemcache->getResultCode();
|
||||
if ($rescode == 0)
|
||||
{
|
||||
return count($data);
|
||||
|
|
@ -69,20 +69,20 @@ function dol_setcache($memoryid, $data)
|
|||
return -$rescode;
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->memcached->enabled) && class_exists('Memcache'))
|
||||
elseif (!empty($conf->memcached->enabled) && class_exists('Memcache'))
|
||||
{
|
||||
global $dolmemcache;
|
||||
if (empty($dolmemcache) || ! is_object($dolmemcache))
|
||||
if (empty($dolmemcache) || !is_object($dolmemcache))
|
||||
{
|
||||
$dolmemcache=new Memcache();
|
||||
$tmparray=explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||
if (! $result) return -1;
|
||||
$dolmemcache = new Memcache();
|
||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||
if (!$result) return -1;
|
||||
}
|
||||
|
||||
$memoryid=session_name().'_'.$memoryid;
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$result=$dolmemcache->add($memoryid, $data); // This fails if key already exists
|
||||
$result = $dolmemcache->add($memoryid, $data); // This fails if key already exists
|
||||
if ($result)
|
||||
{
|
||||
return count($data);
|
||||
|
|
@ -112,22 +112,22 @@ function dol_getcache($memoryid)
|
|||
global $conf;
|
||||
|
||||
// Using a memcached server
|
||||
if (! empty($conf->memcached->enabled) && class_exists('Memcached'))
|
||||
if (!empty($conf->memcached->enabled) && class_exists('Memcached'))
|
||||
{
|
||||
global $m;
|
||||
if (empty($m) || ! is_object($m))
|
||||
if (empty($m) || !is_object($m))
|
||||
{
|
||||
$m=new Memcached();
|
||||
$tmparray=explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||
if (! $result) return -1;
|
||||
$m = new Memcached();
|
||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||
if (!$result) return -1;
|
||||
}
|
||||
|
||||
$memoryid=session_name().'_'.$memoryid;
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
//$m->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
//print "Get memoryid=".$memoryid;
|
||||
$data=$m->get($memoryid);
|
||||
$rescode=$m->getResultCode();
|
||||
$data = $m->get($memoryid);
|
||||
$rescode = $m->getResultCode();
|
||||
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
||||
//var_dump($data);
|
||||
if ($rescode == 0)
|
||||
|
|
@ -139,20 +139,20 @@ function dol_getcache($memoryid)
|
|||
return -$rescode;
|
||||
}
|
||||
}
|
||||
elseif (! empty($conf->memcached->enabled) && class_exists('Memcache'))
|
||||
elseif (!empty($conf->memcached->enabled) && class_exists('Memcache'))
|
||||
{
|
||||
global $m;
|
||||
if (empty($m) || ! is_object($m))
|
||||
if (empty($m) || !is_object($m))
|
||||
{
|
||||
$m=new Memcache();
|
||||
$tmparray=explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
|
||||
if (! $result) return -1;
|
||||
$m = new Memcache();
|
||||
$tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
|
||||
$result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
|
||||
if (!$result) return -1;
|
||||
}
|
||||
|
||||
$memoryid=session_name().'_'.$memoryid;
|
||||
$memoryid = session_name().'_'.$memoryid;
|
||||
//$m->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$data=$m->get($memoryid);
|
||||
$data = $m->get($memoryid);
|
||||
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n<br>";
|
||||
//var_dump($data);
|
||||
if ($data)
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class CommActionRapport
|
|||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
$nbpage = $this->_pages($pdf, $outputlangs); // Write content
|
||||
$nbpage = $this->_pages($pdf, $outputlangs); // Write content
|
||||
|
||||
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||
$pdf->Close();
|
||||
|
|
|
|||
|
|
@ -214,14 +214,14 @@ class pdf_rouget extends ModelePdfExpedition
|
|||
|
||||
$objphoto = new Product($this->db);
|
||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/";
|
||||
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
|
||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -354,12 +354,12 @@ class pdf_standard extends ModeleExpenseReport
|
|||
// Loop on each lines
|
||||
$i = 0;
|
||||
while ($i < $nblines) {
|
||||
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
|
||||
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
if (empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
} else {
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
}
|
||||
|
|
@ -385,8 +385,8 @@ class pdf_standard extends ModeleExpenseReport
|
|||
$pdf->setPage($pageposafter + 1);
|
||||
$showpricebeforepagebreak = 1;
|
||||
$nexY = $tab_top_newpage;
|
||||
$nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes
|
||||
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
|
||||
$nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes
|
||||
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
// Set certificate
|
||||
$cert=empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
|
||||
$cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
|
||||
// If use has no certificate, we try to take the company one
|
||||
if (!$cert) {
|
||||
$cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT;
|
||||
|
|
|
|||
|
|
@ -462,39 +462,39 @@ class ImportCsv extends ModeleImports
|
|||
$errorforthistable++;
|
||||
$error++;
|
||||
}*/
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
$param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart.
|
||||
}
|
||||
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
// If not found, try the fetch from label
|
||||
if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel')
|
||||
if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel')
|
||||
{
|
||||
$param_array = array('', '', $newval);
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
}
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id;
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
if ($classinstance->id != '') // id may be 0, it is a found value
|
||||
{
|
||||
$newval=$classinstance->id;
|
||||
$newval = $classinstance->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
else $this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile';
|
||||
$this->errors[$error]['type'] = 'FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeandlabel')
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel')
|
||||
{
|
||||
$isidorref='id';
|
||||
if (! is_numeric($newval) && $newval != '' && ! preg_match('/^id:/i', $newval)) $isidorref='ref';
|
||||
$newval=preg_replace('/^(id|ref):/i', '', $newval);
|
||||
$isidorref = 'id';
|
||||
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref';
|
||||
$newval = preg_replace('/^(id|ref):/i', '', $newval);
|
||||
|
||||
if ($isidorref == 'ref') {
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
|
|
|
|||
|
|
@ -348,8 +348,8 @@ class modFournisseur extends DolibarrModules
|
|||
$tmp = '';
|
||||
$tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
|
||||
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
|
||||
$var=array_keys($tmpparam['options']);
|
||||
$tmp=array_shift($var);
|
||||
$var = array_keys($tmpparam['options']);
|
||||
$tmp = array_shift($var);
|
||||
}
|
||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -51,17 +51,17 @@ class modLabel extends DolibarrModules
|
|||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'development';
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->picto='generic';
|
||||
$this->picto = 'generic';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/label/temp");
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||
|
||||
// Config pages
|
||||
// $this->config_page_url = array("label.php");
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
|
||||
var $dialog = $('<form id="' + formId + '" action="<?php print $objectUrl ; ?>" method="post" ></form>')
|
||||
var $dialog = $('<form id="' + formId + '" action="<?php print $objectUrl; ?>" method="post" ></form>')
|
||||
.load( page + " #tablelines", function() {
|
||||
|
||||
$("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute
|
||||
|
|
|
|||
|
|
@ -70,14 +70,14 @@ if ($action == 'delete')
|
|||
);
|
||||
}
|
||||
|
||||
$formfile=new FormFile($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
|
||||
// We define var to enable the feature to add prefix of uploaded files.
|
||||
// Caller of this include can make
|
||||
// $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
|
||||
if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) {
|
||||
$savingdocmask='';
|
||||
$savingdocmask = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) {
|
||||
//var_dump($modulepart);
|
||||
if (in_array($modulepart, array(
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ if ($line->special_code == 3) { ?>
|
|||
{
|
||||
$tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht);
|
||||
$tooltiponprice .= '<br>'.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva);
|
||||
if (! $senderissupplier && is_object($object->thirdparty)) {
|
||||
if (!$senderissupplier && is_object($object->thirdparty)) {
|
||||
if ($object->thirdparty->useLocalTax(1)) {
|
||||
if (price2num($line->total_localtax1)) $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1);
|
||||
else $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'=<span class="opacitymedium">'.$langs->trans("NotUsedForThisCustomer").'</span>';
|
||||
|
|
|
|||
|
|
@ -117,15 +117,15 @@ class ActionsDatapolicy
|
|||
$object->state_id = '';
|
||||
$object->skype = '';
|
||||
$object->country_id = '';
|
||||
$object->note_private = $object->note_private . '<br/>' . $langs->trans('ANONYMISER_AT', dol_print_date(time()));
|
||||
$object->note_private = $object->note_private.'<br/>'.$langs->trans('ANONYMISER_AT', dol_print_date(time()));
|
||||
|
||||
if ($object->update($object->id, $user, 0)) {
|
||||
// On supprime les contacts associé
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople WHERE fk_soc = " . $object->id;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$object->id;
|
||||
$this->db->query($sql);
|
||||
|
||||
setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array());
|
||||
header('Location:' . $_SERVER["PHP_SELF"] . "?socid=" . $object->id);
|
||||
header('Location:'.$_SERVER["PHP_SELF"]."?socid=".$object->id);
|
||||
}
|
||||
}
|
||||
} elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'datapolicy_portabilite') {
|
||||
|
|
@ -394,40 +394,40 @@ class ActionsDatapolicy
|
|||
if ($parameters['currentcontext'] == 'thirdpartycard') {
|
||||
if (GETPOST('action') == 'create' || GETPOST('action') == 'edit' || GETPOST('action') == '') {
|
||||
$jsscript .= '<script>';
|
||||
$jsscript .= "var elementToHide = 'tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection';" . PHP_EOL;
|
||||
$jsscript .= "var forme_juridique = [" . PHP_EOL;
|
||||
$jsscript .= "11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005" . PHP_EOL;
|
||||
$jsscript .= "];" . PHP_EOL;
|
||||
$jsscript .= "function hideRgPD() {" . PHP_EOL;
|
||||
$jsscript .= " if ($('#typent_id').val() == 8 || forme_juridique.indexOf(parseInt($('#forme_juridique_code').val())) > -1) {" . PHP_EOL;
|
||||
$jsscript .= " console.log(elementToHide);" . PHP_EOL;
|
||||
$jsscript .= " $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').show(); } else { $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').hide(); }}" . PHP_EOL;
|
||||
$jsscript .= "hideRgPD();" . PHP_EOL;
|
||||
$jsscript .= "$('#forme_juridique_code, #typent_id').change(function(){ hideRgPD(); });" . PHP_EOL;
|
||||
$jsscript .= "var elementToHide = 'tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection';".PHP_EOL;
|
||||
$jsscript .= "var forme_juridique = [".PHP_EOL;
|
||||
$jsscript .= "11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005".PHP_EOL;
|
||||
$jsscript .= "];".PHP_EOL;
|
||||
$jsscript .= "function hideRgPD() {".PHP_EOL;
|
||||
$jsscript .= " if ($('#typent_id').val() == 8 || forme_juridique.indexOf(parseInt($('#forme_juridique_code').val())) > -1) {".PHP_EOL;
|
||||
$jsscript .= " console.log(elementToHide);".PHP_EOL;
|
||||
$jsscript .= " $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').show(); } else { $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').hide(); }}".PHP_EOL;
|
||||
$jsscript .= "hideRgPD();".PHP_EOL;
|
||||
$jsscript .= "$('#forme_juridique_code, #typent_id').change(function(){ hideRgPD(); });".PHP_EOL;
|
||||
$jsscript .= '</script>';
|
||||
} elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) {
|
||||
// La suppression n'a pas été possible
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$societe = new Societe($this->db);
|
||||
$societe->fetch(GETPOST('socid'));
|
||||
// On vérifie si il est utilisé
|
||||
if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
$form = new Form($this->db);
|
||||
echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1);
|
||||
echo $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('socid')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$societe = new Societe($this->db);
|
||||
$societe->fetch(GETPOST('socid'));
|
||||
|
||||
if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
$jsscript .= '<script>';
|
||||
$jsscript .= "var elementToHide = 'td.societe_extras_datapolicy_opposition_traitement, td.societe_extras_datapolicy_opposition_prospection, td.societe_extras_datapolicy_consentement';" . PHP_EOL;
|
||||
$jsscript .= "$(elementToHide).parent('tr').hide();" . PHP_EOL;
|
||||
$jsscript .= "var elementToHide = 'td.societe_extras_datapolicy_opposition_traitement, td.societe_extras_datapolicy_opposition_prospection, td.societe_extras_datapolicy_consentement';".PHP_EOL;
|
||||
$jsscript .= "$(elementToHide).parent('tr').hide();".PHP_EOL;
|
||||
$jsscript .= '</script>';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1046,7 +1046,7 @@ class Expedition extends CommonObject
|
|||
}
|
||||
}
|
||||
$line->entrepot_id = $linebatch->entrepot_id;
|
||||
$line->origin_line_id = $dbatch['ix_l']; // deprecated
|
||||
$line->origin_line_id = $dbatch['ix_l']; // deprecated
|
||||
$line->fk_origin_line = $dbatch['ix_l'];
|
||||
$line->qty = $dbatch['qty'];
|
||||
$line->detail_batch = $tab;
|
||||
|
|
|
|||
|
|
@ -490,16 +490,16 @@ class SupplierInvoices extends DolibarrApi
|
|||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->invoice->fetch_lines();
|
||||
|
|
@ -522,16 +522,16 @@ class SupplierInvoices extends DolibarrApi
|
|||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
|
|
@ -586,16 +586,16 @@ class SupplierInvoices extends DolibarrApi
|
|||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
|
|
@ -647,20 +647,20 @@ class SupplierInvoices extends DolibarrApi
|
|||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
if(empty($lineid)) {
|
||||
if (empty($lineid)) {
|
||||
throw new RestException(400, 'Line ID is mandatory');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,9 +211,9 @@ class CommandeFournisseurDispatch extends CommonObject
|
|||
}
|
||||
|
||||
// Create extrafields
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -977,9 +977,9 @@ class FactureFournisseur extends CommonInvoice
|
|||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
|
|
@ -3150,9 +3150,9 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||
$this->deleteObjectLinked();
|
||||
|
||||
// Remove extrafields
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
$result = $this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -566,21 +566,21 @@ if (!$error && $db->connected && $action == "set")
|
|||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if ($db->connected)
|
||||
{
|
||||
$resultbis = 1;
|
||||
|
||||
// Create user
|
||||
$result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||
$result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||
|
||||
// Create user bis
|
||||
if ($databasefortest == 'mysql')
|
||||
{
|
||||
if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local')))
|
||||
if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local')))
|
||||
{
|
||||
$resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||
$resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2351,7 +2351,7 @@ function main_area($title = '')
|
|||
if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
|
||||
|
||||
// Permit to add user company information on each printed document by set SHOW_SOCINFO_ON_PRINT
|
||||
if (! empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09')))
|
||||
if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09')))
|
||||
{
|
||||
global $hookmanager;
|
||||
$hookmanager->initHooks(array('showsocinfoonprint'));
|
||||
|
|
|
|||
|
|
@ -4737,7 +4737,7 @@ class Product extends CommonObject
|
|||
$op[1] = "-".trim($nbpiece);
|
||||
|
||||
$movementstock = new MouvementStock($this->db);
|
||||
$movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id
|
||||
$movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id
|
||||
$result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode);
|
||||
|
||||
if ($result >= 0) {
|
||||
|
|
|
|||
|
|
@ -780,33 +780,33 @@ SCRIPT;
|
|||
if (empty($rowid)) {
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
|
||||
else print $langs->trans($value);
|
||||
print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_fournisseur_price').'</td></tr>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT";
|
||||
$sql .= " fk_object";
|
||||
foreach ($extralabels as $key => $value) {
|
||||
$sql .= ", " . $key;
|
||||
$sql .= ", ".$key;
|
||||
}
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields";
|
||||
$sql .= " WHERE fk_object = " . $rowid;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields";
|
||||
$sql .= " WHERE fk_object = ".$rowid;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
foreach ($extralabels as $key => $value) {
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||
if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
|
||||
print '<tr><td'.($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>';
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
|
||||
else print $langs->trans($value);
|
||||
print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price');
|
||||
print '</td><td>'.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price');
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
@ -912,7 +912,7 @@ SCRIPT;
|
|||
foreach ($extralabels as $key => $value) {
|
||||
// Show field if not hidden
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||
if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
|
||||
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
|
||||
else $extratitle = $langs->trans($value);
|
||||
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class Entrepot 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(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10),
|
||||
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
|
||||
|
|
@ -184,7 +184,7 @@ class Entrepot extends CommonObject
|
|||
|
||||
$error = 0;
|
||||
|
||||
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
|
||||
if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility
|
||||
|
||||
$this->label = trim($this->label);
|
||||
if ($this->label == '')
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ $fieldstosearchall = array(
|
|||
);
|
||||
|
||||
// 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');
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
|
|
@ -110,7 +110,7 @@ $arrayfields = array(
|
|||
'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71),
|
||||
'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72),
|
||||
);
|
||||
foreach($object->fields as $key => $val)
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
|
|
@ -241,20 +241,20 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
|||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val)
|
||||
$sql .= " GROUP BY ";
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$sql.='t.'.$key.', ';
|
||||
$sql .= 't.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/', '', $sql);
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -408,7 +408,7 @@ print '<tr class="liste_titre_filter">';
|
|||
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if($key == 'statut'){ continue; }
|
||||
if ($key == 'statut') { continue; }
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
|
@ -421,7 +421,7 @@ foreach ($object->fields as $key => $val)
|
|||
elseif (strpos($val['type'], 'integer:') === 0 || strpos($val['type'], 'sellist:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
}
|
||||
elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
|
@ -466,7 +466,7 @@ print '<tr class="liste_titre">';
|
|||
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if($key == 'statut'){ continue; }
|
||||
if ($key == 'statut') { continue; }
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
|
@ -525,7 +525,7 @@ if ($num)
|
|||
$warehouse->fk_parent = $obj->fk_parent;
|
||||
$warehouse->statut = $obj->statut;
|
||||
|
||||
foreach ($object->fields as $key => $val){
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$warehouse->{$key} = $obj->{$key};
|
||||
}
|
||||
|
||||
|
|
@ -535,7 +535,7 @@ if ($num)
|
|||
|
||||
foreach ($warehouse->fields as $key => $val)
|
||||
{
|
||||
if($key == 'statut'){ continue; }
|
||||
if ($key == 'statut') { continue; }
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
|
@ -562,7 +562,7 @@ if ($num)
|
|||
|
||||
// Stock qty
|
||||
if (!empty($arrayfields["stockqty"]['checked'])) {
|
||||
print '<td class="right">' . price2num($obj->stockqty, 5) . '</td>';
|
||||
print '<td class="right">'.price2num($obj->stockqty, 5).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'stockqty';
|
||||
}
|
||||
|
|
@ -599,7 +599,7 @@ if ($num)
|
|||
|
||||
// Status
|
||||
if (!empty($arrayfields['t.statut']['checked'])) {
|
||||
print '<td class="right">' . $warehouse->LibStatut($obj->statut, 5) . '</td>';
|
||||
print '<td class="right">'.$warehouse->LibStatut($obj->statut, 5).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ if ($resql)
|
|||
$listofoppstatus[$objp->rowid] = $objp->percent;
|
||||
$listofopplabel[$objp->rowid] = $objp->label;
|
||||
$listofoppcode[$objp->rowid] = $objp->code;
|
||||
switch($objp->code) {
|
||||
switch ($objp->code) {
|
||||
case 'PROSP':
|
||||
$colorseries[$objp->rowid] = "-".$badgeStatus0;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ while ($i < min($num, $limit))
|
|||
$object->public = $obj->public;
|
||||
$object->ref = $obj->ref;
|
||||
$object->datee = $db->jdate($obj->date_end);
|
||||
$object->statut = $obj->status; // deprecated
|
||||
$object->statut = $obj->status; // deprecated
|
||||
$object->status = $obj->status;
|
||||
$object->public = $obj->public;
|
||||
$object->opp_status = $obj->fk_opp_status;
|
||||
|
|
|
|||
|
|
@ -111,54 +111,54 @@ $user = new User($db);
|
|||
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
|
||||
$user->getrights();
|
||||
|
||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc))
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc))
|
||||
{
|
||||
$sql = "SELECT entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql.= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql .= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'";
|
||||
|
||||
dol_syslog(get_class($db) . "::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($db)."::fetch", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$key=$obj->entity;
|
||||
$key = $obj->entity;
|
||||
}
|
||||
else {
|
||||
$key=1;
|
||||
$key = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$key=1;
|
||||
$key = 1;
|
||||
}
|
||||
$ret=$mc->switchEntity($key);
|
||||
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
|
||||
if (! $res) die("Include of main fails");
|
||||
$ret = $mc->switchEntity($key);
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
}
|
||||
|
||||
// list of action
|
||||
$stripe=new Stripe($db);
|
||||
$stripe = new Stripe($db);
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
|
||||
dol_syslog("***** Stripe IPN was called with event->type = ".$event->type);
|
||||
|
||||
|
||||
if ($event->type == 'payout.created') {
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity);
|
||||
$result = dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled';
|
||||
if (!empty($user->email)) {
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">";
|
||||
$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
|
||||
} else {
|
||||
$sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,9 +306,9 @@ class Reception extends CommonObject
|
|||
}
|
||||
|
||||
// Create extrafields
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
|
|||
|
||||
$filtre = GETPOST("filtre", 'none');
|
||||
|
||||
if (! GETPOST('typeid', 'int'))
|
||||
if (!GETPOST('typeid', 'int'))
|
||||
{
|
||||
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||
$filterarray = explode('-', $newfiltre);
|
||||
|
|
|
|||
|
|
@ -3623,7 +3623,7 @@ class Societe extends CommonObject
|
|||
$this->phone = $member->phone; // Prof phone
|
||||
$this->email = $member->email;
|
||||
$this->socialnetworks = $member->socialnetworks;
|
||||
$this->entity=$member->entity;
|
||||
$this->entity = $member->entity;
|
||||
|
||||
$this->client = 1; // A member is a customer by default
|
||||
$this->code_client = ($customercode ? $customercode : -1);
|
||||
|
|
|
|||
|
|
@ -66,87 +66,87 @@ if (!file_exists($conffile))
|
|||
|
||||
|
||||
// Load conf file if it is already defined
|
||||
if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just <?php in first line
|
||||
if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just <?php in first line
|
||||
{
|
||||
$result=include_once $conffile; // Load conf file
|
||||
$result = include_once $conffile; // Load conf file
|
||||
if ($result)
|
||||
{
|
||||
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility
|
||||
if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type = 'mysql'; // For backward compatibility
|
||||
|
||||
//Mysql driver support has been removed in favor of mysqli
|
||||
if ($dolibarr_main_db_type == 'mysql') {
|
||||
$dolibarr_main_db_type = 'mysqli';
|
||||
}
|
||||
|
||||
if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type=='mysqli')) $dolibarr_main_db_port='3306'; // For backward compatibility
|
||||
if (empty($dolibarr_main_db_port) && ($dolibarr_main_db_type == 'mysqli')) $dolibarr_main_db_port = '3306'; // For backward compatibility
|
||||
|
||||
// Clean parameters
|
||||
$dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):'';
|
||||
$dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):'';
|
||||
$dolibarr_main_url_root_alt =isset($dolibarr_main_url_root_alt)?trim($dolibarr_main_url_root_alt):'';
|
||||
$dolibarr_main_document_root =isset($dolibarr_main_document_root)?trim($dolibarr_main_document_root):'';
|
||||
$dolibarr_main_document_root_alt=isset($dolibarr_main_document_root_alt)?trim($dolibarr_main_document_root_alt):'';
|
||||
$dolibarr_main_data_root = isset($dolibarr_main_data_root) ?trim($dolibarr_main_data_root) : '';
|
||||
$dolibarr_main_url_root = isset($dolibarr_main_url_root) ?trim($dolibarr_main_url_root) : '';
|
||||
$dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ?trim($dolibarr_main_url_root_alt) : '';
|
||||
$dolibarr_main_document_root = isset($dolibarr_main_document_root) ?trim($dolibarr_main_document_root) : '';
|
||||
$dolibarr_main_document_root_alt = isset($dolibarr_main_document_root_alt) ?trim($dolibarr_main_document_root_alt) : '';
|
||||
|
||||
// Remove last / or \ on directories or url value
|
||||
if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root);
|
||||
if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root);
|
||||
if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/', $dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/', '', $dolibarr_main_data_root);
|
||||
if (! empty($dolibarr_main_document_root_alt) && ! preg_match('/^[\\/]+$/', $dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt=preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root_alt);
|
||||
if (! empty($dolibarr_main_url_root_alt) && ! preg_match('/^[\\/]+$/', $dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt=preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root_alt);
|
||||
if (!empty($dolibarr_main_document_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_document_root)) $dolibarr_main_document_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root);
|
||||
if (!empty($dolibarr_main_url_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_url_root)) $dolibarr_main_url_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root);
|
||||
if (!empty($dolibarr_main_data_root) && !preg_match('/^[\\/]+$/', $dolibarr_main_data_root)) $dolibarr_main_data_root = preg_replace('/[\\/]+$/', '', $dolibarr_main_data_root);
|
||||
if (!empty($dolibarr_main_document_root_alt) && !preg_match('/^[\\/]+$/', $dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt = preg_replace('/[\\/]+$/', '', $dolibarr_main_document_root_alt);
|
||||
if (!empty($dolibarr_main_url_root_alt) && !preg_match('/^[\\/]+$/', $dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt = preg_replace('/[\\/]+$/', '', $dolibarr_main_url_root_alt);
|
||||
|
||||
// Create conf object
|
||||
if (! empty($dolibarr_main_document_root))
|
||||
if (!empty($dolibarr_main_document_root))
|
||||
{
|
||||
$result=conf($dolibarr_main_document_root);
|
||||
$result = conf($dolibarr_main_document_root);
|
||||
}
|
||||
// Load database driver
|
||||
if ($result)
|
||||
{
|
||||
if (! empty($dolibarr_main_document_root) && ! empty($dolibarr_main_db_type))
|
||||
if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type))
|
||||
{
|
||||
$result=include_once $dolibarr_main_document_root . "/core/db/".$dolibarr_main_db_type.'.class.php';
|
||||
if (! $result)
|
||||
$result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php';
|
||||
if (!$result)
|
||||
{
|
||||
$includeconferror='ErrorBadValueForDolibarrMainDBType';
|
||||
$includeconferror = 'ErrorBadValueForDolibarrMainDBType';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$includeconferror='ErrorBadValueForDolibarrMainDocumentRoot';
|
||||
$includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$includeconferror='ErrorBadFormatForConfFile';
|
||||
$includeconferror = 'ErrorBadFormatForConfFile';
|
||||
}
|
||||
}
|
||||
$conf->global->MAIN_LOGTOHTML = 1;
|
||||
|
||||
// Define prefix
|
||||
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';
|
||||
define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:''));
|
||||
if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) $dolibarr_main_db_prefix = 'llx_';
|
||||
define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : ''));
|
||||
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
|
||||
define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root)?$dolibarr_main_data_root:''));
|
||||
define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root
|
||||
$uri=preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||
define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
|
||||
define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : ''));
|
||||
define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root
|
||||
$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
|
||||
$suburi = strstr($uri, '/'); // $suburi contains url without domain
|
||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
|
||||
|
||||
if (empty($character_set_client)) $character_set_client="UTF-8";
|
||||
$conf->file->character_set_client=strtoupper($character_set_client);
|
||||
if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($conf->db->type=='mysql'?'latin1':''); // Old installation
|
||||
$conf->db->character_set=$dolibarr_main_db_character_set;
|
||||
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($conf->db->type=='mysql'?'latin1_swedish_ci':''); // Old installation
|
||||
$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation;
|
||||
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
|
||||
if (empty($character_set_client)) $character_set_client = "UTF-8";
|
||||
$conf->file->character_set_client = strtoupper($character_set_client);
|
||||
if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : ''); // Old installation
|
||||
$conf->db->character_set = $dolibarr_main_db_character_set;
|
||||
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : ''); // Old installation
|
||||
$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
|
||||
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
|
||||
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
|
||||
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
||||
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = '';
|
||||
$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
|
||||
|
||||
if (empty($conf->db->user)) $conf->db->user='';
|
||||
if (empty($conf->db->user)) $conf->db->user = '';
|
||||
|
||||
|
||||
// Defini objet langs
|
||||
|
|
|
|||
|
|
@ -294,9 +294,9 @@ print '</tr>'."\n";
|
|||
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
|
||||
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql .= " AND r.entity = " . $entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql .= " AND r.entity = ".$entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user