diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php
index 3cfb3baf496..224ca245734 100644
--- a/htdocs/admin/tools/export.php
+++ b/htdocs/admin/tools/export.php
@@ -200,9 +200,12 @@ if ($what == 'mysql')
$ok=0;
dol_syslog("Run command ".$fullcommandcrypted);
$handlein = popen($fullcommandclear, 'r');
+ $i=0;
while (!feof($handlein))
{
+ $i++; // output line number
$read = fgets($handlein);
+ if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue;
fwrite($handle,$read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index c3d9cd56b90..24216072cd7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -447,7 +447,7 @@ abstract class CommonObject
{
global $conf, $langs;
- $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
+ $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS
$contactid=0;
$thirdpartyid=0;
@@ -483,11 +483,11 @@ abstract class CommonObject
$out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++;
$outdone++;
}
-
- if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
- && ! empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
+
+ if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
+ && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{
- $out.=($outdone?'
':'').$this->state;
+ $out.=($outdone?' - ':'').$this->state;
$outdone++;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 2538bf9d0b7..e81ffecf83c 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1001,7 +1001,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
global $conf,$langs;
$ret='';
- $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
+ $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
// Address
$ret .= $object->address;
@@ -1009,7 +1009,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
if (in_array($object->country_code,array('US','AU')) || ! empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country
{
$ret .= ($ret ? $sep : '' ).$object->town;
- if ($object->state && in_array($object->country_code,$countriesusingstate))
+ if ($object->state)
{
$ret.=", ".$object->state;
}
@@ -1018,7 +1018,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else if (in_array($object->country_code,array('GB','UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country
{
$ret .= ($ret ? $sep : '' ).$object->town;
- if ($object->state && in_array($object->country_code,$countriesusingstate))
+ if ($object->state)
{
$ret.=", ".$object->state;
}
@@ -1028,12 +1028,11 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
{
$ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
- if ($object->state && in_array($object->country_code,$countriesusingstate))
+ if ($object->state)
{
$ret.="\n".$object->state;
}
}
-
else // Other: title firstname name \n address lines \n zip town \n country
{
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 05967be09d6..030a67a1c58 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -883,8 +883,8 @@ class pdf_crabe extends ModelePDFFactures
$this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured");
}
// Avoid having any valid PDF with setup that is not complete
- elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER))
- || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER)))
+ elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_NUMBER) && empty($object->fk_account) && empty($object->fk_bank))
+ || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank)))
{
$outputlangs->load("errors");
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 06b2f8372a6..c3f21a15f4c 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -149,7 +149,7 @@ class CommandeFournisseur extends CommonOrder
$this->statuts[5] = 'StatusOrderReceivedAll';
$this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled
$this->statuts[7] = 'StatusOrderCanceled'; // Process running->canceled
- //$this->statuts[8] = 'StatusOrderBilled'; // Everything is finish, order received totally and bill received
+ //$this->statuts[8] = 'StatusOrderBilled'; // Everything is finished, order received totally and bill received
$this->statuts[9] = 'StatusOrderRefused';
}
@@ -611,8 +611,8 @@ class CommandeFournisseur extends CommonOrder
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param string $option Sur quoi pointe le lien
- * @return string Chaine avec URL
+ * @param string $option On what the link points
+ * @return string Chain with URL
*/
function getNomUrl($withpicto=0,$option='')
{
@@ -647,8 +647,8 @@ class CommandeFournisseur extends CommonOrder
* Returns the following order reference not used depending on the numbering model activated
* defined within COMMANDE_SUPPLIER_ADDON_NUMBER
*
- * @param Societe $soc objet societe
- * @return string reference libre pour la facture
+ * @param Societe $soc company object
+ * @return string free reference for the invoice
*/
function getNextNumRef($soc)
{
@@ -742,7 +742,7 @@ class CommandeFournisseur extends CommonOrder
$this->db->begin();
- // Definition du nom de modele de numerotation de commande
+ // Definition of order numbering model name
$soc = new Societe($this->db);
$soc->fetch($this->fourn_id);
@@ -930,7 +930,7 @@ class CommandeFournisseur extends CommonOrder
/**
* Cancel an approved order.
- * L'annulation se fait apres l'approbation
+ * The cancellation is done after approval
*
* @param User $user User making action
* @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders).
@@ -1064,7 +1064,7 @@ class CommandeFournisseur extends CommonOrder
$this->multicurrency_tx = 1;
}
- /* On positionne en mode brouillon la commande */
+ // We set order into draft status
$this->brouillon = 1;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
@@ -1119,9 +1119,7 @@ class CommandeFournisseur extends CommonOrder
if ($this->id) {
$num=count($this->lines);
- /*
- * Insertion du detail des produits dans la base
- */
+ // insert products details into database
for ($i=0;$i<$num;$i++)
{
$result = $this->addline(
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 200856acdc6..a53bcb78d80 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2859,6 +2859,18 @@ elseif (! empty($object->id))
}
}
+ // Ship
+ if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
+ {
+ if (in_array($object->statut, array(3,4))) {
+ if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) {
+ print '