Merge branch 'Dolibarr:develop' into develop

This commit is contained in:
Erik van Berkum 2021-09-05 12:49:08 +09:00 committed by GitHub
commit 5dd52d4cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 2184 additions and 488 deletions

View File

@ -212,7 +212,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " ".(!isset($this->position) ? 'NULL' : ((int) $this->position)).",";
$sql .= " ".(!isset($this->fk_country) ? 'NULL' : ((int) $this->fk_country)).",";
$sql .= " ".(!isset($this->active) ? 'NULL' : ((int) $this->active));
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
$this->db->begin();

View File

@ -274,7 +274,7 @@ class AccountingAccount extends CommonObject
$sql .= ", reconcilable";
$sql .= ") VALUES (";
$sql .= " '".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".(empty($this->fk_pcg_version) ? 'NULL' : "'".$this->db->escape($this->fk_pcg_version)."'");
$sql .= ", ".(empty($this->pcg_type) ? 'NULL' : "'".$this->db->escape($this->pcg_type)."'");
$sql .= ", ".(empty($this->account_number) ? 'NULL' : "'".$this->db->escape($this->account_number)."'");
@ -282,7 +282,7 @@ class AccountingAccount extends CommonObject
$sql .= ", ".(empty($this->label) ? "''" : "'".$this->db->escape($this->label)."'");
$sql .= ", ".(empty($this->labelshort) ? "''" : "'".$this->db->escape($this->labelshort)."'");
$sql .= ", ".(empty($this->account_category) ? 0 : (int) $this->account_category);
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".(int) $this->active;
$sql .= ", ".(int) $this->reconcilable;
$sql .= ")";

View File

@ -382,9 +382,9 @@ class BookKeeping extends CommonObject
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_compte) ? ("'".$this->db->escape($this->label_compte)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit;
$sql .= ", ".$this->credit;
$sql .= ", ".$this->montant;
$sql .= ", ".((float) $this->debit);
$sql .= ", ".((float) $this->credit);
$sql .= ", ".((float) $this->montant);
$sql .= ", ".(!empty($this->sens) ? ("'".$this->db->escape($this->sens)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
$sql .= ", '".$this->db->idate($now)."'";
@ -893,9 +893,7 @@ class BookKeeping extends CommonObject
$sql .= ' ORDER BY t.numero_compte ASC';
}
if (!empty($sortfield)) {
$sql .= ", ".$sortfield." ".$sortorder;
}
$sql .= $this->db->order($sortfield, $sortorder);
if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset);
}

View File

@ -574,7 +574,7 @@ class Adherent extends CommonObject
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
$sql .= ", ".$this->typeid;
$sql .= ", ".((int) $this->typeid);
$sql .= ", ".$conf->entity;
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= ")";

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -174,7 +174,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -289,7 +289,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -220,7 +220,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -48,8 +48,8 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
@ -445,7 +445,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -228,7 +228,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -220,7 +220,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -396,7 +396,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -69,7 +69,7 @@ if ($action == 'updateMask') {
$modele = GETPOST('module', 'alpha');
$mo = new MO($db);
$mrp->initAsSpecimen();
$mo->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
@ -88,7 +88,7 @@ if ($action == 'updateMask') {
$module = new $classname($db);
if ($module->write_file($mrp, $langs) > 0) {
if ($module->write_file($mo, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");
return;
} else {
@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -178,7 +178,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -60,7 +60,10 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_RIGHT"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_TOP')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) {
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);

View File

@ -268,7 +268,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -225,7 +225,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -249,7 +249,7 @@ foreach ($arrayhandler as $key => $module) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print '<span class="opacitymedium">'.$tmp.'</span>';
}

View File

@ -246,7 +246,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -259,7 +259,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -247,7 +247,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -247,7 +247,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -266,7 +266,7 @@ foreach ($dirmodels as $reldir) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -286,7 +286,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
} else {
print $tmp;
}

View File

@ -147,10 +147,13 @@ class DolibarrApiAccess implements iAuthenticate
if ($result <= 0) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
}
$fuser->getrights();
// Set the property $user to the $user of API
static::$user = $fuser;
// Set the global variable $user to the $user of API
// Set also the global variable $user to the $user of API
$user = $fuser;
if ($fuser->socid) {

View File

@ -126,7 +126,7 @@ class AssetType extends CommonObject
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
$sql .= ", '".$this->db->escape($this->note)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog("Asset_type::create", LOG_DEBUG);

View File

@ -529,7 +529,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* This fast and low memory method to get and count full list converts the sql into a sql count */
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);

View File

@ -1099,22 +1099,22 @@ class Propal extends CommonObject
$sql .= " VALUES (";
$sql .= $this->socid;
$sql .= ", 0";
$sql .= ", ".$this->remise;
$sql .= ", ".($this->remise_percent ? $this->db->escape($this->remise_percent) : 'NULL');
$sql .= ", ".($this->remise_absolue ? $this->db->escape($this->remise_absolue) : 'NULL');
$sql .= ", ".((float) $this->remise);
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL');
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL');
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", '".$this->db->idate($this->date)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '(PROV)'";
$sql .= ", ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
$sql .= ", ".($user->id > 0 ? ((int) $user->id) : "NULL");
$sql .= ", '".$this->db->escape($this->note_private)."'";
$sql .= ", '".$this->db->escape($this->note_public)."'";
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
$sql .= ", ".($this->fin_validite != '' ? "'".$this->db->idate($this->fin_validite)."'" : "NULL");
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
$sql .= ", '".$this->db->escape($this->ref_client)."'";
$sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
@ -4080,21 +4080,21 @@ class PropaleLigne extends CommonObjectLine
$sql .= " ".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : "null").",";
$sql .= " '".$this->db->escape($this->product_type)."',";
$sql .= " ".($this->fk_remise_except ? "'".$this->db->escape($this->fk_remise_except)."'" : "null").",";
$sql .= " ".price2num($this->qty).",";
$sql .= " ".price2num($this->qty, 'MS').",";
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
$sql .= " ".price2num($this->tva_tx).",";
$sql .= " ".price2num($this->localtax1_tx).",";
$sql .= " ".price2num($this->localtax2_tx).",";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " ".(price2num($this->subprice) !== '' ? price2num($this->subprice) : "null").",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= " ".(isset($this->info_bits) ? "'".$this->db->escape($this->info_bits)."'" : "null").",";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_localtax1).",";
$sql .= " ".price2num($this->total_localtax2).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".(price2num($this->subprice) !== '' ? price2num($this->subprice, 'MU') : "null").",";
$sql .= " ".price2num($this->remise_percent, 3).",";
$sql .= " ".(isset($this->info_bits) ? ((int) $this->info_bits) : "null").",";
$sql .= " ".price2num($this->total_ht, 'MT').",";
$sql .= " ".price2num($this->total_tva, 'MT').",";
$sql .= " ".price2num($this->total_localtax1, 'MT').",";
$sql .= " ".price2num($this->total_localtax2, 'MT').",";
$sql .= " ".price2num($this->total_ttc, 'MT').",";
$sql .= " ".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null").",";
$sql .= " ".(isset($this->pa_ht) ? "'".price2num($this->pa_ht)."'" : "null").",";
$sql .= ' '.((int) $this->special_code).',';
@ -4104,10 +4104,10 @@ class PropaleLigne extends CommonObjectLine
$sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", ".($this->fk_multicurrency > 0 ? ((int) $this->fk_multicurrency) : 'null');
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".$this->multicurrency_subprice;
$sql .= ", ".$this->multicurrency_total_ht;
$sql .= ", ".$this->multicurrency_total_tva;
$sql .= ", ".$this->multicurrency_total_ttc;
$sql .= ", ".price2num($this->multicurrency_subprice, 'CU');
$sql .= ", ".price2num($this->multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_ttc, 'CT');
$sql .= ')';
dol_syslog(get_class($this).'::insert', LOG_DEBUG);

View File

@ -4400,21 +4400,21 @@ class OrderLine extends CommonOrderLine
$sql .= ' '.((int) $this->rang).',';
$sql .= ' '.(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null").',';
$sql .= ' '.price2num($this->pa_ht).',';
$sql .= " '".$this->db->escape($this->info_bits)."',";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_localtax1).",";
$sql .= " ".price2num($this->total_localtax2).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".((int) $this->info_bits).",";
$sql .= " ".price2num($this->total_ht, 'MT').",";
$sql .= " ".price2num($this->total_tva, 'MT').",";
$sql .= " ".price2num($this->total_localtax1, 'MT').",";
$sql .= " ".price2num($this->total_localtax2, 'MT').",";
$sql .= " ".price2num($this->total_ttc, 'MT').",";
$sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").',';
$sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").',';
$sql .= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql .= ", ".(!empty($this->fk_multicurrency) ? $this->fk_multicurrency : 'NULL');
$sql .= ' '.(!$this->fk_unit ? 'NULL' : ((int) $this->fk_unit));
$sql .= ", ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL');
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".$this->multicurrency_subprice;
$sql .= ", ".$this->multicurrency_total_ht;
$sql .= ", ".$this->multicurrency_total_tva;
$sql .= ", ".$this->multicurrency_total_ttc;
$sql .= ", ".price2num($this->multicurrency_subprice, 'CU');
$sql .= ", ".price2num($this->multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_ttc, 'CT');
$sql .= ')';
dol_syslog(get_class($this)."::insert", LOG_DEBUG);

View File

@ -33,7 +33,6 @@
* \brief Page to list orders
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -501,16 +500,13 @@ if ($search_billed != '' && $search_billed >= 0) {
$sql .= ' AND c.facture = '.((int) $search_billed);
}
if ($search_status <> '') {
if ($search_status < 4 && $search_status > -4) {
if ($search_status <= 3 && $search_status >= -1) { // status from -1 to 3 are real status (other are virtual combination)
if ($search_status == 1 && empty($conf->expedition->enabled)) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
$sql .= ' AND c.fk_statut = '.((int) $search_status); // brouillon, validee, en cours, annulee
}
}
if ($search_status == 4) {
$sql .= ' AND c.facture = 1'; // invoice created
}
if ($search_status == -2) { // To process
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
$sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
@ -520,8 +516,6 @@ if ($search_status <> '') {
//$sql.= ' AND c.facture = 0'; // invoice not created
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
}
if ($search_status == -4) { // "validate and in progress"
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
@ -675,9 +669,6 @@ if ($resql) {
if ($search_status == 3) {
$title .= ' - '.$langs->trans('StatusOrderToBillShort');
}
if ($search_status == 4) {
$title .= ' - '.$langs->trans('StatusOrderProcessedShort');
}
if ($search_status == -1) {
$title .= ' - '.$langs->trans('StatusOrderCanceledShort');
}
@ -1254,10 +1245,10 @@ if ($resql) {
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
-4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
-2=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print $form->selectarray('search_status', $liststatus, $search_status, -5, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
print '</td>';
}
// Action column

View File

@ -687,7 +687,7 @@ class Account extends CommonObject
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->escape($this->account_number)."'";
$sql .= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql .= ", '".$this->db->escape($this->bank)."'";
@ -702,8 +702,8 @@ class Account extends CommonObject
$sql .= ", '".$this->db->escape($this->owner_address)."'";
$sql .= ", '".$this->db->escape($this->currency_code)."'";
$sql .= ", ".((int) $this->rappro);
$sql .= ", ".price2num($this->min_allowed);
$sql .= ", ".price2num($this->min_desired);
$sql .= ", ".price2num($this->min_allowed, 'MT');
$sql .= ", ".price2num($this->min_desired, 'MT');
$sql .= ", '".$this->db->escape($this->comment)."'";
$sql .= ", ".($this->state_id > 0 ? ((int) $this->state_id) : "null");
$sql .= ", ".($this->country_id > 0 ? ((int) $this->country_id) : "null");
@ -2152,7 +2152,7 @@ class AccountLine extends CommonObject
$sql .= ", fk_categ";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", ".$cat;
$sql .= ", ".((int) $cat);
$sql .= ")";
dol_syslog(get_class($this)."::update_conciliation", LOG_DEBUG);

View File

@ -81,7 +81,7 @@ class BankCateg // extends CommonObject
$sql .= ", entity";
$sql .= ") VALUES (";
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'")."";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
$this->db->begin();

View File

@ -467,11 +467,11 @@ class PaymentVarious extends CommonObject
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code)."'";
$sql .= ", '".$this->db->escape($this->subledger_account)."'";
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
$sql .= ", ".$user->id;
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
$sql .= ", ".((int) $user->id);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", NULL"; // Filled later
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -192,18 +192,18 @@ class CashControl extends CommonObject
$sql .= ", card";
$sql .= ") VALUES (";
//$sql .= "'(PROV)', ";
$sql .= $conf->entity;
$sql .= ", ".(is_numeric($this->opening) ? $this->opening : 0);
$sql .= ((int) $conf->entity);
$sql .= ", ".(is_numeric($this->opening) ? price2num($this->opening, 'MT') : 0);
$sql .= ", 0"; // Draft by default
$sql .= ", '".$this->db->idate(dol_now())."'";
$sql .= ", '".$this->db->escape($this->posmodule)."'";
$sql .= ", '".$this->db->escape($this->posnumber)."'";
$sql .= ", ".($this->day_close > 0 ? $this->day_close : "null");
$sql .= ", ".($this->month_close > 0 ? $this->month_close : "null");
$sql .= ", ".$this->year_close;
$sql .= ", ".$this->cash;
$sql .= ", ".$this->cheque;
$sql .= ", ".$this->card;
$sql .= ", ".((int) $this->year_close);
$sql .= ", ".price2num($this->cash, 'MT');
$sql .= ", ".price2num($this->cheque, 'MT');
$sql .= ", ".price2num($this->card, 'MT');
$sql .= ")";
$this->db->begin();

View File

@ -167,14 +167,14 @@ class Deplacement extends CommonObject
$sql .= ", fk_soc";
$sql .= ") VALUES (";
$sql .= " '".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".$user->id;
$sql .= ", ".$this->fk_user;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $this->fk_user);
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
$sql .= ", ".($this->fk_soc > 0 ? $this->fk_soc : "null");
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
$sql .= ", ".($this->fk_soc > 0 ? ((int) $this->fk_soc) : "null");
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -300,32 +300,32 @@ class FactureRec extends CommonInvoice
$sql .= ", suspended";
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
$sql .= ", ".$facsrc->socid;
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $facsrc->socid);
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($facsrc->amount) ? $facsrc->amount : '0');
$sql .= ", ".(!empty($facsrc->remise) ? $this->remise : '0');
$sql .= ", ".(!empty($facsrc->amount) ? ((float) $facsrc->amount) : '0');
$sql .= ", ".(!empty($facsrc->remise) ? ((float) $this->remise) : '0');
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", ".(!empty($facsrc->fk_project) ? "'".$this->db->escape($facsrc->fk_project)."'" : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? "'".$this->db->escape($facsrc->fk_account)."'" : "null");
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? $this->db->escape($facsrc->cond_reglement_id) : "null");
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? $this->db->escape($facsrc->mode_reglement_id) : "null");
$sql .= ", ".$this->usenewprice;
$sql .= ", ".$this->frequency;
$sql .= ", ".((int) $user->id);
$sql .= ", ".(!empty($facsrc->fk_project) ? ((int) $facsrc->fk_project) : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null");
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null");
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null");
$sql .= ", ".((int) $this->usenewprice);
$sql .= ", ".((int) $this->frequency);
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
$sql .= ", ".$this->db->escape($this->nb_gen_done);
$sql .= ", ".$this->db->escape($this->nb_gen_max);
$sql .= ", ".$this->db->escape($this->auto_validate);
$sql .= ", ".$this->db->escape($this->generate_pdf);
$sql .= ", ".$this->db->escape($facsrc->fk_multicurrency);
$sql .= ", ".((int) $this->nb_gen_done);
$sql .= ", ".((int) $this->nb_gen_max);
$sql .= ", ".((int) $this->auto_validate);
$sql .= ", ".((int) $this->generate_pdf);
$sql .= ", ".((int) $facsrc->fk_multicurrency);
$sql .= ", '".$this->db->escape($facsrc->multicurrency_code)."'";
$sql .= ", ".$this->db->escape($facsrc->multicurrency_tx);
$sql .= ", ".$this->db->escape($this->suspended);
$sql .= ", ".((float) $facsrc->multicurrency_tx);
$sql .= ", ".((int) $this->suspended);
$sql .= ")";
if ($this->db->query($sql)) {
@ -963,7 +963,7 @@ class FactureRec extends CommonInvoice
$sql .= ", ".price2num($txlocaltax2);
$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
$sql .= ", ".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null");
$sql .= ", ".$product_type;
$sql .= ", ".((int) $product_type);
$sql .= ", ".price2num($remise_percent);
$sql .= ", ".price2num($pu_ht);
$sql .= ", null";
@ -976,16 +976,16 @@ class FactureRec extends CommonInvoice
$sql .= ", ".(int) $date_end_fill;
$sql .= ", ".($fk_fournprice > 0 ? $fk_fournprice : 'null');
$sql .= ", ".($pa_ht ? price2num($pa_ht) : 0);
$sql .= ", ".$info_bits;
$sql .= ", ".$rang;
$sql .= ", ".$special_code;
$sql .= ", ".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
$sql .= ", ".((int) $info_bits);
$sql .= ", ".((int) $rang);
$sql .= ", ".((int) $special_code);
$sql .= ", ".($fk_unit ? ((int) $fk_unit) : "null");
$sql .= ", ".(int) $this->fk_multicurrency;
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".price2num($pu_ht_devise);
$sql .= ", ".price2num($multicurrency_total_ht);
$sql .= ", ".price2num($multicurrency_total_tva);
$sql .= ", ".price2num($multicurrency_total_ttc);
$sql .= ", ".price2num($pu_ht_devise, 'CU');
$sql .= ", ".price2num($multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($multicurrency_total_ttc, 'CT');
$sql .= ")";
dol_syslog(get_class($this)."::addline", LOG_DEBUG);

View File

@ -678,8 +678,8 @@ class Facture extends CommonInvoice
$sql .= ", ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null");
$sql .= ", ".($user->id > 0 ? (int) $user->id : "null");
$sql .= ", ".($this->fk_project ? $this->fk_project : "null");
$sql .= ", ".$this->cond_reglement_id;
$sql .= ", ".$this->mode_reglement_id;
$sql .= ", ".((int) $this->cond_reglement_id);
$sql .= ", ".((int) $this->mode_reglement_id);
$sql .= ", '".$this->db->idate($this->date_lim_reglement)."'";
$sql .= ", ".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
$sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape($this->situation_cycle_ref)."'" : "null");

View File

@ -253,7 +253,7 @@ $arrayfields = array(
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
if (getDolGlobalString("INVOICE_USE_SITUATION") && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)

View File

@ -170,12 +170,12 @@ class RemiseCheque extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $account_id);
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", 0";
$sql .= ", ''";
$sql .= ")";

View File

@ -155,8 +155,8 @@ class BonPrelevement extends CommonObject
}
$sql .= ",fk_prelevement_lignes";
$sql .= ") VALUES (";
$sql .= $invoice_id;
$sql .= ", ".$line_id;
$sql .= ((int) $invoice_id);
$sql .= ", ".((int) $line_id);
$sql .= ")";
if ($this->db->query($sql)) {

View File

@ -114,12 +114,12 @@ class RejetPrelevement
$sql .= ", date_creation";
$sql .= ", afacturer";
$sql .= ") VALUES (";
$sql .= $id;
$sql .= ((int) $id);
$sql .= ", '".$this->db->idate($date_rejet)."'";
$sql .= ", ".$motif;
$sql .= ", ".$user->id;
$sql .= ", ".((int) $motif);
$sql .= ", ".((int) $user->id);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$facturation;
$sql .= ", ".((int) $facturation);
$sql .= ")";
$result = $this->db->query($sql);

View File

@ -230,17 +230,17 @@ class ChargeSociales extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
$sql .= " VALUES (".$this->type;
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL");
$sql .= " VALUES (".((int) $this->type);
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
$sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
$sql .= ", '".$this->db->idate($this->date_ech)."'";
$sql .= ", '".$this->db->idate($this->periode)."'";
$sql .= ", '".price2num($newamount)."'";
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL');
$sql .= ", ".$conf->entity;
$sql .= ", ".$user->id;
$sql .= ", ".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : 'NULL');
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ")";

View File

@ -596,7 +596,7 @@ class Tva extends CommonObject
}
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", NULL";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::addPayment", LOG_DEBUG);

View File

@ -127,8 +127,23 @@ if ($action == 'remove_file' && $permissiontoadd) {
$langs->load("other");
$filetodelete = GETPOST('file', 'alpha');
$file = $upload_dir.'/'.$filetodelete;
$dirthumb = dirname($file).'/thumbs/'; // Chemin du dossier contenant la vignette (if file is an image)
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) {
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors');

View File

@ -112,21 +112,20 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && (!isset($permissiont
dol_delete_file($fileold, 0, 0, 0, (is_object($object) ? $object : null)); // Delete file using old path
}
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
if ($ret) {
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs)) {
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette))) {
dol_delete_file($dirthumb.$photo_vignette);
}
}
setEventMessages($langs->trans("FileWasRemoved", $urlfile), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');

View File

@ -128,7 +128,7 @@ class Comment extends CommonObject
$sql .= ", '".(isset($this->fk_element) ? $this->fk_element : "null")."'";
$sql .= ", '".$this->db->escape($this->element_type)."'";
$sql .= ", '".(isset($this->fk_user_author) ? $this->fk_user_author : "null")."'";
$sql .= ", ".$user->id."";
$sql .= ", ".((int) $user->id);
$sql .= ", ".(!empty($this->entity) ? $this->entity : '1');
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= ")";

View File

@ -1941,9 +1941,9 @@ abstract class CommonObject
if ($fk_user_field) {
if (!empty($fuser) && is_object($fuser)) {
$sql .= ", ".$fk_user_field." = ".$fuser->id;
$sql .= ", ".$fk_user_field." = ".((int) $fuser->id);
} elseif (empty($fuser) || $fuser != 'none') {
$sql .= ", ".$fk_user_field." = ".$user->id;
$sql .= ", ".$fk_user_field." = ".((int) $user->id);
}
}

View File

@ -147,9 +147,9 @@ class Fiscalyear extends CommonObject
$sql .= ", '".$this->db->idate($this->date_start)."'";
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", 0";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -102,7 +102,7 @@ class Link extends CommonObject
$sql .= ", '".$this->db->escape($this->url)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->objecttype)."'";
$sql .= ", ".$this->objectid.")";
$sql .= ", ".((int) $this->objectid).")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -2212,13 +2212,19 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
if (!empty($object->state)) {
$ret .= "\n".$object->state;
}
} elseif (isset($object->country_code) && in_array($object->country_code, array('JP'))) {
// JP: In romaji, title firstname name\n address lines \n [state,] town zip \n country
// See https://www.sljfaq.org/afaq/addresses.html
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town));
$ret .= ($ret ? $sep : '').($object->state ? $object->state.', ' : '').$town.($object->zip ? ' ' : '').$object->zip;
} elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) {
// IT: tile firstname name\n address lines \n zip (Code Departement) \n country
// IT: title firstname name\n address lines \n zip town state_code \n country
$ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town));
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
$ret .= (empty($object->state_code) ? '' : (' '.$object->state_code));
} else { // Other: title firstname name \n address lines \n zip town \n country
} else {
// Other: title firstname name \n address lines \n zip town[, state] \n country
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town));
$ret .= !empty($object->zip) ? (($ret ? $sep : '').$object->zip) : '';
$ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : '');

View File

@ -1560,7 +1560,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql .= ", ".$this->db->encrypt($newvalue);
$sql .= ", null";
$sql .= ", '0'";
$sql .= ", ".$entity;
$sql .= ", ".((int) $entity);
$sql .= ")";
$resql = $this->db->query($sql);
@ -2126,7 +2126,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$entity = $conf->entity; // Reset the current entity
$newvalue = $value;
var_dump($newvalue);
// Serialize array parameters
if (is_array($value)) {
// Can defined other parameters
@ -2145,8 +2145,6 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$newvalue = json_encode($value);
}
}
var_dump($newvalue);
var_dump($this->db->escape($newvalue));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
$sql .= "name";
@ -2164,7 +2162,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql .= ", '0'";
$sql .= ", ".((int) $entity);
$sql .= ")";
print $sql;
dol_syslog(get_class($this)."::insert_module_parts for key=".$this->const_name."_".strtoupper($key), LOG_DEBUG);
$resql = $this->db->query($sql, 1);

View File

@ -75,7 +75,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
$tooltip .= $langs->trans("GenericMaskCodes5");
// Setting the prefix
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):</td>';
$texte .= '<tr><td><span class="opacitymedium">'.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):</span></td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskinvoice" value="'.$conf->global->FACTURE_MERCURE_MASK_INVOICE.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="3">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
@ -83,17 +83,17 @@ class mod_facture_mercure extends ModeleNumRefFactures
$texte .= '</tr>';
// Prefix setting of replacement invoices
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</td>';
$texte .= '<tr><td><span class="opacitymedium">'.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):</span></td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskreplacement" value="'.$conf->global->FACTURE_MERCURE_MASK_REPLACEMENT.'">', $tooltip, 1, 1).'</td>';
$texte .= '</tr>';
// Prefix setting of credit note
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</td>';
$texte .= '<tr><td><span class="opacitymedium">'.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):</span></td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcredit" value="'.$conf->global->FACTURE_MERCURE_MASK_CREDIT.'">', $tooltip, 1, 1).'</td>';
$texte .= '</tr>';
// Prefix setting of deposit
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</td>';
$texte .= '<tr><td><span class="opacitymedium">'.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):</span></td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdeposit" value="'.$conf->global->FACTURE_MERCURE_MASK_DEPOSIT.'">', $tooltip, 1, 1).'</td>';
$texte .= '</tr>';

File diff suppressed because it is too large Load Diff

View File

@ -196,7 +196,7 @@ if ($disablenofollow) {
</div></div>
<?php
if ($captcha) {
if (!empty($captcha)) {
// Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
if (preg_match('/\?/', $php_self)) {
@ -208,7 +208,7 @@ if ($captcha) {
?>
<!-- Captcha -->
<div class="trinputlogin">
<div class="tagtd none valignmiddle tdinputlogin">
<div class="tagtd none valignmiddle tdinputlogin nowrap">
<span class="fa fa-unlock"></span>
<span class="span-icon-security inline-block">

View File

@ -146,7 +146,7 @@ if (!empty($captcha)) {
?>
<!-- Captcha -->
<div class="trinputlogin">
<div class="tagtd tdinputlogin nowraponall none valignmiddle">
<div class="tagtd tdinputlogin nowrap none valignmiddle">
<span class="fa fa-unlock"></span>
<span class="nofa inline-block">
@ -186,7 +186,7 @@ if (!empty($morelogincontent)) {
<div id="login_line2" style="clear: both">
<!-- Button "Regenerate and Send password" -->
<br><input type="submit" <?php echo $disabled; ?> class="button" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
<br><input type="submit" <?php echo $disabled; ?> class="button small" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
<br>
<div class="center" style="margin-top: 15px;">

View File

@ -166,11 +166,11 @@ class Delivery extends CommonObject
$sql .= ", fk_incoterms, location_incoterms";
$sql .= ") VALUES (";
$sql .= "'(PROV)'";
$sql .= ", ".$conf->entity;
$sql .= ", ".$this->socid;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $this->socid);
$sql .= ", '".$this->db->escape($this->ref_customer)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->date_delivery ? "'".$this->db->idate($this->date_delivery)."'" : "null");
$sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");

View File

@ -381,7 +381,7 @@ class Don extends CommonObject
$sql .= ", phone_mobile";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->date ? $this->date : $now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".price2num($this->amount);
$sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");
$sql .= ", ".($this->socid > 0 ? $this->socid : "null");
@ -396,7 +396,7 @@ class Don extends CommonObject
$sql .= ", ".($this->fk_project > 0 ? (int) $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 .= ", ".((int) $user->id);
$sql .= ", null";
$sql .= ", '".$this->db->idate($this->date)."'";
$sql .= ", '".$this->db->escape(trim($this->email))."'";

View File

@ -246,7 +246,7 @@ class ConferenceOrBooth extends ActionComm
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.urlencode($id).'&type=conf';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);

View File

@ -103,7 +103,8 @@ class ConferenceOrBoothAttendee extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'Attendee', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>1, 'visible'=>0, 'index'=>1,),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>0, 'index'=>1,),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0, 'index'=>1,),
'email' => array('type'=>'mail', 'label'=>'Email', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'amount' => array('type'=>'price', 'label'=>'AmountOfSubscriptionPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
@ -403,7 +404,7 @@ class ConferenceOrBoothAttendee extends CommonObject
$sql = 'SELECT ';
$sql .= $this->getFieldList('t');
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
} else {
@ -746,6 +747,10 @@ class ConferenceOrBoothAttendee extends CommonObject
$url .= '&conforboothid='.$this->fk_actioncomm;
}
if ($option == 'projectid') {
$url .= '&fk_project='.$this->fk_project.'&withproject=1';
}
if ($option == 'conforboothidproject') {
$url .= '&conforboothid='.$this->fk_actioncomm.'&withproject=1' ;
}

View File

@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
if ($conf->categorie->enabled) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@ -266,7 +267,7 @@ if ($projectid > 0) {
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
$head = project_prepare_head($project);
print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'));
print dol_get_fiche_head($head, 'eventorganisation', $langs->trans("ConferenceOrBoothTab"), -1, ($project->public ? 'projectpub' : 'project'));
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -440,10 +441,10 @@ if ($projectid > 0) {
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionPage");
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id;
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$project->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
@ -465,6 +466,12 @@ if ($projectid > 0) {
print dol_get_fiche_end();
}
if (!empty($project->id)) {
$head = conferenceorboothProjectPrepareHead($project);
$tab = 'conferenceorbooth';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
}
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';

View File

@ -47,6 +47,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$conf_or_booth_id = GETPOST('conforboothid', 'int');
$fk_project = GETPOST('fk_project', 'int');
$withproject = GETPOST('withproject', 'int');
// Initialize technical objects
@ -174,7 +175,7 @@ $title = $langs->trans("ConferenceOrBoothAttendee");
$help_url = '';
llxHeader('', $title, $help_url);
$result = $projectstatic->fetch($confOrBooth->fk_project);
$result = $projectstatic->fetch(empty($confOrBooth->fk_project)?$fk_project:$confOrBooth->fk_project);
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
@ -343,10 +344,44 @@ if (!empty($withproject)) {
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>';
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>';
print '</div>';
@ -370,6 +405,10 @@ if ($action == 'create') {
if ($confOrBooth->id > 0) {
print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
}
if ($projectstatic->id > 0) {
print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
}
print '<input type="hidden" name="action" value="add">';
if ($backtopage) {
@ -381,9 +420,6 @@ if ($action == 'create') {
print dol_get_fiche_head(array(), '');
// Set some default values
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
@ -423,6 +459,9 @@ if (($id || $ref) && $action == 'edit') {
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
if ($projectstatic->id > 0) {
print '<input type="hidden" name="fk_project" value="'.$projectstatic->id.'">';
}
print dol_get_fiche_head();
@ -470,16 +509,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation of action xxxx
if ($action == 'xxx') {
$formquestion = array();
/*
$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),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// 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);
}
@ -495,61 +524,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/eventorganization/conferenceorboothattendee_list.php', 1).'?restore_lastsearch_values=1&conforboothid='.$confOrBooth->id .$withProjectUrl.'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {
//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
$morehtmlref .= ' : ';
if ($action == 'classify') {
//$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= ': '.$proj->getNomUrl();
} else {
$morehtmlref .= '';
}
}
}*/
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//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';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
@ -628,29 +618,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($reshook)) {
// Send
if (empty($user->socid)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle');
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&mode=init#formmailbeforetitle');
}
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&conforboothid='.$confOrBooth->id.'&action=edit', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit', '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ENABLED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable&token='.newToken().'">'.$langs->trans("Disable").'</a>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Enable").'</a>'."\n";
}
}
if ($permissiontoadd) {
if ($object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken().'">'.$langs->trans("Cancel").'</a>'."\n";
} else {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n";
}
}
*/
// Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));

View File

@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattend
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other"));
$langs->loadLangs(array("eventorganization", "other", "projects"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -59,6 +59,7 @@ $conf_or_booth_id = GETPOST('conforboothid', 'int');
$withproject = GETPOST('withproject', 'int');
$project_ref = GETPOST('project_ref', 'alpha');
$fk_project = GETPOST('fk_project', 'int');
$withProjectUrl='';
@ -215,9 +216,19 @@ if ($conf_or_booth_id > 0) {
$result = $confOrBooth->fetch($conf_or_booth_id);
if ($result < 0) {
setEventMessages(null, $confOrBooth->errors, 'errors');
} else {
$fk_project = $confOrBooth->fk_project;
}
}
if ($fk_project > 0) {
$result = $projectstatic->fetch($fk_project);
if ($result < 0) {
setEventMessages(null, $projectstatic->errors, 'errors');
}
}
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
@ -234,7 +245,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
if (!empty($confOrBooth->id)) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id);
}
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
@ -247,6 +260,9 @@ if ($object->ismultientitymanaged == 1) {
} else {
$sql .= " WHERE 1 = 1";
}
if (!empty($projectstatic->id)) {
$sql .= " AND t.fk_project=".((int) $projectstatic->id);
}
foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
@ -336,8 +352,9 @@ $morejs = array();
$morecss = array();
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
if ($confOrBooth->id > 0) {
$result = $projectstatic->fetch($confOrBooth->fk_project);
if ($projectstatic->id > 0 || $confOrBooth > 0) {
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) {
$projectstatic->fetchComments();
}
@ -456,7 +473,7 @@ if ($confOrBooth->id > 0) {
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -506,10 +523,44 @@ if ($confOrBooth->id > 0) {
// Show message
$message = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.($conf->entity > 1 ? "&entity=".$conf->entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').'</a>';
$message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').'</a>';
print $message;
print "</td></tr>";
// Link to the submit vote/register page
print '<tr><td>';
//print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage"));
//print '</span>';
print '</td><td>';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id;
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linksuggest.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$linksuggest.'" class="quatrevingtpercent">'.$linksuggest.'</a></div>';
print '<a target="_blank" href="'.$linksuggest.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
// Link to the subscribe
print '<tr><td>';
//print '<span class="opacitymedium">';
print $langs->trans("PublicAttendeeSubscriptionGlobalPage");
//print '</span>';
print '</td><td>';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$projectstatic->id.'&type=global';
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$projectstatic->id, 2);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '<div class="urllink">';
//print '<input type="text" value="'.$linkregister.'" id="linkregister" class="quatrevingtpercent paddingrightonly">';
print '<div class="tdoverflowmax200 inline-block valignmiddle"><a target="_blank" href="'.$link_subscription.'" class="quatrevingtpercent">'.$link_subscription.'</a></div>';
print '<a target="_blank" href="'.$link_subscription.'">'.img_picto('', 'globe').'</a>';
//print '</div>';
//print ajax_autoselect("linkregister");
print '</td></tr>';
print '</table>';
print '</div>';
@ -520,38 +571,44 @@ if ($confOrBooth->id > 0) {
print dol_get_fiche_end();
print '<br>';
if (empty($confOrBooth->id)) {
$head = conferenceorboothProjectPrepareHead($projectstatic);
$tab = 'attendees';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
}
}
$head = conferenceorboothPrepareHead($confOrBooth, $withproject);
print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
if ($confOrBooth->id > 0) {
$head = conferenceorboothPrepareHead($confOrBooth, $withproject);
print dol_get_fiche_head($head, 'attendees', $langs->trans("ConferenceOrBooth"), -1, $object->picto);
//$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("ConferenceOrBooth") . ' - ' . $langs->trans("Attendees") . ' - ' . $confOrBooth->id;
//$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
$title = $langs->trans("ConferenceOrBooth") . ' - ' . $langs->trans("Attendees") . ' - ' . $confOrBooth->id;
$object_evt=$object;
$object=$confOrBooth;
$object_evt = $object;
$object = $confOrBooth;
dol_banner_tab($object, 'ref', '', 0);
dol_banner_tab($object, 'ref', '', 0);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">' . "\n";
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';
$object=$object_evt;
print '</table>';
print '</div>';
print '</div>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$object = $object_evt;
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
print dol_get_fiche_end();
}
}
$arrayofselected = is_array($toselect) ? $toselect : array();
@ -575,6 +632,9 @@ foreach ($search as $key => $val) {
if ($confOrBooth->id > 0) {
$param .= '&conforboothid='.urlencode($confOrBooth->id).$withProjectUrl;
}
if ($projectstatic->id > 0) {
$param .= '&fk_project='.urlencode($projectstatic->id).$withProjectUrl;
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@ -612,7 +672,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].(!empty($confOrBooth->id)?'?conforboothid='.$confOrBooth->id:'').$withProjectUrl), '', $permissiontoadd);
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].(!empty($confOrBooth->id)?'?conforboothid='.$confOrBooth->id:'').$withProjectUrl), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -784,7 +844,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'ref') {
print $object->getNomUrl(1, (!empty($withproject)?'conforboothidproject':'conforboothid'));
$optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid');
if (empty($confOrBooth->id)) {
$optionLink='projectid';
}
print $object->getNomUrl(1, $optionLink);
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}

View File

@ -106,6 +106,80 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBooth Project tab
*
* @param $object Project Project
* @return array
*/
function conferenceorboothProjectPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("eventorganization");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_list.php", 1).'?projectid='.$object->id;
$head[$h][1] = $langs->trans("ConferenceOrBooth");
$head[$h][2] = 'conferenceorbooth';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_conferenceorbooth_project_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
$conforbooth=new ConferenceOrBooth($db);
$result = $conforbooth->fetchAll('', '', 0, 0, array('t.fk_project'=>$object->id));
if (!is_array($result) && $result<0) {
setEventMessages($conforbooth->error, $conforbooth->errors, 'errors');
} else {
$nbConferenceOrBooth = count($result);
}
dol_setcache($cachekey, $nbConferenceOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbConferenceOrBooth > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbConferenceOrBooth.'</span>';
}
$h++;
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_list.php", 1).'?fk_project='.$object->id.'&withproject=1';
$head[$h][1] = $langs->trans("Attendees");
$head[$h][2] = 'attendees';
// Enable caching of conf or booth count attendees
$nbAttendees = 0;
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_attendees_conferenceorbooth_project_'.$object->id;
$dataretrieved = dol_getcache($cachekey);
if (!is_null($dataretrieved)) {
$nbAttendees = $dataretrieved;
} else {
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
$attendees=new ConferenceOrBoothAttendee($db);
$result = $attendees->fetchAll('', '', 0, 0, array('t.fk_project'=>$object->id));
if (!is_array($result) && $result<0) {
setEventMessages($attendees->error, $attendees->errors, 'errors');
} else {
$nbAttendees = count($result);
}
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
if ($nbAttendees > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbAttendees.'</span>';
}
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization', 'remove');
return $head;
}
/**
* Prepare array of tabs for ConferenceOrBoothAttendees

View File

@ -303,7 +303,6 @@ class Expedition extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (";
$sql .= "ref";
$sql .= ", entity";
$sql .= ", ref_customer";
@ -330,18 +329,18 @@ class Expedition extends CommonObject
$sql .= ", fk_incoterms, location_incoterms";
$sql .= ") VALUES (";
$sql .= "'(PROV)'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null");
$sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
$sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null");
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->date_expedition > 0 ? "'".$this->db->idate($this->date_expedition)."'" : "null");
$sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null");
$sql .= ", ".$this->socid;
$sql .= ", ".$this->fk_project;
$sql .= ", ".($this->socid > 0 ? ((int) $this->socid) : "null");
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
$sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
$sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null");
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
$sql .= ", ".(is_numeric($this->weight) ? $this->weight : 'NULL');
$sql .= ", ".(is_numeric($this->sizeS) ? $this->sizeS : 'NULL'); // TODO Should use this->trueDepth
@ -2744,9 +2743,9 @@ class ExpeditionLigne extends CommonObjectLine
$sql .= ") VALUES (";
$sql .= $this->fk_expedition;
$sql .= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
$sql .= ", ".$this->fk_origin_line;
$sql .= ", ".$this->qty;
$sql .= ", ".$ranktouse;
$sql .= ", ".((int) $this->fk_origin_line);
$sql .= ", ".price2num($this->qty, 'MS');
$sql .= ", ".((int) $ranktouse);
$sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);

View File

@ -270,23 +270,23 @@ class ExpenseReport extends CommonObject
$sql .= ",entity";
$sql .= ") VALUES(";
$sql .= "'(PROV)'";
$sql .= ", ".$this->total_ht;
$sql .= ", ".$this->total_ttc;
$sql .= ", ".$this->total_tva;
$sql .= ", ".price2num($this->total_ht, 'MT');
$sql .= ", ".price2num($this->total_ttc, 'MT');
$sql .= ", ".price2num($this->total_tva, 'MT');
$sql .= ", '".$this->db->idate($this->date_debut)."'";
$sql .= ", '".$this->db->idate($this->date_fin)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".$fuserid;
$sql .= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator : "null");
$sql .= ", ".($this->fk_user_approve > 0 ? $this->fk_user_approve : "null");
$sql .= ", ".($this->fk_user_modif > 0 ? $this->fk_user_modif : "null");
$sql .= ", ".($this->fk_statut > 1 ? $this->fk_statut : 0);
$sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $fuserid);
$sql .= ", ".($this->fk_user_validator > 0 ? ((int) $this->fk_user_validator) : "null");
$sql .= ", ".($this->fk_user_approve > 0 ? ((int) $this->fk_user_approve) : "null");
$sql .= ", ".($this->fk_user_modif > 0 ? ((int) $this->fk_user_modif) : "null");
$sql .= ", ".($this->fk_statut > 1 ? ((int) $this->fk_statut) : 0);
$sql .= ", ".($this->modepaymentid ? ((int) $this->modepaymentid) : "null");
$sql .= ", 0";
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
$result = $this->db->query($sql);

View File

@ -286,14 +286,14 @@ class Fichinter extends CommonObject
$sql .= $this->socid;
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".$user->id;
$sql .= ", ".$user->id;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->description ? "'".$this->db->escape($this->description)."'" : "null");
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
$sql .= ", ".($this->fk_project ? $this->fk_project : 0);
$sql .= ", ".($this->fk_contrat ? $this->fk_contrat : 0);
$sql .= ", ".$this->statut;
$sql .= ", ".($this->fk_project ? ((int) $this->fk_project) : 0);
$sql .= ", ".($this->fk_contrat ? ((int) $this->fk_contrat) : 0);
$sql .= ", ".((int) $this->statut);
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ")";

View File

@ -182,18 +182,18 @@ class FichinterRec extends Fichinter
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->title)."'";
$sql .= ", ".($this->socid > 0 ? $this->socid : 'null');
$sql .= ", ".$conf->entity;
$sql .= ", ".($this->socid > 0 ? ((int) $this->socid) : 'null');
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($fichintsrc->duration) ? $fichintsrc->duration : '0');
$sql .= ", ".(!empty($fichintsrc->duration) ? ((int) $fichintsrc->duration) : '0');
$sql .= ", ".(!empty($this->description) ? ("'".$this->db->escape($this->description)."'") : "null");
$sql .= ", ".(!empty($fichintsrc->note_private) ? ("'".$this->db->escape($fichintsrc->note_private)."'") : "null");
$sql .= ", ".(!empty($fichintsrc->note_public) ? ("'".$this->db->escape($fichintsrc->note_public)."'") : "null");
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
// si c'est la même société on conserve les liens vers le projet et le contrat
if ($this->socid == $fichintsrc->socid) {
$sql .= ", ".(!empty($fichintsrc->fk_project) ? $fichintsrc->fk_project : "null");
$sql .= ", ".(!empty($fichintsrc->fk_contrat) ? $fichintsrc->fk_contrat : "null");
$sql .= ", ".(!empty($fichintsrc->fk_project) ? ((int) $fichintsrc->fk_project) : "null");
$sql .= ", ".(!empty($fichintsrc->fk_contrat) ? ((int) $fichintsrc->fk_contrat) : "null");
} else {
$sql .= ", null, null";
}
@ -201,12 +201,12 @@ class FichinterRec extends Fichinter
$sql .= ", ".(!empty($fichintsrc->model_pdf) ? "'".$this->db->escape($fichintsrc->model_pdf)."'" : "''");
// récurrence
$sql .= ", ".(!empty($this->frequency) ? $this->frequency : "null");
$sql .= ", ".(!empty($this->frequency) ? ((int) $this->frequency) : "null");
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'null');
$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'null');
$sql .= ", 0"; // we start à 0
$sql .= ", ".$this->nb_gen_max;
$sql .= ", ".((int) $this->nb_gen_max);
// $sql.= ", ".$this->auto_validate;
$sql .= ")";

View File

@ -176,6 +176,21 @@ if (empty($dolibarr_strict_mode)) {
$dolibarr_strict_mode = 0; // For debug in php strict mode
}
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) {
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
exit;
}
// Included by default (must be before the CSRF check so wa can use the dol_syslog)
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
//print memory_get_usage();
// Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
// when we post forms (we allow GET and HEAD to accept direct link from a particular page).
@ -228,7 +243,6 @@ if (empty($dolibarr_main_data_root)) {
// Define some constants
define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
// Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
$tmp = '';
@ -333,18 +347,6 @@ if (!defined('ADODB_DATE_VERSION')) {
include_once ADODB_PATH.'adodb-time.inc.php';
}
if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) {
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
exit;
}
// Included by default
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
//print memory_get_usage();
// If password is encoded, we decode it. Note: When page is called for install, $dolibarr_main_db_pass may not be defined yet.
if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) {
if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) {

View File

@ -1335,14 +1335,14 @@ class CommandeFournisseur extends CommonOrder
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
$sql .= ", '".$this->db->escape($this->note_private)."'";
$sql .= ", '".$this->db->escape($this->note_public)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".$this->socid;
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $this->socid);
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
$sql .= ", '".$this->db->idate($date)."'";
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".self::STATUS_DRAFT;
$sql .= ", ".$this->db->escape($this->source);
$sql .= ", ".((int) $this->source);
$sql .= ", '".$this->db->escape($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)."'";
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'null');
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null');

View File

@ -342,7 +342,7 @@ if (empty($reshook)) {
$sql .= ") VALUES (";
$sql .= $id_order;
$sql .= ", '".$db->escape($objecttmp->origin)."'";
$sql .= ", ".$objecttmp->id;
$sql .= ", ".((int) $objecttmp->id);
$sql .= ", '".$db->escape($objecttmp->element)."'";
$sql .= ")";

View File

@ -740,8 +740,8 @@ if (empty($reshook)) {
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int');
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
@ -751,7 +751,7 @@ if (empty($reshook)) {
$object->transport_mode_id = GETPOST('transport_mode_id', 'int');
// Proprietes particulieres a facture de remplacement
$object->fk_facture_source = GETPOST('fac_replacement');
$object->fk_facture_source = GETPOST('fac_replacement', 'int');
$object->type = FactureFournisseur::TYPE_REPLACEMENT;
$id = $object->createFromCurrent($user);

View File

@ -204,12 +204,12 @@ class Establishment extends CommonObject
$sql .= ", '".$this->db->escape($this->address)."'";
$sql .= ", '".$this->db->escape($this->zip)."'";
$sql .= ", '".$this->db->escape($this->town)."'";
$sql .= ", ".$this->country_id;
$sql .= ", ".$this->status;
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $this->country_id);
$sql .= ", ".((int) $this->status);
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $user->id);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -185,8 +185,9 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals open (expired)
// Number of supplier proposals open (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
$langs->load("supplier_proposal");
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board = new SupplierProposal($db);
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");

View File

@ -41,6 +41,7 @@
ALTER TABLE llx_emailcollector_emailcollectoraction MODIFY COLUMN actionparam TEXT;
ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD lang varchar(6);
ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN entity integer DEFAULT 1;
CREATE TABLE llx_categorie_ticket
(
@ -69,4 +70,3 @@ DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = '
INSERT INTO llx_c_action_trigger (code, label, description, elementtype, rang) values ('MEMBER_EXCLUDE', 'Member excluded', 'Executed when a member is excluded', 'member', 27);

View File

@ -21,10 +21,12 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_evento
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-- END MODULEBUILDER INDEXES
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email);

View File

@ -19,7 +19,8 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
fk_soc integer,
fk_actioncomm integer NOT NULL,
fk_actioncomm integer,
fk_project integer NOT NULL,
email varchar(100),
date_subscription datetime,
amount double DEFAULT NULL,

View File

@ -16,7 +16,8 @@
CREATE TABLE llx_knowledgemanagement_knowledgerecord(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref varchar(128) NOT NULL,
date_creation datetime NOT NULL,
tms timestamp,

View File

@ -1087,7 +1087,7 @@ function migrate_links_transfert($db, $langs, $conf)
$sql .= $obj->barowid.",".$obj->bbrowid.", '/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'";
$sql .= ")";
print $sql.'<br>';
//print $sql.'<br>';
dolibarr_install_syslog("migrate_links_transfert");
if (!$db->query($sql)) {

View File

@ -50,7 +50,7 @@ class KnowledgeRecord extends CommonObject
* @var int Does this object support multicompany module ?
* 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
*/
public $ismultientitymanaged = 0;
public $ismultientitymanaged = 1;
/**
* @var int Does object support extrafields ? 0=No, 1=Yes

View File

@ -110,7 +110,8 @@ ListOfConferencesOrBooths=List of conferences or booths
SuggestConference = Suggest a new conference
SuggestBooth = Suggest a booth
ViewAndVote = View and vote for suggested events
PublicAttendeeSubscriptionPage = Public link for registration to the event
PublicAttendeeSubscriptionGlobalPage = Public link for registration to the event
PublicAttendeeSubscriptionPage = Public link for registration to this event only
MissingOrBadSecureKey = The security key is invalid or missing
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference : '%s'
EvntOrgDuration = This conference starts on %s and ends on %s.

View File

@ -364,7 +364,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* This fast and low memory method to get and count full list convert the sql into a sql count */
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);

View File

@ -1186,6 +1186,8 @@ class Mo extends CommonObject
public function initAsSpecimen()
{
$this->initAsSpecimenCommon();
$this->lines = array();
}
/**

View File

@ -718,19 +718,19 @@ class Product extends CommonObject
$sql .= ", fk_unit";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null");
$sql .= ", ".price2num($price_min_ht);
$sql .= ", ".price2num($price_min_ttc);
$sql .= ", ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
$sql .= ", ".$user->id;
$sql .= ", ".$this->type;
$sql .= ", ".price2num($price_ht);
$sql .= ", ".price2num($price_ttc);
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $this->type);
$sql .= ", ".price2num($price_ht, 'MT');
$sql .= ", ".price2num($price_ttc, 'MT');
$sql .= ", '".$this->db->escape($this->price_base_type)."'";
$sql .= ", ".$this->status;
$sql .= ", ".$this->status_buy;
$sql .= ", ".((int) $this->status);
$sql .= ", ".((int) $this->status_buy);
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
@ -740,10 +740,10 @@ class Product extends CommonObject
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
}
$sql .= ", '".$this->db->escape($this->canvas)."'";
$sql .= ", ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
$sql .= ", ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'NULL' : (int) $this->finished);
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : ((int) $this->status_batch));
$sql .= ", '".$this->db->escape($this->batch_mask)."'";
$sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
$sql .= ")";
dol_syslog(get_class($this)."::Create", LOG_DEBUG);

View File

@ -579,7 +579,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* This fast and low memory method to get and count full list converts the sql into a sql count */
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);

View File

@ -381,10 +381,10 @@ class Project extends CommonObject
$sql .= ", '".$this->db->escape($this->title)."'";
$sql .= ", '".$this->db->escape($this->description)."'";
$sql .= ", ".($this->socid > 0 ? $this->socid : "null");
$sql .= ", ".$user->id;
$sql .= ", ".(is_numeric($this->statut) ? $this->statut : '0');
$sql .= ", ".((is_numeric($this->opp_status) && $this->opp_status > 0) ? $this->opp_status : 'NULL');
$sql .= ", ".(is_numeric($this->opp_percent) ? $this->opp_percent : 'NULL');
$sql .= ", ".((int) $user->id);
$sql .= ", ".(is_numeric($this->statut) ? ((int) $this->statut) : '0');
$sql .= ", ".((is_numeric($this->opp_status) && $this->opp_status > 0) ? ((int) $this->opp_status) : 'NULL');
$sql .= ", ".(is_numeric($this->opp_percent) ? ((int) $this->opp_percent) : 'NULL');
$sql .= ", ".($this->public ? 1 : 0);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
@ -402,7 +402,7 @@ class Project extends CommonObject
$sql .= ", ".($this->email_msgid ? "'".$this->db->escape($this->email_msgid)."'" : 'null');
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null');
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null');
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -173,18 +173,18 @@ class Task extends CommonObject
$sql .= ", planned_workload";
$sql .= ", progress";
$sql .= ") VALUES (";
$sql .= $conf->entity;
$sql .= ", ".$this->fk_project;
$sql .= ((int) $conf->entity);
$sql .= ", ".((int) $this->fk_project);
$sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null');
$sql .= ", ".$this->fk_task_parent;
$sql .= ", ".((int) $this->fk_task_parent);
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->description)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null');
$sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null');
$sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? ((int) $this->planned_workload) : 'null');
$sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? ((int) $this->progress) : 'null');
$sql .= ")";
$this->db->begin();
@ -1182,12 +1182,12 @@ class Task extends CommonObject
$sql .= ", fk_user";
$sql .= ", note";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ((int) $this->id);
$sql .= ", '".$this->db->idate($this->timespent_date)."'";
$sql .= ", '".$this->db->idate($this->timespent_datehour)."'";
$sql .= ", ".(empty($this->timespent_withhour) ? 0 : 1);
$sql .= ", ".$this->timespent_duration;
$sql .= ", ".$this->timespent_fk_user;
$sql .= ", ".((int) $this->timespent_duration);
$sql .= ", ".((int) $this->timespent_fk_user);
$sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null");
$sql .= ")";

View File

@ -80,20 +80,35 @@ $societe = GETPOST("societe");
// Getting id from Post and decoding it
$id = GETPOST('id', 'int');
$type = GETPOST('type', 'alpha');
$conference = new ConferenceOrBooth($db);
$resultconf = $conference->fetch($id);
if ($resultconf < 0) {
print 'Bad value for parameter id';
exit;
$project = new Project($db);
if ($type=='conf') {
$resultconf = $conference->fetch($id);
if ($resultconf < 0) {
print 'Bad value for parameter id';
exit;
}
$resultproject = $project->fetch($conference->fk_project);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
}
if ($type=='global') {
$project = new Project($db);
if (empty($id)) {
$id = GETPOST('fk_project', 'int');
}
$resultproject = $project->fetch($id);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
}
$project = new Project($db);
$resultproject = $project->fetch($conference->fk_project);
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
}
// Security check
@ -206,7 +221,7 @@ if ($reshook < 0) {
}
// Action called when page is submitted
if (empty($reshook) && $action == 'add' && $conference->status == 2) {
if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status!=2 || !empty($project->id) && $project->status==Project::STATUS_VALIDATED)) {
$error = 0;
$urlback = '';
@ -235,7 +250,15 @@ if (empty($reshook) && $action == 'add' && $conference->status == 2) {
if (!$error) {
// Check if attendee already exists (by email and for this event)
$confattendee = new ConferenceOrBoothAttendee($db);
$resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"'));
if ($type=='global') {
$filter = array('t.fk_project'=>$id, 'customsql'=>'t.email="'.$email.'"');
}
if ($action='conf') {
$filter = array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"');
}
$resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, $filter);
if ($resultfetchconfattendee > 0 && count($resultfetchconfattendee)>0) {
// Found confattendee
$confattendee = array_shift($resultfetchconfattendee);
@ -243,6 +266,7 @@ if (empty($reshook) && $action == 'add' && $conference->status == 2) {
// Need to create a confattendee
$confattendee->date_subscription = dol_now();
$confattendee->email = $email;
$confattendee->fk_project = $project->id;
$confattendee->fk_actioncomm = $id;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
@ -470,24 +494,29 @@ print '<div id="divsubscribe">';
print '<div class="center subscriptionformhelptext justify">';
// Welcome message
print $langs->trans("EvntOrgWelcomeMessage", $conference->label);
print $langs->trans("EvntOrgWelcomeMessage", $project->title . ' '. $conference->label);
print '<br>';
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
if ($conference->id) {
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
} else {
print $langs->trans("EvntOrgDuration", dol_print_date($project->date_start), dol_print_date($project->date_end));
}
print '</div>';
print '<br>';
dol_htmloutput_errors($errmsg);
if ($conference->status!=2) {
print $langs->trans("ConferenceIsNotConfirmed");
} else {
if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CONFIRMED || (!empty($project->id) && $project->status==Project::STATUS_VALIDATED)) {
// Print form
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="newmember">' . "\n";
print '<input type="hidden" name="token" value="' . newToken() . '" / >';
print '<input type="hidden" name="entity" value="' . $entity . '" />';
print '<input type="hidden" name="action" value="add" />';
print '<input type="hidden" name="id" value="' . $id . '" />';
print '<input type="hidden" name="id" value="' . $conference->id . '" />';
print '<input type="hidden" name="type" value="' . $type . '" />';
print '<input type="hidden" name="fk_project" value="' . $project->id . '" />';
print '<input type="hidden" name="securekey" value="' . $securekeyreceived . '" />';
print '<br>';
@ -498,15 +527,15 @@ if ($conference->status!=2) {
print dol_get_fiche_head('');
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.newmember.action.value="create";
document.newmember.submit();
});
});
});
</script>';
jQuery(document).ready(function () {
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.newmember.action.value="create";
document.newmember.submit();
});
});
});
</script>';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">' . "\n";
@ -574,6 +603,8 @@ jQuery(document).ready(function () {
print "</form>\n";
print "<br>";
print '</div></div>';
} else {
print $langs->trans("ConferenceIsNotConfirmed");
}
llxFooterVierge();

View File

@ -256,22 +256,22 @@ class Reception extends CommonObject
$sql .= ", fk_incoterms, location_incoterms";
$sql .= ") VALUES (";
$sql .= "'(PROV)'";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null");
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->date_reception > 0 ? "'".$this->db->idate($this->date_reception)."'" : "null");
$sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null");
$sql .= ", ".$this->socid;
$sql .= ", ".$this->fk_project;
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
$sql .= ", ".((int) $this->socid);
$sql .= ", ".((int) $this->fk_project);
$sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null");
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
$sql .= ", ".$this->weight;
$sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth
$sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth
$sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight
$sql .= ", ".$this->weight_units;
$sql .= ", ".$this->size_units;
$sql .= ", ".((double) $this->weight);
$sql .= ", ".((double) $this->sizeS); // TODO Should use this->trueDepth
$sql .= ", ".((double) $this->sizeW); // TODO Should use this->trueWidth
$sql .= ", ".((double) $this->sizeH); // TODO Should use this->trueHeight
$sql .= ", ".((double) $this->weight_units);
$sql .= ", ".((double) $this->size_units);
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");

View File

@ -406,11 +406,11 @@ class Salary extends CommonObject
$sql .= "'".$this->db->escape($this->fk_user)."'";
//$sql .= ", '".$this->db->idate($this->datep)."'";
//$sql .= ", '".$this->db->idate($this->datev)."'";
$sql .= ", ".$this->amount;
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0);
$sql .= ", ".($this->salary > 0 ? $this->salary : "null");
$sql .= ", ".($this->type_payment > 0 ? $this->type_payment : 0);
$sql .= ", ".($this->accountid > 0 ? $this->accountid : "null");
$sql .= ", ".((double) $this->amount);
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
$sql .= ", ".($this->salary > 0 ? ((double) $this->salary) : "null");
$sql .= ", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
$sql .= ", ".($this->accountid > 0 ? ((int) $this->accountid) : "null");
if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->idate($this->datesp)."'";
@ -418,7 +418,7 @@ class Salary extends CommonObject
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", NULL";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -76,7 +76,7 @@ if (!empty($conf->notification->enabled)) {
$langs->load("mails");
}
$mesg = ''; $error = 0; $errors = array();
$error = 0; $errors = array();
$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view');
$cancel = GETPOST('cancel', 'alpha');
@ -90,6 +90,7 @@ if ($user->socid) {
if (empty($socid) && $action == 'view') {
$action = 'create';
}
$id = $socid;
$object = new Societe($db);
$extrafields = new ExtraFields($db);

View File

@ -929,11 +929,11 @@ class SupplierProposal extends CommonObject
$sql .= ", multicurrency_tx";
$sql .= ") ";
$sql .= " VALUES (";
$sql .= $this->socid;
$sql .= ((int) $this->socid);
$sql .= ", 0";
$sql .= ", ".$this->remise;
$sql .= ", ".($this->remise_percent ? $this->db->escape($this->remise_percent) : 'null');
$sql .= ", ".($this->remise_absolue ? $this->db->escape($this->remise_absolue) : 'null');
$sql .= ", ".((double) $this->remise);
$sql .= ", ".($this->remise_percent ? ((double) $this->remise_percent) : 'null');
$sql .= ", ".($this->remise_absolue ? ((double) $this->remise_absolue) : 'null');
$sql .= ", 0";
$sql .= ", 0";
$sql .= ", '".$this->db->idate($now)."'";
@ -942,16 +942,16 @@ class SupplierProposal extends CommonObject
$sql .= ", '".$this->db->escape($this->note_private)."'";
$sql .= ", '".$this->db->escape($this->note_public)."'";
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL');
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
$sql .= ", ".($this->fk_project ? $this->fk_project : "null");
$sql .= ", ".$conf->entity;
$sql .= ", ".(int) $this->fk_multicurrency;
$sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL');
$sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $this->fk_multicurrency);
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".(double) $this->multicurrency_tx;
$sql .= ", ".((double) $this->multicurrency_tx);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
@ -3021,40 +3021,40 @@ class SupplierProposalLine extends CommonObjectLine
$sql .= ' ref_fourn,';
$sql .= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)';
$sql .= " VALUES (".$this->fk_supplier_proposal.",";
$sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").",";
$sql .= " ".($this->fk_parent_line > 0 ? ((int) $this->db->escape($this->fk_parent_line)) : "null").",";
$sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
$sql .= " '".$this->db->escape($this->desc)."',";
$sql .= " ".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : "null").",";
$sql .= " ".($this->fk_product ? ((int) $this->fk_product) : "null").",";
$sql .= " '".$this->db->escape($this->product_type)."',";
$sql .= " ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : "null").",";
$sql .= " ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null").",";
$sql .= " ".($this->fk_remise_except ? "'".$this->db->escape($this->fk_remise_except)."'" : "null").",";
$sql .= " ".price2num($this->qty).",";
$sql .= " ".($this->fk_remise_except ? ((int) $this->db->escape($this->fk_remise_except)) : "null").",";
$sql .= " ".price2num($this->qty, 'MS').",";
$sql .= " ".price2num($this->tva_tx).",";
$sql .= " ".price2num($this->localtax1_tx).",";
$sql .= " ".price2num($this->localtax2_tx).",";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " ".(!empty($this->subprice) ?price2num($this->subprice) : "null").",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= " ".(isset($this->info_bits) ? "'".$this->db->escape($this->info_bits)."'" : "null").",";
$sql .= " ".price2num($this->total_ht).",";
$sql .= " ".price2num($this->total_tva).",";
$sql .= " ".price2num($this->total_localtax1).",";
$sql .= " ".price2num($this->total_localtax2).",";
$sql .= " ".price2num($this->total_ttc).",";
$sql .= " ".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null").",";
$sql .= " ".(isset($this->pa_ht) ? "'".price2num($this->pa_ht)."'" : "null").",";
$sql .= " ".(!empty($this->subprice) ? price2num($this->subprice, 'MU') : "null").",";
$sql .= " ".((float) $this->remise_percent).",";
$sql .= " ".(isset($this->info_bits) ? ((int) $this->info_bits) : "null").",";
$sql .= " ".price2num($this->total_ht, 'MT').",";
$sql .= " ".price2num($this->total_tva, 'MT').",";
$sql .= " ".price2num($this->total_localtax1, 'MT').",";
$sql .= " ".price2num($this->total_localtax2, 'MT').",";
$sql .= " ".price2num($this->total_ttc, 'MT').",";
$sql .= " ".(!empty($this->fk_fournprice) ? ((int) $this->fk_fournprice) : "null").",";
$sql .= " ".(isset($this->pa_ht) ? price2num($this->pa_ht, 'MU') : "null").",";
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';
$sql .= " '".$this->db->escape($this->ref_fourn)."'";
$sql .= ", ".($this->fk_multicurrency > 0 ? $this->fk_multicurrency : 'null');
$sql .= ", ".($this->fk_multicurrency > 0 ? ((int) $this->fk_multicurrency) : 'null');
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".$this->multicurrency_subprice;
$sql .= ", ".$this->multicurrency_total_ht;
$sql .= ", ".$this->multicurrency_total_tva;
$sql .= ", ".$this->multicurrency_total_ttc;
$sql .= ", ".($this->fk_unit ? $this->fk_unit : 'null');
$sql .= ", ".price2num($this->multicurrency_subprice, 'CU');
$sql .= ", ".price2num($this->multicurrency_total_ht, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_tva, 'CT');
$sql .= ", ".price2num($this->multicurrency_total_ttc, 'CT');
$sql .= ", ".($this->fk_unit ? ((int) $this->fk_unit) : 'null');
$sql .= ')';
dol_syslog(get_class($this).'::insert', LOG_DEBUG);

View File

@ -152,19 +152,19 @@ $invoice = new Facture($db);
if ($invoiceid > 0) {
$ret = $invoice->fetch($invoiceid);
} else {
$ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')');
$ret = $invoice->fetch('', '(PROV-POS'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '') .'-'.$place.')');
}
if ($ret > 0) {
$placeid = $invoice->id;
}
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
$soc = new Societe($db);
if ($invoice->socid > 0) {
$soc->fetch($invoice->socid);
} else {
$soc->fetch($conf->global->$constforcompanyid);
$soc->fetch(getDolGlobalString("$constforcompanyid"));
}
@ -477,10 +477,10 @@ if ($action == 'history' || $action == 'creditnote') {
}
if (($action == "addline" || $action == "freezone") && $placeid == 0) {
$invoice->socid = $conf->global->$constforcompanyid;
$invoice->socid = getDolGlobalString("$constforcompanyid");
$invoice->date = dol_now();
$invoice->module_source = 'takepos';
$invoice->pos_source = $_SESSION["takeposterminal"];
$invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
$invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity;
if ($invoice->socid <= 0) {
@ -549,7 +549,7 @@ if ($action == "addline") {
}
if ($idoflineadded <= 0) {
$invoice->fetch_thirdparty();
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, '', '', 0, 100, '', null, 0);
$idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', 0, 100, '', null, 0);
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
$CUSTOMER_DISPLAY_line1 = $prod->label;
$CUSTOMER_DISPLAY_line2 = price($price_ttc);
@ -930,7 +930,7 @@ $(document).ready(function() {
}
<?php
if ($action == "order" and $order_receipt_printer1 != "") {
if ($action == "order" && !empty($order_receipt_printer1)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -951,7 +951,7 @@ if ($action == "order" and $order_receipt_printer1 != "") {
}
}
if ($action == "order" and $order_receipt_printer2 != "") {
if ($action == "order" && !empty($order_receipt_printer2)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -972,7 +972,7 @@ if ($action == "order" and $order_receipt_printer2 != "") {
}
}
if ($action == "order" and $order_receipt_printer3 != "") {
if ($action == "order" && !empty($order_receipt_printer3)) {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
?>
$.ajax({
@ -992,7 +992,7 @@ if ($action == "search" || $action == "valid") {
}
if ($action == "temp" and $ticket_printer1 != "") {
if ($action == "temp" && !empty($ticket_printer1)) {
?>
$.ajax({
type: "POST",
@ -1039,7 +1039,7 @@ function TakeposPrinting(id){
function TakeposConnector(id){
console.log("TakeposConnector" + id);
$.get("<?php echo DOL_URL_ROOT; ?>/takepos/ajax/ajax.php?action=printinvoiceticket&term=<?php echo urlencode($_SESSION["takeposterminal"]); ?>&id="+id+"&token=<?php echo currentToken(); ?>", function(data, status) {
$.get("<?php echo DOL_URL_ROOT; ?>/takepos/ajax/ajax.php?action=printinvoiceticket&term=<?php echo urlencode(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); ?>&id="+id+"&token=<?php echo currentToken(); ?>", function(data, status) {
$.ajax({
type: "POST",
url: '<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>/printer/index.php',
@ -1053,7 +1053,7 @@ function DolibarrTakeposPrinting(id) {
$.ajax({
type: "GET",
data: { token: '<?php echo currentToken(); ?>' },
url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&term='.urlencode($_SESSION["takeposterminal"]).'&id='; ?>" + id,
url: "<?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=printinvoiceticket&term='.urlencode(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '').'&id='; ?>" + id,
});
}
@ -1086,7 +1086,7 @@ $( document ).ready(function() {
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
if (empty($conf->global->TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED)) {
// By default, only invoices with a ref not already defined can in list of open invoice we can edit.
$sql .= " WHERE ref LIKE '(PROV-POS".$db->escape($_SESSION["takeposterminal"])."-0%' AND entity IN (".getEntity('invoice').")";
$sql .= " WHERE ref LIKE '(PROV-POS".$db->escape(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '')."-0%' AND entity IN (".getEntity('invoice').")";
} else {
// If TAKEPOS_CAN_EDIT_IF_ALREADY_VALIDATED set, we show also draft invoice that already has a reference defined
$sql .= " WHERE pos_source = '".$db->escape($_SESSION["takeposterminal"])."'";
@ -1127,12 +1127,12 @@ $( document ).ready(function() {
$s = '';
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") {
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
if (!empty($conf->stock->enabled) && getDolGlobalString("$constantforkey") != "1") {
$s = '<span class="small">';
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
$warehouse = new Entrepot($db);
$warehouse->fetch($conf->global->$constantforkey);
$warehouse->fetch(getDolGlobalString($constantforkey));
$s .= $langs->trans("Warehouse").'<br>'.$warehouse->ref;
$s .= '</span>';
}

View File

@ -466,7 +466,7 @@ class Ticket extends CommonObject
$sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").",";
$sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").",";
$sql .= " ".(!isset($this->date_close) || dol_strlen($this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'")."";
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".(!isset($this->notify_tiers_at_create) ? '1' : "'".$this->db->escape($this->notify_tiers_at_create)."'");
$sql .= ")";

View File

@ -951,6 +951,10 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
$object->country_code='AU';
$address=dol_format_address($object);
$this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address);
$object->country_code='JP';
$address=dol_format_address($object);
$this->assertEquals("21 jump street\nMyState, MyTown 99999", $address);
}