Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/fourn/class/fournisseur.commande.class.php
This commit is contained in:
Laurent Destailleur 2016-02-22 13:35:46 +01:00
commit f6d1913bb7
8 changed files with 47 additions and 32 deletions

View File

@ -200,9 +200,12 @@ if ($what == 'mysql')
$ok=0; $ok=0;
dol_syslog("Run command ".$fullcommandcrypted); dol_syslog("Run command ".$fullcommandcrypted);
$handlein = popen($fullcommandclear, 'r'); $handlein = popen($fullcommandclear, 'r');
$i=0;
while (!feof($handlein)) while (!feof($handlein))
{ {
$i++; // output line number
$read = fgets($handlein); $read = fgets($handlein);
if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue;
fwrite($handle,$read); fwrite($handle,$read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; 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; elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;

View File

@ -447,7 +447,7 @@ abstract class CommonObject
{ {
global $conf, $langs; 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; $contactid=0;
$thirdpartyid=0; $thirdpartyid=0;
@ -484,10 +484,10 @@ abstract class CommonObject
$outdone++; $outdone++;
} }
if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) 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) && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{ {
$out.=($outdone?'<br>':'').$this->state; $out.=($outdone?' - ':'').$this->state;
$outdone++; $outdone++;
} }

View File

@ -1001,7 +1001,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
global $conf,$langs; global $conf,$langs;
$ret=''; $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 // Address
$ret .= $object->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 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; $ret .= ($ret ? $sep : '' ).$object->town;
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state)
{ {
$ret.=", ".$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 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; $ret .= ($ret ? $sep : '' ).$object->town;
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state)
{ {
$ret.=", ".$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 .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):''); $ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state)
{ {
$ret.="\n".$object->state; $ret.="\n".$object->state;
} }
} }
else // Other: title firstname name \n address lines \n zip town \n country else // Other: title firstname name \n address lines \n zip town \n country
{ {
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : ''; $ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';

View File

@ -883,8 +883,8 @@ class pdf_crabe extends ModelePDFFactures
$this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"); $this->error = $outputlangs->transnoentities("ErrorNoPaiementModeConfigured");
} }
// Avoid having any valid PDF with setup that is not complete // Avoid having any valid PDF with setup that is not complete
elseif (($object->mode_reglement_code == 'CHQ' && empty($conf->global->FACTURE_CHQ_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))) || ($object->mode_reglement_code == 'VIR' && empty($conf->global->FACTURE_RIB_NUMBER) && empty($object->fk_account) && empty($object->fk_bank)))
{ {
$outputlangs->load("errors"); $outputlangs->load("errors");

View File

@ -149,7 +149,7 @@ class CommandeFournisseur extends CommonOrder
$this->statuts[5] = 'StatusOrderReceivedAll'; $this->statuts[5] = 'StatusOrderReceivedAll';
$this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled $this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled
$this->statuts[7] = 'StatusOrderCanceled'; // Process running->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'; $this->statuts[9] = 'StatusOrderRefused';
} }
@ -611,8 +611,8 @@ class CommandeFournisseur extends CommonOrder
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien * @param string $option On what the link points
* @return string Chaine avec URL * @return string Chain with URL
*/ */
function getNomUrl($withpicto=0,$option='') 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 * Returns the following order reference not used depending on the numbering model activated
* defined within COMMANDE_SUPPLIER_ADDON_NUMBER * defined within COMMANDE_SUPPLIER_ADDON_NUMBER
* *
* @param Societe $soc objet societe * @param Societe $soc company object
* @return string reference libre pour la facture * @return string free reference for the invoice
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)
{ {
@ -742,7 +742,7 @@ class CommandeFournisseur extends CommonOrder
$this->db->begin(); $this->db->begin();
// Definition du nom de modele de numerotation de commande // Definition of order numbering model name
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->fetch($this->fourn_id); $soc->fetch($this->fourn_id);
@ -930,7 +930,7 @@ class CommandeFournisseur extends CommonOrder
/** /**
* Cancel an approved order. * Cancel an approved order.
* L'annulation se fait apres l'approbation * The cancellation is done after approval
* *
* @param User $user User making action * @param User $user User making action
* @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders). * @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; $this->multicurrency_tx = 1;
} }
/* On positionne en mode brouillon la commande */ // We set order into draft status
$this->brouillon = 1; $this->brouillon = 1;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
@ -1119,9 +1119,7 @@ class CommandeFournisseur extends CommonOrder
if ($this->id) { if ($this->id) {
$num=count($this->lines); $num=count($this->lines);
/* // insert products details into database
* Insertion du detail des produits dans la base
*/
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$result = $this->addline( $result = $this->addline(

View File

@ -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 '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/dispatch.php?id=' . $object->id . '">' . $langs->trans('OrderDispatch') . '</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('OrderDispatch') . '</a></div>';
}
}
}
// Create bill // Create bill
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {

View File

@ -193,14 +193,17 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
//print '<table width="100%">'; //print '<table width="100%">';
// Generation des graphs // Generation des graphs
$dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if ($object->id > 0) // We are on statistics for a dedicated product
if (! file_exists($dir.'/'.$object->id))
{ {
if (dol_mkdir($dir.'/'.$object->id) < 0) $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]);
{ if (! file_exists($dir.'/'.$object->id))
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir); {
$error++; if (dol_mkdir($dir.'/'.$object->id) < 0)
} {
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
$error++;
}
}
} }
$graphfiles=array( $graphfiles=array(

View File

@ -766,7 +766,7 @@ if ($resql)
$arraystcomm=array(); $arraystcomm=array();
foreach($prospectstatic->cacheprospectstatus as $key => $val) foreach($prospectstatic->cacheprospectstatus as $key => $val)
{ {
$arraystcomm[$val['id']]=$val['label']; $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
} }
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
print '</td>'; print '</td>';