";
diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php
index 31a11f260f9..847b20783b2 100644
--- a/htdocs/admin/tools/dolibarr_export.php
+++ b/htdocs/admin/tools/dolibarr_export.php
@@ -50,7 +50,7 @@ if (! $user->admin)
if ($action == 'delete')
{
- $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
+ $file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php
index 8dbd7a1912e..4e85a4d3096 100644
--- a/htdocs/admin/tools/export.php
+++ b/htdocs/admin/tools/export.php
@@ -58,7 +58,7 @@ if ($file && ! $what)
if ($action == 'delete')
{
- $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile');
+ $file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
@@ -451,46 +451,53 @@ function backup_tables($outputfile, $tables='*')
//fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
$row2 = $db->fetch_row($resqldrop);
- fwrite($handle,$row2[1].";\n");
- //fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
-
-
- // Dumping the data (locking the table and disabling the keys check while doing the process)
- fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
- if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
- if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
-
- $sql='SELECT * FROM '.$table;
- $result = $db->query($sql);
- $num_fields = $db->num_rows($result);
- while($row = $db->fetch_row($result)) {
- // For each row of data we print a line of INSERT
- fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
- $columns = count($row);
- for($j=0; $j<$columns; $j++) {
- // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
- if ($row[$j] == null and !is_string($row[$j])) {
- // IMPORTANT: if the field is NULL we set it NULL
- $row[$j] = 'NULL';
- } elseif(is_string($row[$j]) and $row[$j] == '') {
- // if it's an empty string, we set it as an empty string
- $row[$j] = "''";
- } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
- // if it's a number, we return it as-is
- $row[$j] = $row[$j];
- } else { // else for all other cases we escape the value and put quotes around
- $row[$j] = addslashes($row[$j]);
- $row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
- $row[$j] = "'".$row[$j]."'";
- }
- }
- fwrite($handle,implode(',', $row).");\n");
+ if (empty($row2[1]))
+ {
+ fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
}
- if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
- if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
- fwrite($handle,"\n\n\n");
- }
+ else
+ {
+ fwrite($handle,$row2[1].";\n");
+ //fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
+ // Dumping the data (locking the table and disabling the keys check while doing the process)
+ fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
+ if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
+ if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
+
+ $sql='SELECT * FROM '.$table;
+ $result = $db->query($sql);
+ $num_fields = $db->num_rows($result);
+ while($row = $db->fetch_row($result))
+ {
+ // For each row of data we print a line of INSERT
+ fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
+ $columns = count($row);
+ for($j=0; $j<$columns; $j++) {
+ // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
+ if ($row[$j] == null and !is_string($row[$j])) {
+ // IMPORTANT: if the field is NULL we set it NULL
+ $row[$j] = 'NULL';
+ } elseif(is_string($row[$j]) and $row[$j] == '') {
+ // if it's an empty string, we set it as an empty string
+ $row[$j] = "''";
+ } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
+ // if it's a number, we return it as-is
+ $row[$j] = $row[$j];
+ } else { // else for all other cases we escape the value and put quotes around
+ $row[$j] = addslashes($row[$j]);
+ $row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
+ $row[$j] = "'".$row[$j]."'";
+ }
+ }
+ fwrite($handle,implode(',', $row).");\n");
+ }
+ if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
+ if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
+ fwrite($handle,"\n\n\n");
+ }
+ }
+
/* Backup Procedure structure*/
/*
$result = $db->query('SHOW PROCEDURE STATUS');
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 972cee73a76..2ed00894aa0 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -538,7 +538,7 @@ if ($action == 'create')
// Busy
print '
';
- }
- else dol_print_error($db);
-}
-
-
/**
* Social contributions to pay
*/
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 2d2466272e4..c788abeb48d 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1353,8 +1353,7 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
- $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code,
- $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
+ $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
$this->total = $this->total + $obj->somme;
$i++;
}
@@ -1545,10 +1544,9 @@ class BonPrelevement extends CommonObject
* @param string $row_bic rib.bic AS bic,
* @param string $row_datec soc.datec,
* @param string $row_drum soc.rowid AS drum
- * @retrun void
+ * @return void
*/
- function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc,
- $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
+ function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{
$CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac);
@@ -1663,6 +1661,11 @@ class BonPrelevement extends CommonObject
/**
* Write sender of request (me)
*
+ * @param string $configuration conf
+ * @param date $ladate Date
+ * @param int $nombre 0 or 1
+ * @param float $total Total
+ * @param string $CrLf End of line character
* @return SEPA
*/
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
@@ -1688,7 +1691,7 @@ class BonPrelevement extends CommonObject
$pays = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
$IdBon = sprintf("%05d", $obj->rowid);
$RefBon = $obj->ref;
- $type = (nombre == 1) ? 'FRST' : 'RCUR' ;
+ $type = ($nombre == 1) ? 'FRST' : 'RCUR' ;
// SEPA Paiement Information
$XML_SEPA_INFO = '';
$XML_SEPA_INFO .= ' '.$CrLf;
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 8693ff31b70..795d4b99e84 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -323,9 +323,9 @@ class ChargeSociales extends CommonObject
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
- function getLibStatut($mode=0,$alreadypayed=-1)
+ function getLibStatut($mode=0,$alreadypaid=-1)
{
- return $this->LibStatut($this->paye,$mode,$alreadypayed);
+ return $this->LibStatut($this->paye,$mode,$alreadypaid);
}
/**
@@ -336,7 +336,7 @@ class ChargeSociales extends CommonObject
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
- function LibStatut($statut,$mode=0,$alreadypayed=-1)
+ function LibStatut($statut,$mode=0,$alreadypaid=-1)
{
global $langs;
$langs->load('customers');
@@ -354,24 +354,26 @@ class ChargeSociales extends CommonObject
}
if ($mode == 2)
{
- if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
if ($mode == 3)
{
- if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1');
+ if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1');
+ if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6');
}
if ($mode == 4)
{
- if ($statut == 0 && $alreadypayed <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
- if ($statut == 0 && $alreadypayed > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
+ if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
+ if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
}
if ($mode == 5)
{
- if ($statut == 0 && $alreadypayed <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
- if ($statut == 0 && $alreadypayed > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
+ if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
+ if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
}
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 1d122a6c6f1..61ba7b062db 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -200,12 +200,12 @@ class Conf
}
//var_dump($this->modules);
//var_dump($this->modules_parts['theme']);
-
+
// If you can't set timezone of your PHP, set this constant. Better is to set it to UTC.
// In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore.
//$this->global->MAIN_SERVER_TZ='Europe/Paris';
if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') date_default_timezone_set($this->global->MAIN_SERVER_TZ);
-
+
// Object $mc
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
{
@@ -235,7 +235,15 @@ class Conf
if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php";
if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones
-
+ // Clean var use vat for company
+ if (! isset($conf->global->FACTURE_TVAOPTION)) $conf->global->FACTURE_TVAOPTION=1;
+ else if (! empty($conf->global->FACTURE_TVAOPTION) && ! is_numeric($conf->global->FACTURE_TVAOPTION))
+ {
+ // Old value of option, we clean to use new value (0 or 1)
+ if ($conf->global->FACTURE_TVAOPTION != "franchise") $conf->global->FACTURE_TVAOPTION=1;
+ else $conf->global->FACTURE_TVAOPTION=0;
+ }
+
// Variable globales LDAP
if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME='';
if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4b9f8c4cda0..6b73b7ba53a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -729,6 +729,7 @@ class Form
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
+ * @param int $limit Maximum number of elements
* @return string HTML string with
* @deprecated Use select_thirdparty instead
*/
@@ -2964,16 +2965,17 @@ class Form
}
/**
- * Show a form to select a date
+ * Show a form + html select a date
*
* @param string $page Page
* @param string $selected Date preselected
- * @param string $htmlname Name of input html field
+ * @param string $htmlname Html name of date input fields or 'none'
* @param int $displayhour Display hour selector
* @param int $displaymin Display minutes selector
* @return void
+ * @see select_date
*/
- function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0)
+ function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0)
{
global $langs;
@@ -3486,13 +3488,13 @@ class Form
/**
- * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes
+ * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes.
* Fields are preselected with :
- * - set_time date (Local PHP server timestamps or date format YYYY-MM-DD or YYYY-MM-DD HH:MM)
- * - local date of PHP server if set_time is ''
- * - Empty (fields empty) if set_time is -1 (in this case, parameter empty must also have value 1)
+ * - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM')
+ * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
+ * - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
*
- * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp)
+ * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date.
* @param string $prefix Prefix for fields name
* @param int $h 1=Show also hours
* @param int $m 1=Show also minutes
@@ -3504,6 +3506,7 @@ class Form
* @param int $disabled Disable input fields
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
* @return mixed Nothing or string if nooutput is 1
+ * @see form_date
*/
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowbutton=0, $nooutput=0, $disabled=0, $fullday='')
{
@@ -3516,7 +3519,11 @@ class Form
if($m == '') $m=0;
if($empty == '') $empty=0;
- if (! $set_time && $empty == 0) $set_time = dol_now('tzuser');
+ if ($set_time === '' && $empty == 0)
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ $set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone
+ }
// Analysis of the pre-selection date
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg))
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index aa0a422d91f..1c2af669bf9 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -721,7 +721,15 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if (!empty($obj->town)) $coords .= $obj->town;
if (!empty($obj->country_id)) $coords .= " ".$country_code['label'];
}
- print '';
+ else if (!empty($object->address))
+ {
+ $coords .= dol_nl2br($object->address,1,true)." ";
+ if (!empty($object->zip)) $coords .= $object->zip.' ';
+ if (!empty($object->town)) $coords .= $object->town;
+ if (!empty($object->country_id)) $coords .= " ".$country_code['label'];
+ }
+ // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
+ print '';
print img_picto($langs->trans("Address"), 'object_address.png');
print '';
}
@@ -733,7 +741,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '
+
we return GMT timestamp,
* 'tzserver' => we add the PHP server timezone
@@ -1073,7 +1073,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
*/
function dol_now($mode='gmt')
{
- // Note that gmmktime and mktime return same value (GMT) whithout parameters
+ // Note that gmmktime and mktime return same value (GMT) when used without parameters
//if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead
if ($mode == 'gmt') $ret=time(); // Time for now at greenwich.
else if ($mode == 'tzserver') // Time for now with PHP server timezone added
@@ -1088,7 +1088,7 @@ function dol_now($mode='gmt')
$tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time
$ret=dol_now('gmt')+($tzsecond*3600);
}*/
- else if ($mode == 'tzuser') // Time for now with user timezone is added
+ else if ($mode == 'tzuser') // Time for now with user timezone added
{
//print 'eeee'.time().'-'.mktime().'-'.gmmktime();
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index 296f509fd7e..ddc2b80f233 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -222,7 +222,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
else
{
- $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
+ $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
@@ -232,34 +232,24 @@ class doc_generic_order_odt extends ModelePDFCommandes
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
- $texte.= '