Merge pull request #1202 from FHenry/develop

Fix from remark on https://github.com/Dolibarr/dolibarr/pull/1103
This commit is contained in:
Laurent Destailleur 2013-09-01 15:01:33 -07:00
commit 1ba382d7a6
10 changed files with 88 additions and 8 deletions

View File

@ -1521,6 +1521,10 @@ if ($action == 'create' && $user->rights->commande->creer)
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options=$objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
$ref_client = (!empty($objectsrc->ref_client)?$objectsrc->ref_client:'');

View File

@ -2022,6 +2022,10 @@ if ($action == 'create')
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options=$objectsrc->array_options;
}
}
else
@ -2174,7 +2178,7 @@ if ($action == 'create')
print '</td></tr>'."\n";
}
if ((empty($origin)) || (($origin=='propal') && (!empty($originid))))
if ((empty($origin)) || ((($origin=='propal') || ($origin=='commande')) && (!empty($originid))))
{
// Deposit
print '<tr height="18"><td width="16px" valign="middle">';
@ -2182,7 +2186,7 @@ if ($action == 'create')
print '</td><td valign="middle" class="nowrap">';
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print '<table class="nobordernopadding"><tr><td>'.$desc.'</td>';
if (($origin=='propal') ) {
if (($origin=='propal') || ($origin=='commande')) {
print '<td><select name="typedeposit"><option value="amount">'.$langs->trans('FixAmount').'</option>';
print '<option value="variable">'.$langs->trans('VarAmount').'</option></select></td>';
print '<td>'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';

View File

@ -800,7 +800,21 @@ class Form
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$label=$obj->nom;
if ($conf->global->SOCIETE_ADD_REF_IN_LIST) {
if (($obj->client) && (!empty($obj->code_client))) {
$label = $obj->code_client. ' - ';
}
if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
$label .= $obj->code_fournisseur. ' - ';
}
$label.=' '.$obj->nom;
}
else
{
$label=$obj->nom;
}
if ($showtype)
{
if ($obj->client || $obj->fournisseur) $label.=' (';

View File

@ -124,6 +124,13 @@ class modSociete extends DolibarrModules
$this->const[$r][4] = 1;
$r++;
*/
$this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST";
$this->const[$r][1] = "yesno";
$this->const[$r][2] = "0";
$this->const[$r][3] = "Display customer ref into select list";
$this->const[$r][4] = 0;
$r++;
// Boxes
$this->boxes = array();

View File

@ -72,10 +72,11 @@ class mod_task_simple extends ModeleNumRefTask
$coyymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task";
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
$sql.= " AND entity = ".$conf->entity;
$sql = "SELECT MAX(SUBSTRING(task.ref FROM " . $posindice . ")) as max";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS task, ";
$sql .= MAIN_DB_PREFIX . "projet AS project WHERE task.fk_projet=project.rowid";
$sql .= " AND task.ref LIKE '" . $this->prefix . "____-%'";
$sql .= " AND project.entity = " . $conf->entity;
$resql=$db->query($sql);
if ($resql)
{

View File

@ -220,7 +220,12 @@ class Export
if ($i > 0) $sql.=', ';
else $i++;
$newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);;
if (strpos($key, ' as ')===false) {
$newfield=$key.' as '.str_replace(array('.', '-'),'_',$key);
} else {
$newfield=$key;
}
$sql.=$newfield;
}

View File

@ -1002,6 +1002,7 @@ BrowserIsOK=You are using the web browser %s. This browser is ok for security an
BrowserIsKO=You are using the web browser %s. This browser is known to be a bad choice for security, performance and reliability. We recommand you to use Firefox, Chrome, Opera or Safari.
XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache is loaded.
AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink
##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.

View File

@ -1002,6 +1002,7 @@ BrowserIsOK=Vous utilisez le navigateur %s. Ce navigateur est réputé optimisé
BrowserIsKO=Vous utilisez le navigateur %s. Ce navigateur est déconseillé pour des raisons de sécurité, performance et qualité des pages restituées. Nous vous recommandons d'utiliser Firefox, Chrome, Opera ou Safari.
XDebugInstalled=XDebug est chargé.
XCacheInstalled=XCache est chargé.
AddRefInList=Affiché le code client/fournisseur dans les liste (déroulante ou autocomplétion) et dans la pluspart des hyperliens
##### Module password generation
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.

View File

@ -211,6 +211,22 @@ if ($action == 'setprofid')
}
}
//Activate Set ref in list
if ($action=="setaddrefinlist") {
$setaddrefinlist = GETPOST('value','int');
$res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
//Activate ProfId mandatory
if ($action == 'setprofidmandatory')
{
@ -717,6 +733,23 @@ else
print '</tr>';
print '</form>';
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="80%">'.$langs->trans("AddRefInList").'</td>';
if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST))
{
print '<td align="center" colspan="2"><a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
print '</a></td>';
}
else
{
print '<td align="center" colspan="2"><a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '</tr>';
$var=!$var;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';

View File

@ -1433,6 +1433,16 @@ class Societe extends CommonObject
$name=$this->name?$this->name:$this->nom;
if ($conf->global->SOCIETE_ADD_REF_IN_LIST) {
if (($this->client) && (! empty ( $this->code_client ))) {
$code = $this->code_client . ' - ';
}
if (($this->fournisseur) && (! empty ( $this->code_fournisseur ))) {
$code .= $this->code_fournisseur . ' - ';
}
$name =$code.' '.$name;
}
$result='';
$lien=$lienfin='';