Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-09-02 00:34:55 +02:00
commit e6611b6ba1
14 changed files with 229 additions and 31 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

@ -95,10 +95,10 @@ class box_graph_product_distribution extends ModeleBoxes
$nowarray=dol_getdate(dol_now(),true);
$year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$nbofgraph=0;
if ($showinvoicenb) $nbofgraph++;
if ($showpropalnb) $nbofgraph++;
if ($showordernb) $nbofgraph++;
$nbofgraph=0;
if ($showinvoicenb) $nbofgraph++;
if ($showpropalnb) $nbofgraph++;
if ($showordernb) $nbofgraph++;
$paramtitle=$langs->trans("Products").'/'.$langs->trans("Services");
if (empty($conf->produit->enabled)) $paramtitle=$langs->trans("Services");
@ -322,18 +322,18 @@ class box_graph_product_distribution extends ModeleBoxes
$stringtoshow.='<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
if ($showinvoicenb) $stringtoshow.=$px1->show();
else if ($showpropalnb) $stringtoshow.=$px2->show();
$stringtoshow.='</div><div class="fichehalfright">';
$stringtoshow.='</div><div class="fichehalfright">';
if ($showordernb) $stringtoshow.=$px3->show();
else if ($showpropalnb) $stringtoshow.=$px2->show();
$stringtoshow.='</div></div></div>';
$stringtoshow.='</div></div></div>';
}
if ($nbofgraph == 3)
if ($nbofgraph == 3)
{
$stringtoshow.='<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
$stringtoshow.=$px1->show();
$stringtoshow.='</div><div class="fichehalfright">';
$stringtoshow.=$px2->show();
$stringtoshow.='</div></div></div>';
$stringtoshow.='<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
$stringtoshow.=$px1->show();
$stringtoshow.='</div><div class="fichehalfright">';
$stringtoshow.=$px2->show();
$stringtoshow.='</div></div></div>';
$stringtoshow.='<div class="fichecenter"><div class="containercenter">';
$stringtoshow.=$px3->show();
$stringtoshow.='</div></div>';

View File

@ -244,15 +244,15 @@ class DolGraph
$this->data = $data;
}
/**
* Set data
*
* @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...)
* @return void
*/
function SetDataColor($datacolor)
{
$this->datacolor = $datacolor;
/**
* Set data
*
* @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...)
* @return void
*/
function SetDataColor($datacolor)
{
$this->datacolor = $datacolor;
}
/**

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

@ -199,3 +199,5 @@ CostPmpHT=Cout à l'achat HT
ProductUsedForBuild=Consommé automatiquement par la fabrication
ProductBuilded=Fabrication terminée
ProductsMultiPrice=Produits multi-prix
ProductSellByQuarterHT=Chiffre d'affaire trimestrielle HT des produits
ServiceSellByQuarterHT=Chiffre d'affaire trimestrielle HT des services

View File

@ -258,10 +258,121 @@ else
dol_print_error($db);
}
// ici le récap des ventes par trimestre de service et de produit
if (! empty($conf->product->enabled))
activitytrim(0);
if (! empty($conf->service->enabled))
activitytrim(1);
//print '</td></tr></table>';
print '</div></div></div>';
llxFooter();
$db->close();
function activitytrim($product_type)
{
global $conf,$langs,$db;
// on affiche les 3 dernières années
$yearofbegindate=date('Y',dol_time_plus_duree(time(), -3, "y"));
// ventilation par trimestre
$sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, sum(fd.total_ht) as Mnttot";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.rowid = fd.fk_facture";
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND pf.fk_paiement= p.rowid";
$sql.= " AND fd.product_type=".$product_type;
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'";
$sql.= " GROUP BY annee, mois ";
$sql.= " ORDER BY annee, mois ";
$result = $db->query($sql);
if ($result)
{
$tmpyear=$beginyear;
$trim1=0;
$trim2=0;
$trim3=0;
$trim4=0;
$lgn = 0;
$num = $db->num_rows($result);
if ($num > 0 )
{
print '<br>';
print '<table class="noborder" width="75%">';
if ($product_type==0)
print '<tr class="liste_titre"><td align=left>'.$langs->trans("ProductSellByQuarterHT").'</td>';
else
print '<tr class="liste_titre"><td align=left>'.$langs->trans("ServiceSellByQuarterHT").'</td>';
print '<td align=right>'.$langs->trans("Quarter1").'</td>';
print '<td align=right>'.$langs->trans("Quarter2").'</td>';
print '<td align=right>'.$langs->trans("Quarter3").'</td>';
print '<td align=right>'.$langs->trans("Quarter4").'</td>';
print '<td align=right>'.$langs->trans("Total").'</td>';
print '</tr>';
}
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($result);
if ($tmpyear != $objp->annee)
{
if ($trim1+$trim2+$trim3+$trim4 > 0)
{
print '<tr ><td align=left>'.$tmpyear.'</td>';
print '<td align=right>'.price($trim1).'</td>';
print '<td align=right>'.price($trim2).'</td>';
print '<td align=right>'.price($trim3).'</td>';
print '<td align=right>'.price($trim4).'</td>';
print '<td align=right>'.price($trim1+$trim2+$trim3+$trim4).'</td>';
print '</tr>';
$lgn++;
}
// on passe à l'année suivante
$tmpyear = $objp->annee;
$trim1=0;
$trim2=0;
$trim3=0;
$trim4=0;
}
if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03")
$trim1 += $objp->Mnttot;
if ($objp->mois == "04" || $objp->mois == "05" || $objp->mois == "06")
$trim2 += $objp->Mnttot;
if ($objp->mois == "07" || $objp->mois == "08" || $objp->mois == "09")
$trim3 += $objp->Mnttot;
if ($objp->mois == "10" || $objp->mois == "11" || $objp->mois == "12")
$trim4 += $objp->Mnttot;
$i++;
}
if ($trim1+$trim2+$trim3+$trim4 > 0)
{
print '<tr ><td align=left>'.$tmpyear.'</td>';
print '<td align=right>'.price($trim1).'</td>';
print '<td align=right>'.price($trim2).'</td>';
print '<td align=right>'.price($trim3).'</td>';
print '<td align=right>'.price($trim4).'</td>';
print '<td align=right>'.price($trim1+$trim2+$trim3+$trim4).'</td>';
print '</tr>';
}
if ($num > 0 )
print '</table>';
}
}
?>

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='';
@ -1581,8 +1591,7 @@ class Societe extends CommonObject
$contact_property = array();
$sql = "SELECT rowid, email, statut, phone_mobile, lastname, firstname";
$sql = "SELECT rowid, email, phone_mobile, lastname, poste, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
$sql.= " WHERE fk_soc = '".$this->id."'";
@ -1604,6 +1613,12 @@ class Societe extends CommonObject
{
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." &lt;".$property."&gt;";
if(!empty($obj->poste)){
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." &lt;".$property."&gt;";
}
else
{
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." &lt;".$property."&gt;";
}
$i++;
}