Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.9' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/fourn/class/fournisseur.commande.class.php
  • Loading branch information
eldy committed Feb 22, 2016
2 parents 2a60090 + a08fa81 commit f6d1913
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 32 deletions.
3 changes: 3 additions & 0 deletions htdocs/admin/tools/export.php
Expand Up @@ -200,9 +200,12 @@
$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;
Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -447,7 +447,7 @@ function getBannerAddress($htmlkey, $object)
{
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;
Expand Down Expand Up @@ -483,11 +483,11 @@ function getBannerAddress($htmlkey, $object)
$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?'<br>':'').$this->state;
$out.=($outdone?' - ':'').$this->state;
$outdone++;
}

Expand Down
9 changes: 4 additions & 5 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -1001,15 +1001,15 @@ 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;
// Zip/Town/State
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;
}
Expand All @@ -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;
}
Expand All @@ -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) : '';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -883,8 +883,8 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs)
$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");

Expand Down
20 changes: 9 additions & 11 deletions htdocs/fourn/class/fournisseur.commande.class.php
Expand Up @@ -149,7 +149,7 @@ function __construct($db)
$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';
}

Expand Down Expand Up @@ -611,8 +611,8 @@ function LibStatut($statut,$mode=0,$billed=0)
* 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='')
{
Expand Down Expand Up @@ -647,8 +647,8 @@ function getNomUrl($withpicto=0,$option='')
* 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)
{
Expand Down Expand Up @@ -742,7 +742,7 @@ function approve($user, $idwarehouse=0, $secondlevel=0)

$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);

Expand Down Expand Up @@ -930,7 +930,7 @@ function refuse($user)

/**
* 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).
Expand Down Expand Up @@ -1064,7 +1064,7 @@ function create($user, $notrigger=0)
$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 (";
Expand Down Expand Up @@ -1119,9 +1119,7 @@ function create($user, $notrigger=0)
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(
Expand Down
12 changes: 12 additions & 0 deletions htdocs/fourn/commande/card.php
Expand Up @@ -2859,6 +2859,18 @@
}
}

// 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
if (! empty($conf->facture->enabled))
{
Expand Down
19 changes: 11 additions & 8 deletions htdocs/product/stats/card.php
Expand Up @@ -193,16 +193,19 @@
//print '<table width="100%">';

// Generation des graphs
$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))
if ($object->id > 0) // We are on statistics for a dedicated product
{
if (dol_mkdir($dir.'/'.$object->id) < 0)
{
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
$error++;
}
$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))
{
if (dol_mkdir($dir.'/'.$object->id) < 0)
{
$mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
$error++;
}
}
}

$graphfiles=array(
'propal' =>array('modulepart'=>'productstats_proposals',
'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/list.php
Expand Up @@ -766,7 +766,7 @@
$arraystcomm=array();
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 '</td>';
Expand Down

0 comments on commit f6d1913

Please sign in to comment.