mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge remote-tracking branch 'Dolibarr/13.0' into 13
This commit is contained in:
commit
d4b405038e
|
|
@ -555,7 +555,7 @@ class AccountancyExport
|
|||
$Tab['signe_montant'] = '+';
|
||||
|
||||
// The amount must be in centimes without decimal points.
|
||||
$Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['montant'] = str_pad(abs(($data->debit - $data->credit) * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// Force date format : %d%m%y
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ foreach ($dirmodels as $reldir)
|
|||
{
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmo&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -616,6 +616,10 @@ class AdvanceTargetingMailing extends CommonObject
|
|||
if ($arrayquery['options_'.$key] != '') {
|
||||
$sqlwhere[] = " (te.".$key." = ".$arrayquery['options_'.$key].")";
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
||||
if ($arrayquery['options_'.$key] > 0) {
|
||||
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
|
||||
}
|
||||
} else {
|
||||
if (is_array($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[] = " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
|
||||
|
|
@ -642,7 +646,6 @@ class AdvanceTargetingMailing extends CommonObject
|
|||
if ($num) {
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->thirdparty_lines[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -285,9 +285,29 @@ if (empty($reshook))
|
|||
} elseif ($action == 'setecheance' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->model_pdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'setdate_livraison' && $usercancreate)
|
||||
{
|
||||
$result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear']));
|
||||
|
|
|
|||
|
|
@ -119,8 +119,11 @@ $usercancreate = $user->rights->facture->creer;
|
|||
$usercanissuepayment = $user->rights->facture->paiement;
|
||||
$usercandelete = $user->rights->facture->supprimer;
|
||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate)));
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send);
|
||||
$usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->reopen);
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send)));
|
||||
$usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen)));
|
||||
if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
|
||||
$usercanreopen = false;
|
||||
}
|
||||
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
|
||||
|
||||
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
|
||||
|
|
@ -189,7 +192,7 @@ if (empty($reshook))
|
|||
$action = '';
|
||||
}
|
||||
} // Change status of invoice
|
||||
elseif ($action == 'reopen' && $usercancreate) {
|
||||
elseif ($action == 'reopen' && $usercanreopen) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
|
||||
|
|
|
|||
|
|
@ -111,29 +111,69 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
|
|||
$db->commit();
|
||||
|
||||
// Loop on each invoice linked to this payment to rebuild PDF
|
||||
$factures = array();
|
||||
foreach ($factures as $id)
|
||||
{
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($id);
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
if (GETPOST('lang_id', 'aZ09')) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
|
||||
}
|
||||
|
||||
$outputlangs = $langs;
|
||||
if (!empty($_REQUEST['lang_id']))
|
||||
{
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$fac->generateDocument($fac->modelpdf, $outputlangs);
|
||||
}
|
||||
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
||||
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
||||
|
||||
$sql = 'SELECT f.rowid as facid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= ' WHERE pf.fk_facture = f.rowid';
|
||||
$sql .= ' AND f.fk_soc = s.rowid';
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
$sql .= ' AND pf.fk_paiement = '.$object->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$invoice = new Facture($db);
|
||||
|
||||
if ($invoice->fetch($objp->facid) <= 0) {
|
||||
$errors++;
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
|
||||
$errors++;
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
$errors++;
|
||||
setEventMessages($db->error, $db->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
exit;
|
||||
if (! $errors) {
|
||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -423,8 +423,13 @@ class Paiement extends CommonObject
|
|||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
||||
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
||||
|
||||
$ret = $invoice->fetch($facid); // Reload to get new records
|
||||
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
|
||||
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) {
|
||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class FormFile
|
|||
$out .= "\n</div><!-- End form link new url -->\n";
|
||||
}
|
||||
|
||||
$parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm);
|
||||
$parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm, 'options'=>$options);
|
||||
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
|
||||
if (empty($res))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1991,19 +1991,15 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
// Clean parameters
|
||||
$to_gmt = false;
|
||||
$offsettz = $offsetdst = 0;
|
||||
if ($tzoutput)
|
||||
{
|
||||
if ($tzoutput) {
|
||||
$to_gmt = true; // For backward compatibility
|
||||
if (is_string($tzoutput))
|
||||
{
|
||||
if ($tzoutput == 'tzserver')
|
||||
{
|
||||
if (is_string($tzoutput)) {
|
||||
if ($tzoutput == 'tzserver') {
|
||||
$to_gmt = false;
|
||||
$offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
$offsettz = 0;
|
||||
$offsetdst = 0;
|
||||
} elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel')
|
||||
{
|
||||
$offsettz = 0; // Timezone offset with server timezone, so 0
|
||||
$offsetdst = 0; // Dst offset with server timezone, so 0
|
||||
} elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
|
||||
$to_gmt = true;
|
||||
$offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
|
||||
|
|
@ -2011,54 +2007,77 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!is_object($outputlangs)) $outputlangs = $langs;
|
||||
if (!$format) $format = 'daytextshort';
|
||||
if (!is_object($outputlangs)) {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
if (!$format) {
|
||||
$format = 'daytextshort';
|
||||
}
|
||||
|
||||
// Do we have to reduce the length of date (year on 2 chars) to save space.
|
||||
// Note: dayinputnoreduce is same than day but no reduction of year length will be done
|
||||
$reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param.
|
||||
$format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day
|
||||
$formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
|
||||
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day
|
||||
if ($formatwithoutreduce != $format) {
|
||||
$format = $formatwithoutreduce;
|
||||
$reduceformat = 1;
|
||||
} // so format 'dayreduceformat' is processed like day
|
||||
|
||||
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
||||
// TODO Add format daysmallyear and dayhoursmallyear
|
||||
if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
|
||||
elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short);
|
||||
elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration);
|
||||
elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text);
|
||||
elseif ($format == 'daytextshort') $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short);
|
||||
elseif ($format == 'dayhour') $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short);
|
||||
elseif ($format == 'dayhoursec') $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short);
|
||||
elseif ($format == 'dayhourtext') $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text);
|
||||
elseif ($format == 'dayhourtextshort') $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short);
|
||||
// Format not sensitive to language
|
||||
elseif ($format == 'dayhourlog') $format = '%Y%m%d%H%M%S';
|
||||
elseif ($format == 'dayhourldap') $format = '%Y%m%d%H%M%SZ';
|
||||
elseif ($format == 'dayhourxcard') $format = '%Y%m%dT%H%M%SZ';
|
||||
elseif ($format == 'dayxcard') $format = '%Y%m%d';
|
||||
elseif ($format == 'dayrfc') $format = '%Y-%m-%d'; // DATE_RFC3339
|
||||
elseif ($format == 'dayhourrfc') $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339
|
||||
elseif ($format == 'standard') $format = '%Y-%m-%d %H:%M:%S';
|
||||
if ($format == 'day') {
|
||||
$format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
|
||||
} elseif ($format == 'hour') {
|
||||
$format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short);
|
||||
} elseif ($format == 'hourduration') {
|
||||
$format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration);
|
||||
} elseif ($format == 'daytext') {
|
||||
$format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text);
|
||||
} elseif ($format == 'daytextshort') {
|
||||
$format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short);
|
||||
} elseif ($format == 'dayhour') {
|
||||
$format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short);
|
||||
} elseif ($format == 'dayhoursec') {
|
||||
$format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short);
|
||||
} elseif ($format == 'dayhourtext') {
|
||||
$format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text);
|
||||
} elseif ($format == 'dayhourtextshort') {
|
||||
$format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short);
|
||||
} elseif ($format == 'dayhourlog') {
|
||||
// Format not sensitive to language
|
||||
$format = '%Y%m%d%H%M%S';
|
||||
} elseif ($format == 'dayhourldap') {
|
||||
$format = '%Y%m%d%H%M%SZ';
|
||||
} elseif ($format == 'dayhourxcard') {
|
||||
$format = '%Y%m%dT%H%M%SZ';
|
||||
} elseif ($format == 'dayxcard') {
|
||||
$format = '%Y%m%d';
|
||||
} elseif ($format == 'dayrfc') {
|
||||
$format = '%Y-%m-%d'; // DATE_RFC3339
|
||||
} elseif ($format == 'dayhourrfc') {
|
||||
$format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339
|
||||
} elseif ($format == 'standard') {
|
||||
$format = '%Y-%m-%d %H:%M:%S';
|
||||
}
|
||||
|
||||
if ($reduceformat)
|
||||
{
|
||||
if ($reduceformat) {
|
||||
$format = str_replace('%Y', '%y', $format);
|
||||
$format = str_replace('yyyy', 'yy', $format);
|
||||
}
|
||||
|
||||
// If date undefined or "", we return ""
|
||||
if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
|
||||
if (dol_strlen($time) == 0) {
|
||||
return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
|
||||
}
|
||||
|
||||
// Clean format
|
||||
if (preg_match('/%b/i', $format)) // There is some text to translate
|
||||
{
|
||||
if (preg_match('/%b/i', $format)) { // There is some text to translate
|
||||
// We inhibate translation to text made by strftime functions. We will use trans instead later.
|
||||
$format = str_replace('%b', '__b__', $format);
|
||||
$format = str_replace('%B', '__B__', $format);
|
||||
}
|
||||
if (preg_match('/%a/i', $format)) // There is some text to translate
|
||||
{
|
||||
if (preg_match('/%a/i', $format)) { // There is some text to translate
|
||||
// We inhibate translation to text made by strftime functions. We will use trans instead later.
|
||||
$format = str_replace('%a', '__a__', $format);
|
||||
$format = str_replace('%A', '__A__', $format);
|
||||
|
|
@ -2067,13 +2086,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
|
||||
// Analyze date
|
||||
$reg = array();
|
||||
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
{
|
||||
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
|
||||
return '';
|
||||
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) // Still available to solve problems in extrafields of type date
|
||||
{
|
||||
// This part of code should not be used.
|
||||
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date
|
||||
// This part of code should not be used anymore.
|
||||
dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||
|
|
@ -2088,23 +2105,22 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
$ret = adodb_strftime($format, $time + $offsettz + $offsetdst, $to_gmt);
|
||||
} else {
|
||||
// Date is a timestamps
|
||||
if ($time < 100000000000) // Protection against bad date values
|
||||
{
|
||||
if ($time < 100000000000) { // Protection against bad date values
|
||||
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$ret = adodb_strftime($format, $timetouse, $to_gmt);
|
||||
} else $ret = 'Bad value '.$time.' for date';
|
||||
$ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
|
||||
} else {
|
||||
$ret = 'Bad value '.$time.' for date';
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/__b__/i', $format))
|
||||
{
|
||||
if (preg_match('/__b__/i', $format)) {
|
||||
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month = adodb_strftime('%m', $timetouse);
|
||||
$month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
|
||||
$month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
if ($encodetooutput) {
|
||||
$monthtext = $outputlangs->transnoentities('Month'.$month);
|
||||
$monthtextshort = $outputlangs->transnoentities('MonthShort'.$month);
|
||||
} else {
|
||||
|
|
@ -2117,11 +2133,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
|
|||
//print 'x'.$outputlangs->charset_output.'-'.$ret.'x';
|
||||
//return $ret;
|
||||
}
|
||||
if (preg_match('/__a__/i', $format))
|
||||
{
|
||||
if (preg_match('/__a__/i', $format)) {
|
||||
//print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring";
|
||||
$timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server
|
||||
$dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w);
|
||||
$ret = str_replace('__A__', $dayweek, $ret);
|
||||
$ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
|
||||
|
|
|
|||
|
|
@ -223,6 +223,10 @@ if (!empty($conf->contrat->enabled)) {
|
|||
}
|
||||
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 (f.rowid = ef.fk_object)";
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if (!$user->rights->societe->client->voir && empty($socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
|
|
|
|||
4
htdocs/modulebuilder/template/.gitignore
vendored
4
htdocs/modulebuilder/template/.gitignore
vendored
|
|
@ -15,4 +15,6 @@
|
|||
/.buildpath
|
||||
/.project
|
||||
# Other
|
||||
*.back
|
||||
*.back
|
||||
/.editorconfig
|
||||
/.gitattributes
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ if (empty($reshook))
|
|||
$object->fk_parent = (int) GETPOST("fk_parent", "int");
|
||||
$object->label = (string) GETPOST("libelle", "alpha");
|
||||
$object->description = (string) GETPOST("desc", "alpha");
|
||||
$object->statut = GETPOST("statut");
|
||||
$object->statut = GETPOST("statut", "int");
|
||||
$object->lieu = (string) GETPOST("lieu", "alpha");
|
||||
$object->address = (string) GETPOST("address", "alpha");
|
||||
$object->zip = (string) GETPOST("zipcode", "alpha");
|
||||
|
|
@ -160,7 +160,7 @@ if (empty($reshook))
|
|||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->label = GETPOST("libelle");
|
||||
$object->label = GETPOST("libelle");
|
||||
$object->fk_parent = GETPOST("fk_parent");
|
||||
$object->description = GETPOST("desc");
|
||||
$object->statut = GETPOST("statut");
|
||||
|
|
@ -169,8 +169,8 @@ if (empty($reshook))
|
|||
$object->zip = GETPOST("zipcode");
|
||||
$object->town = GETPOST("town");
|
||||
$object->country_id = GETPOST("country_id");
|
||||
$object->phone = GETPOST("phone");
|
||||
$object->fax = GETPOST("fax");
|
||||
$object->phone = GETPOST("phone");
|
||||
$object->fax = GETPOST("fax");
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
|
|
|
|||
|
|
@ -208,9 +208,12 @@ if (empty($reshook) && $action == 'add') {
|
|||
$error++;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
|
||||
}
|
||||
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && empty(GETPOST('email'))) {
|
||||
$error++;
|
||||
$errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."<br>\n";
|
||||
} elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
||||
$langs->load('errors');
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
||||
}
|
||||
$birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
|
||||
|
|
@ -586,7 +589,7 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
|||
print '</td></tr>';
|
||||
}
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
||||
|
|
|
|||
|
|
@ -770,8 +770,8 @@ if ($action == 'create')
|
|||
$langs->load("projects");
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -534,7 +534,7 @@ class ProductCombination
|
|||
$new_price += $variation_price;
|
||||
}
|
||||
|
||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq);
|
||||
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user