Maxi debug of 3.8. Nearly ready for freeze.

This commit is contained in:
Laurent Destailleur 2015-06-05 14:46:30 +02:00
parent 5e2d9efa07
commit a33241f487
11 changed files with 54 additions and 44 deletions

View File

@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$langs->load('companies');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
$langs->load('propal'); $langs->load('propal');
$langs->load('compta'); $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
$langs->load("companies");
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
@ -103,7 +104,7 @@ if ($id > 0 || ! empty($ref))
print "<tr><td>".$langs->trans("Company")."</td>"; print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>'; print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers // Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent); if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");

View File

@ -37,6 +37,7 @@ $langs->load('propal');
$langs->load('compta'); $langs->load('compta');
$langs->load('other'); $langs->load('other');
$langs->load("bills"); $langs->load("bills");
$langs->load('companies');
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility

View File

@ -36,6 +36,7 @@ if (!$user->rights->facture->lire) accessforbidden();
$langs->load("bills"); $langs->load("bills");
$langs->load("banks"); $langs->load("banks");
$langs->load("withdrawals"); $langs->load("withdrawals");
$langs->load('companies');
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
@ -396,7 +397,7 @@ if ($object->id > 0)
} }
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Montants // Montants
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_ht).'</td>'; print '<td align="right" colspan="2" class="nowrap">'.price($object->total_ht).'</td>';

View File

@ -3960,15 +3960,16 @@ abstract class CommonObject
* This function is meant to be called from replaceThirdparty with the appropiate tables * This function is meant to be called from replaceThirdparty with the appropiate tables
* Column name fk_soc MUST be used to identify thirdparties * Column name fk_soc MUST be used to identify thirdparties
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id (the thirdparty to delete)
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param array $tables Tables that need to be changed * @param array $tables Tables that need to be changed
* @return bool * @return bool
*/ */
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables) public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)
{ {
foreach ($tables as $table) { foreach ($tables as $table)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
if (!$db->query($sql)) { if (!$db->query($sql)) {

View File

@ -3092,7 +3092,7 @@ class Form
// Now add questions // Now add questions
$more.='<table class="paddingrightonly" width="100%">'."\n"; $more.='<table class="paddingrightonly" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n"; $more.='<tr><td colspan="3">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
if (is_array($input) && ! empty($input)) if (is_array($input) && ! empty($input))
@ -3101,15 +3101,15 @@ class Form
if ($input['type'] == 'text') if ($input['type'] == 'text')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'password') else if ($input['type'] == 'password')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'select') else if ($input['type'] == 'select')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
@ -3117,13 +3117,13 @@ class Form
else if ($input['type'] == 'checkbox') else if ($input['type'] == 'checkbox')
{ {
$more.='<tr>'; $more.='<tr>';
$more.='<td valign="top">'.$input['label'].' </td><td valign="top" align="left">'; $more.='<td>'.$input['label'].' </td><td align="left">';
$more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'; $more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked'; if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked';
if (is_bool($input['value']) && $input['value']) $more.=' checked'; if (is_bool($input['value']) && $input['value']) $more.=' checked';
if (isset($input['disabled'])) $more.=' disabled'; if (isset($input['disabled'])) $more.=' disabled';
$more.=' /></td>'; $more.=' /></td>';
$more.='<td valign="top" align="left">&nbsp;</td>'; $more.='<td align="left">&nbsp;</td>';
$more.='</tr>'."\n"; $more.='</tr>'."\n";
} }
else if ($input['type'] == 'radio') else if ($input['type'] == 'radio')
@ -3134,10 +3134,10 @@ class Form
$more.='<tr>'; $more.='<tr>';
if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>'; if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>';
else $more.='<td>&nbsp;</td>'; else $more.='<td>&nbsp;</td>';
$more.='<td valign="top" width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'; $more.='<td width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"';
if ($input['disabled']) $more.=' disabled'; if ($input['disabled']) $more.=' disabled';
$more.=' /></td>'; $more.=' /></td>';
$more.='<td valign="top" align="left">'; $more.='<td align="left">';
$more.=$selval; $more.=$selval;
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
$i++; $i++;
@ -3145,8 +3145,8 @@ class Form
} }
else if ($input['type'] == 'other') else if ($input['type'] == 'other')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td colspan="2" align="left">';
$more.=$input['value']; $more.=$input['value'];
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }

View File

@ -410,10 +410,10 @@ OutstandingBillReached=Reached max. for outstanding bill
MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0. MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.
LeopardNumRefModelDesc=The code is free. This code can be modified at any time. LeopardNumRefModelDesc=The code is free. This code can be modified at any time.
ManagingDirectors=Manager(s) name (CEO, director, president...) ManagingDirectors=Manager(s) name (CEO, director, president...)
SearchThirdparty=Search thirdparty SearchThirdparty=Search third party
SearchContact=Search contact SearchContact=Search contact
MergeOriginThirdparty=Origin thirdparty MergeOriginThirdparty=Duplicate third party (third party you want to delete)
MergeThirdparties=Merge thirdparties MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this thirdparty? All linked objects (invoices...) will be linked with the destination thirdparty ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be linked with the current third party so you will be able to delete the duplicate one.
ThirdpartiesMergeSuccess=Thirdparties have been merged ThirdpartiesMergeSuccess=Thirdparties have been merged
ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted. ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.

View File

@ -3915,9 +3915,9 @@ class Product extends CommonObject
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)

View File

@ -737,11 +737,11 @@ else
{ {
if ($userWrite > 0) if ($userWrite > 0)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a></div>';
} }
} }
@ -750,11 +750,11 @@ else
{ {
if ($userWrite > 0) if ($userWrite > 0)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a></div>';
} }
} }
@ -763,11 +763,11 @@ else
{ {
if ($userWrite > 0) if ($userWrite > 0)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=close">'.$langs->trans("Close").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=close">'.$langs->trans("Close").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Close').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Close').'</a></div>';
} }
} }
@ -776,11 +776,11 @@ else
{ {
if ($userWrite > 0) if ($userWrite > 0)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ReOpen').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ReOpen').'</a></div>';
} }
} }
@ -789,11 +789,11 @@ else
{ {
if ($userWrite > 0) if ($userWrite > 0)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&action=clone">'.$langs->trans('ToClone').'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=clone">'.$langs->trans('ToClone').'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ToClone').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ToClone').'</a></div>';
} }
} }
@ -802,11 +802,11 @@ else
{ {
if ($userDelete > 0) if ($userDelete > 0)
{ {
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a></div>';
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Delete').'</a>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Delete').'</a></div>';
} }
} }
} }

View File

@ -102,18 +102,23 @@ if (empty($reshook))
$soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin_id = GETPOST('soc_origin', 'int');
$soc_origin = new Societe($db); $soc_origin = new Societe($db);
if ($soc_origin_id < 1) { if ($soc_origin_id < 1)
{
$langs->load('errors'); $langs->load('errors');
$langs->load('companies'); $langs->load('companies');
setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), 'errors'); setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), 'errors');
} else { }
else
{
if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) { if (!$errors && $soc_origin->fetch($soc_origin_id) < 1)
{
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
$errors++; $errors++;
} }
if (!$errors) { if (!$errors)
{
$db->begin(); $db->begin();
$objects = array( $objects = array(
@ -141,8 +146,8 @@ if (empty($reshook))
); );
//First, all core objects must update their tables //First, all core objects must update their tables
foreach ($objects as $object_name => $object_file) { foreach ($objects as $object_name => $object_file)
{
require_once DOL_DOCUMENT_ROOT.$object_file; require_once DOL_DOCUMENT_ROOT.$object_file;
if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) { if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) {

View File

@ -1833,7 +1833,7 @@ div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border
div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col {
vertical-align: middle; vertical-align: middle;
} }
div.tabBar .tdtop { div .tdtop {
vertical-align: top; vertical-align: top;
padding-top: 5px; padding-top: 5px;
padding-bottom: 0px; padding-bottom: 0px;