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

This commit is contained in:
Florian HENRY 2015-07-15 15:16:09 +02:00
commit 01d1c89f11
10 changed files with 56 additions and 22 deletions

View File

@ -1152,7 +1152,7 @@ class AccountLine extends CommonObject
if ($this->rappro) if ($this->rappro)
{ {
// Protection to avoid any delete of consolidated lines // Protection to avoid any delete of consolidated lines
$this->error="DeleteNotPossibleLineIsConsolidated"; $this->error="ErrorDeleteNotPossibleLineIsConsolidated";
return -1; return -1;
} }

View File

@ -314,16 +314,19 @@ class PaymentSocialContribution extends CommonObject
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
dol_syslog(get_class($this)."::delete");
$this->db->begin(); $this->db->begin();
if (! $error) if ($this->bank_line > 0)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; $accline = new AccountLine($this->db);
$sql.= " WHERE type='payment_sc' AND url_id=".$this->id; $accline->fetch($this->bank_line);
$result = $accline->delete();
dol_syslog(get_class($this)."::delete sql=".$sql); if($result < 0) {
$resql = $this->db->query($sql); $this->errors[] = $accline->error;
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } $error++;
}
} }
if (! $error) if (! $error)

View File

@ -555,7 +555,7 @@ class Contact extends CommonObject
$this->country_id = $obj->country_id; $this->country_id = $obj->country_id;
$this->country_code = $obj->country_id?$obj->country_code:''; $this->country_code = $obj->country_id?$obj->country_code:'';
$this->country = ($obj->country_id > 0)?$langs->transnoentitiesnoconv("Country".$obj->country_code):''; $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->socname = $obj->socname; $this->socname = $obj->socname;

View File

@ -69,7 +69,7 @@ abstract class CommonObject
$sql = "SELECT rowid, ref, ref_ext"; $sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element; $sql.= " FROM ".MAIN_DB_PREFIX.$element;
$sql.= " WHERE entity IN (".getEntity($element).")" ; $sql.= " WHERE entity IN (".getEntity($element, true).")" ;
if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";

View File

@ -252,6 +252,13 @@ class ExportCsv extends ModeleExports
$newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output); $newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output);
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
{
$array = unserialize($typefield);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
fwrite($this->handle,$newvalue.$this->separator); fwrite($this->handle,$newvalue.$this->separator);
$this->col++; $this->col++;
} }

View File

@ -306,6 +306,13 @@ class ExportExcel extends ModeleExports
$newvalue=$this->excel_clean($newvalue); $newvalue=$this->excel_clean($newvalue);
$typefield=isset($array_types[$code])?$array_types[$code]:''; $typefield=isset($array_types[$code])?$array_types[$code]:'';
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
{
$array = unserialize($typefield);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
// Traduction newvalue // Traduction newvalue
if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
{ {

View File

@ -227,6 +227,13 @@ class ExportTsv extends ModeleExports
$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output); $newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
{
$array = unserialize($typefield);
$array = $array['options'];
$newvalue = $array[$newvalue];
}
fwrite($this->handle,$newvalue.$this->separator); fwrite($this->handle,$newvalue.$this->separator);
$this->col++; $this->col++;
} }

View File

@ -355,6 +355,9 @@ class modSociete extends DolibarrModules
case 'sellist': case 'sellist':
$typeFilter="List:".$obj->param; $typeFilter="List:".$obj->param;
break; break;
case 'select':
$typeFilter="Select:".$obj->param;
break;
} }
$this->export_fields_array[$r][$fieldname]=$fieldlabel; $this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter; $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;

View File

@ -194,11 +194,11 @@ if ($resql)
if ($sref || $snom || $sall || GETPOST('search')) if ($sref || $snom || $sall || GETPOST('search'))
{ {
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num); print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
} }
else else
{ {
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num); print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"").(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
} }
if (! empty($catid)) if (! empty($catid))
@ -342,11 +342,11 @@ if ($resql)
{ {
if ($sref || $snom || $sall || GETPOST('search')) if ($sref || $snom || $sall || GETPOST('search'))
{ {
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, '');
} }
else else
{ {
print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"")."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"")."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, '');
} }
} }

View File

@ -120,15 +120,22 @@ if ($resql)
else print $langs->trans("ProjectsPublicDesc").'<br><br>'; else print $langs->trans("ProjectsPublicDesc").'<br><br>';
} }
$param='';
if ($mine) $param.='mode=mine';
if ($socid) $param.='&socid='.$socid;
if ($search_ref) $param.='&search_ref='.$search_ref;
if ($search_label) $param.='&search_label='.$search_label;
if ($search_societe) $param.='&search_societe='.$search_societe;
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';