Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
5713bf025c
@ -39,6 +39,9 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 160);
|
|||||||
$id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id');
|
$id = GETPOST('account') ?GETPOST('account', 'alpha') : GETPOST('id');
|
||||||
$ref = GETPOST('ref');
|
$ref = GETPOST('ref');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('bankannualreport', 'globalcard'));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||||
|
|||||||
@ -38,6 +38,9 @@ $ref = GETPOST('ref', 'alpha');
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('bankaccountdocuments', 'globalcard'));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|||||||
@ -35,6 +35,9 @@ $langs->loadLangs(array('banks', 'categories'));
|
|||||||
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
|
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
|
||||||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
|
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('bankstats', 'globalcard'));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (GETPOST('account') || GETPOST('ref')) {
|
if (GETPOST('account') || GETPOST('ref')) {
|
||||||
$id = GETPOST('account') ? GETPOST('account') : GETPOST('ref');
|
$id = GETPOST('account') ? GETPOST('account') : GETPOST('ref');
|
||||||
|
|||||||
@ -62,6 +62,9 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha');
|
|||||||
$rel = GETPOST("rel", 'alphanohtml');
|
$rel = GETPOST("rel", 'alphanohtml');
|
||||||
$backtopage = GETPOST('backtopage', 'alpha');
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('bankaccountstatement', 'globalcard'));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (!empty($ref) ? $ref : $id);
|
$fieldid = (!empty($ref) ? $ref : $id);
|
||||||
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
||||||
|
|||||||
@ -171,6 +171,8 @@ class Facture extends CommonInvoice
|
|||||||
public $total_ttc;
|
public $total_ttc;
|
||||||
public $revenuestamp;
|
public $revenuestamp;
|
||||||
|
|
||||||
|
public $resteapayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
|
* ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
|
||||||
* ! Closing when no payment: replaced, abandoned
|
* ! Closing when no payment: replaced, abandoned
|
||||||
|
|||||||
@ -6270,7 +6270,7 @@ abstract class CommonObject
|
|||||||
case 'date':
|
case 'date':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
// If data is a string instead of a timestamp, we convert it
|
// If data is a string instead of a timestamp, we convert it
|
||||||
if (!is_int($this->array_options[$key])) {
|
if (!is_numeric($this->array_options[$key]) || $this->array_options[$key] != intval($this->array_options[$key])) {
|
||||||
$this->array_options[$key] = strtotime($this->array_options[$key]);
|
$this->array_options[$key] = strtotime($this->array_options[$key]);
|
||||||
}
|
}
|
||||||
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
|
||||||
|
|||||||
@ -107,6 +107,25 @@ abstract class DoliDB implements Database
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a SQL REGEXP
|
||||||
|
*
|
||||||
|
* @param string $subject string tested
|
||||||
|
* @param string $pattern SQL pattern to match
|
||||||
|
* @param string $sqlstring whether or not the string being tested is an SQL expression
|
||||||
|
* @return string SQL string
|
||||||
|
*/
|
||||||
|
public function regexpsql($subject, $pattern, $sqlstring = false)
|
||||||
|
{
|
||||||
|
if ($sqlstring) {
|
||||||
|
return "(". $subject ." REGEXP '" . $pattern . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "('". $subject ."' REGEXP '" . $pattern . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
|
|||||||
@ -757,6 +757,24 @@ class DoliDBPgsql extends DoliDB
|
|||||||
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
|
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a SQL REGEXP
|
||||||
|
*
|
||||||
|
* @param string $subject string tested
|
||||||
|
* @param string $pattern SQL pattern to match
|
||||||
|
* @param string $sqlstring whether or not the string being tested is an SQL expression
|
||||||
|
* @return string SQL string
|
||||||
|
*/
|
||||||
|
public function regexpsql($subject, $pattern, $sqlstring = false)
|
||||||
|
{
|
||||||
|
if ($sqlstring) {
|
||||||
|
return "(". $subject ." ~ '" . $pattern . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "('". $subject ."' ~ '" . $pattern . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoie le code erreur generique de l'operation precedente.
|
* Renvoie le code erreur generique de l'operation precedente.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1282,6 +1282,11 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
||||||
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'";
|
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'";
|
||||||
$sql .= " AND ".$field." NOT LIKE '(PROV%)'";
|
$sql .= " AND ".$field." NOT LIKE '(PROV%)'";
|
||||||
|
|
||||||
|
// To ensure that all variables within the MAX() brackets are integers
|
||||||
|
$sql .= " AND ". $db->regexpsql($sqlstring, '^[0-9]+$', true);
|
||||||
|
|
||||||
|
|
||||||
if ($bentityon) { // only if entity enable
|
if ($bentityon) { // only if entity enable
|
||||||
$sql .= " AND entity IN (".getEntity($sharetable).")";
|
$sql .= " AND entity IN (".getEntity($sharetable).")";
|
||||||
} elseif (!empty($forceentity)) {
|
} elseif (!empty($forceentity)) {
|
||||||
@ -2234,7 +2239,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
|
|||||||
$classpath = 'compta/facture/class';
|
$classpath = 'compta/facture/class';
|
||||||
$classfile = 'facture-rec';
|
$classfile = 'facture-rec';
|
||||||
$classname = 'FactureRec';
|
$classname = 'FactureRec';
|
||||||
$module='facture';
|
$module = 'facture';
|
||||||
|
} elseif ($objecttype == 'mailing') {
|
||||||
|
$classpath = 'comm/mailing/class';
|
||||||
|
$classfile = 'mailing';
|
||||||
|
$classname = 'Mailing';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isModEnabled($module)) {
|
if (isModEnabled($module)) {
|
||||||
|
|||||||
@ -860,7 +860,7 @@ class modProduct extends DolibarrModules
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier');
|
$this->import_updatekeys_array[$r] = array('sp.fk_product'=>'ProductOrService', 'sp.ref_fourn'=>'SupplierRef', 'sp.fk_soc'=>'Supplier', 'sp.quantity'=>"QtyMin");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
|
|||||||
@ -742,7 +742,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
|||||||
if (!is_object($member)) { // This should not happen
|
if (!is_object($member)) { // This should not happen
|
||||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
$member = new Adherent($this->db);
|
$member = new Adherent($this->db);
|
||||||
$member->fetch($this->fk_adherent);
|
$member->fetch($object->fk_adherent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($object->actionmsg2)) {
|
if (empty($object->actionmsg2)) {
|
||||||
|
|||||||
@ -54,6 +54,8 @@ ALTER TABLE llx_user DROP COLUMN idpers3;
|
|||||||
|
|
||||||
UPDATE llx_c_actioncomm SET type = 'system' WHERE code = 'AC_OTH';
|
UPDATE llx_c_actioncomm SET type = 'system' WHERE code = 'AC_OTH';
|
||||||
|
|
||||||
|
ALTER TABLE llx_opensurvey_user_studs MODIFY reponses VARCHAR(200) NOT NULL;
|
||||||
|
|
||||||
-- v17
|
-- v17
|
||||||
|
|
||||||
ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_type varchar(32);
|
ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_type varchar(32);
|
||||||
|
|||||||
@ -19,7 +19,7 @@ CREATE TABLE llx_opensurvey_user_studs (
|
|||||||
id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
nom VARCHAR(64) NOT NULL,
|
nom VARCHAR(64) NOT NULL,
|
||||||
id_sondage VARCHAR(16) NOT NULL,
|
id_sondage VARCHAR(16) NOT NULL,
|
||||||
reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys
|
reponses VARCHAR(200) NOT NULL, -- Not used for 'F' surveys
|
||||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
date_creation datetime NOT NULL,
|
date_creation datetime NOT NULL,
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
|
|||||||
@ -102,8 +102,6 @@ $morehtmlref .= '</div>';
|
|||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|||||||
@ -37,6 +37,7 @@ if (!$user->rights->opensurvey->write) {
|
|||||||
$_SESSION["formatsondage"] = "D";
|
$_SESSION["formatsondage"] = "D";
|
||||||
|
|
||||||
$erreur = false;
|
$erreur = false;
|
||||||
|
$erreurNbchoice = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -49,114 +50,120 @@ if (GETPOST('confirmation')) {
|
|||||||
$nbofchoice = count($_SESSION["totalchoixjour"]);
|
$nbofchoice = count($_SESSION["totalchoixjour"]);
|
||||||
$errheure = array();
|
$errheure = array();
|
||||||
|
|
||||||
for ($i = 0; $i < $nbofchoice; $i++) {
|
if ($nbofchoice * $_SESSION["nbrecaseshoraires"] > 200) {
|
||||||
// Show hours choices
|
setEventMessages($langs->trans("ErrorFieldTooLong"), null, 'errors');
|
||||||
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
|
$erreurNb++;
|
||||||
$horairesi = GETPOST("horaires".$i);
|
} else {
|
||||||
$_SESSION["horaires$i"][$j] = $horairesi[$j];
|
for ($i = 0; $i < $nbofchoice; $i++) {
|
||||||
|
// Show hours choices
|
||||||
$tmphorairesi = GETPOST('horaires'.$i, 'array');
|
|
||||||
|
|
||||||
if (!is_array($tmphorairesi)) {
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A range like 8:00-11:00
|
|
||||||
$creneaux = array();
|
|
||||||
$heures = array();
|
|
||||||
if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) {
|
|
||||||
//on recupere les deux parties du preg_match qu'on redécoupe autour des ":"
|
|
||||||
$debutcreneau = explode(":", $creneaux[1]);
|
|
||||||
$fincreneau = explode(":", $creneaux[2]);
|
|
||||||
|
|
||||||
//comparaison des heures de fin et de debut
|
|
||||||
//si correctes, on entre les données dans la variables de session
|
|
||||||
if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00
|
|
||||||
//on recupere les deux parties du preg_match qu'on redécoupe autour des "H"
|
|
||||||
$debutcreneau = preg_split("/h/i", $creneaux[1]);
|
|
||||||
$fincreneau = preg_split("/h/i", $creneaux[2]);
|
|
||||||
|
|
||||||
//comparaison des heures de fin et de debut
|
|
||||||
//si correctes, on entre les données dans la variables de session
|
|
||||||
if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00
|
|
||||||
//si valeures correctes, on entre les données dans la variables de session
|
|
||||||
if ($heures[1] < 24 && $heures[2] < 60) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $heures[0];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h
|
|
||||||
//si valeures correctes, on entre les données dans la variables de session
|
|
||||||
if ($heures[1] < 24 && $heures[2] < 60) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $heures[0];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11
|
|
||||||
//si valeures correctes, on entre les données dans la variables de session
|
|
||||||
if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $heures[0];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h
|
|
||||||
//si valeures correctes, on entre les données dans la variables de session
|
|
||||||
if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) {
|
|
||||||
$_SESSION["horaires$i"][$j] = $heures[0];
|
|
||||||
} else { //sinon message d'erreur et nettoyage de la case
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
} elseif ($tmphorairesi[$j] == "") { //Si la case est vide
|
|
||||||
unset($_SESSION["horaires$i"][$j]);
|
|
||||||
} else { //pour tout autre format, message d'erreur
|
|
||||||
$errheure[$i][$j] = true;
|
|
||||||
$erreur = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) {
|
|
||||||
if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) {
|
|
||||||
$_SESSION["horaires$i"][$j] = '';
|
|
||||||
} else {
|
|
||||||
$_SESSION["horaires$i"] = array();
|
|
||||||
$_SESSION["horaires$i"][$j] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") {
|
|
||||||
$choixdate .= ",";
|
|
||||||
$choixdate .= $_SESSION["totalchoixjour"][$i];
|
|
||||||
} else {
|
|
||||||
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
|
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
|
||||||
if ($_SESSION["horaires$i"][$j] != "") {
|
$horairesi = GETPOST("horaires".$i);
|
||||||
$choixdate .= ",";
|
$_SESSION["horaires$i"][$j] = $horairesi[$j];
|
||||||
$choixdate .= $_SESSION["totalchoixjour"][$i];
|
|
||||||
$choixdate .= "@";
|
$tmphorairesi = GETPOST('horaires'.$i, 'array');
|
||||||
// On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite
|
|
||||||
$choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]);
|
if (!is_array($tmphorairesi)) {
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A range like 8:00-11:00
|
||||||
|
$creneaux = array();
|
||||||
|
$heures = array();
|
||||||
|
if (preg_match("/(\d{1,2}:\d{2})-(\d{1,2}:\d{2})/", $tmphorairesi[$j], $creneaux)) {
|
||||||
|
//on recupere les deux parties du preg_match qu'on redécoupe autour des ":"
|
||||||
|
$debutcreneau = explode(":", $creneaux[1]);
|
||||||
|
$fincreneau = explode(":", $creneaux[2]);
|
||||||
|
|
||||||
|
//comparaison des heures de fin et de debut
|
||||||
|
//si correctes, on entre les données dans la variables de session
|
||||||
|
if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif (preg_match(";^(\d{1,2}h\d{0,2})-(\d{1,2}h\d{0,2})$;i", $tmphorairesi[$j], $creneaux)) { //si c'est un creneau type 8h00-11h00
|
||||||
|
//on recupere les deux parties du preg_match qu'on redécoupe autour des "H"
|
||||||
|
$debutcreneau = preg_split("/h/i", $creneaux[1]);
|
||||||
|
$fincreneau = preg_split("/h/i", $creneaux[2]);
|
||||||
|
|
||||||
|
//comparaison des heures de fin et de debut
|
||||||
|
//si correctes, on entre les données dans la variables de session
|
||||||
|
if ($debutcreneau[0] < 24 && $fincreneau[0] < 24 && $debutcreneau[1] < 60 && $fincreneau[1] < 60 && ($debutcreneau[0] < $fincreneau[0] || ($debutcreneau[0] == $fincreneau[0] && $debutcreneau[1] < $fincreneau[1]))) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $creneaux[1].'-'.$creneaux[2];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif (preg_match(";^(\d{1,2}):(\d{2})$;", $tmphorairesi[$j], $heures)) { //si c'est une heure simple type 8:00
|
||||||
|
//si valeures correctes, on entre les données dans la variables de session
|
||||||
|
if ($heures[1] < 24 && $heures[2] < 60) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $heures[0];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif (preg_match(";^(\d{1,2})h(\d{0,2})$;i", $tmphorairesi[$j], $heures)) { //si c'est une heure encore plus simple type 8h
|
||||||
|
//si valeures correctes, on entre les données dans la variables de session
|
||||||
|
if ($heures[1] < 24 && $heures[2] < 60) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $heures[0];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif (preg_match(";^(\d{1,2})-(\d{1,2})$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau simple type 8-11
|
||||||
|
//si valeures correctes, on entre les données dans la variables de session
|
||||||
|
if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $heures[0];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif (preg_match(";^(\d{1,2})h-(\d{1,2})h$;", $tmphorairesi[$j], $heures)) { //si c'est un creneau H type 8h-11h
|
||||||
|
//si valeures correctes, on entre les données dans la variables de session
|
||||||
|
if ($heures[1] < $heures[2] && $heures[1] < 24 && $heures[2] < 24) {
|
||||||
|
$_SESSION["horaires$i"][$j] = $heures[0];
|
||||||
|
} else { //sinon message d'erreur et nettoyage de la case
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
} elseif ($tmphorairesi[$j] == "") { //Si la case est vide
|
||||||
|
unset($_SESSION["horaires$i"][$j]);
|
||||||
|
} else { //pour tout autre format, message d'erreur
|
||||||
|
$errheure[$i][$j] = true;
|
||||||
|
$erreur = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (issetAndNoEmpty('horaires'.$i, $_SESSION) === false || issetAndNoEmpty($j, $_SESSION['horaires'.$i]) === false) {
|
||||||
|
if (issetAndNoEmpty('horaires'.$i, $_SESSION) === true) {
|
||||||
|
$_SESSION["horaires$i"][$j] = '';
|
||||||
|
} else {
|
||||||
|
$_SESSION["horaires$i"] = array();
|
||||||
|
$_SESSION["horaires$i"][$j] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SESSION["horaires$i"][0] == "" && $_SESSION["horaires$i"][1] == "" && $_SESSION["horaires$i"][2] == "" && $_SESSION["horaires$i"][3] == "" && $_SESSION["horaires$i"][4] == "") {
|
||||||
|
$choixdate .= ",";
|
||||||
|
$choixdate .= $_SESSION["totalchoixjour"][$i];
|
||||||
|
} else {
|
||||||
|
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
|
||||||
|
if ($_SESSION["horaires$i"][$j] != "") {
|
||||||
|
$choixdate .= ",";
|
||||||
|
$choixdate .= $_SESSION["totalchoixjour"][$i];
|
||||||
|
$choixdate .= "@";
|
||||||
|
// On remplace la virgule et l'arobase pour ne pas avoir de problème par la suite
|
||||||
|
$choixdate .= str_replace(array(',', '@'), array(',', '@'), $_SESSION["horaires$i"][$j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!empty($errheure)) {
|
if (!empty($errheure)) {
|
||||||
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
|
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -170,7 +177,7 @@ if (GETPOST('confirmation')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add survey into database
|
// Add survey into database
|
||||||
if (!$erreur) {
|
if (!$erreur && $erreurNb == 0) {
|
||||||
$_SESSION["toutchoix"] = substr("$choixdate", 1);
|
$_SESSION["toutchoix"] = substr("$choixdate", 1);
|
||||||
|
|
||||||
ajouter_sondage();
|
ajouter_sondage();
|
||||||
|
|||||||
@ -114,10 +114,6 @@ llxHeader('', $langs->trans("Resource"));
|
|||||||
// View and edit mode
|
// View and edit mode
|
||||||
|
|
||||||
if ($id > 0 || !empty($ref)) {
|
if ($id > 0 || !empty($ref)) {
|
||||||
$soc = new Societe($db);
|
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
|
|
||||||
$head = resource_prepare_head($object);
|
$head = resource_prepare_head($object);
|
||||||
print dol_get_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), -1, 'resource');
|
print dol_get_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), -1, 'resource');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user