Merge remote-tracking branch 'origin/3.8' into develop

This commit is contained in:
Laurent Destailleur 2015-08-30 21:22:28 +02:00
commit 3315978fd3
5 changed files with 119 additions and 44 deletions

View File

@ -528,11 +528,11 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
$period_filter .= $langs->trans('From').'&nbsp;'.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1); $period_filter .= $langs->trans('From').'&nbsp;'.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1);
$period_filter .= '<BR>'. $langs->trans('to').'&nbsp;'.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); $period_filter .= '&nbsp;';
$period_filter .= $langs->trans('to').'&nbsp;'.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1);
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>&nbsp;</td>'; print '<td colspan="2">'.$period_filter.'</td>';
print '<td>'.$period_filter.'</td>';
print '<td>'; print '<td>';
//$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...)
$filtertype=''; $filtertype='';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2014 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -262,6 +263,12 @@ if ($object->id > 0)
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Categories
print '<tr><td>' . $langs->trans("Categories") . '</td>';
print '<td colspan="3">';
print $form->showCategories($object->id, 'supplier', 1);
print "</td></tr>";
// Other attributes // Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook

View File

@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
// Label // Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td>';
print '</tr>'; print '</tr>';
// Nature // Nature

View File

@ -345,7 +345,7 @@ $langs->load("proposals");
$langs->load("margins"); $langs->load("margins");
//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); //print load_fiche_titre($langs->trans("Profit"),'','title_accountancy');
print '<div class="center">'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'</div><br>'; print '<div class="left">'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'</div><br>';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -9,6 +9,7 @@
* Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -411,7 +412,7 @@ if (empty($reshook))
} }
} }
// Categories association // Customer categories association
$custcats = GETPOST( 'custcats', 'array' ); $custcats = GETPOST( 'custcats', 'array' );
if (!empty( $custcats )) { if (!empty( $custcats )) {
$cat = new Categorie( $db ); $cat = new Categorie( $db );
@ -421,6 +422,16 @@ if (empty($reshook))
} }
} }
// Supplier categories association
$suppcats = GETPOST('suppcats', 'array');
if (!empty($suppcats)) {
$cat = new Categorie($db);
foreach ($suppcats as $id_category) {
$cat->fetch($id_category);
$cat->add_type($object, 'supplier');
}
}
// Logo/Photo save // Logo/Photo save
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@ -525,7 +536,7 @@ if (empty($reshook))
$error = $object->error; $errors = $object->errors; $error = $object->error; $errors = $object->errors;
} }
// Categories association // Customer categories association
// First we delete all categories association // First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe'; $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe';
$sql .= ' WHERE fk_soc = ' . $object->id; $sql .= ' WHERE fk_soc = ' . $object->id;
@ -541,6 +552,22 @@ if (empty($reshook))
} }
} }
// Supplier categories association
// First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_fournisseur';
$sql .= ' WHERE fk_soc = ' . $object->id;
$db->query($sql);
// Then we add the associated categories
$categories = GETPOST('suppcats', 'array');
if (!empty($categories)) {
$cat = new Categorie($db);
foreach ($categories as $id_category) {
$cat->fetch($id_category);
$cat->add_type($object, 'supplier');
}
}
// Logo/Photo save // Logo/Photo save
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@ -1247,12 +1274,25 @@ else
// Categories // Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
print '<tr><td class="toptd">'.fieldLabel('Categories','custcats').'</td><td colspan="3">'; // Customer
if ($object->prospect || $object->client) {
print '<tr><td class="toptd">' . fieldLabel('CustomersCategoriesShort', 'custcats') . '</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null,
null, "90%");
print "</td></tr>"; print "</td></tr>";
} }
// Supplier
if ($object->fournisseur) {
print '<tr><td class="toptd">' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . '</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null,
null, "90%");
print "</td></tr>";
}
}
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -1763,7 +1803,9 @@ else
// Categories // Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
print '<tr><td>'.fieldLabel('Categories', 'custcats').'</td>'; // Customer
if ($object->prospect || $object->client) {
print '<tr><td>' . fieldLabel('CustomersCategoriesShort', 'custcats') . '</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1);
$c = new Categorie($db); $c = new Categorie($db);
@ -1775,6 +1817,21 @@ else
print "</td></tr>"; print "</td></tr>";
} }
// Supplier
if ($object->fournisseur) {
print '<tr><td>' . fieldLabel('SuppliersCategoriesShort', 'suppcats') . '</td>';
print '<td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
print "</td></tr>";
}
}
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -2209,12 +2266,23 @@ else
// Tags / categories // Tags / categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>'; // Customer
if ($object->prospect || $object->client) {
print '<tr><td>' . $langs->trans("CustomersCategoriesShort") . '</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showCategories($object->id, 'customer', 1); print $form->showCategories($object->id, 'customer', 1);
print "</td></tr>"; print "</td></tr>";
} }
// Supplier
if ($object->fournisseur) {
print '<tr><td>' . $langs->trans("SuppliersCategoriesShort") . '</td>';
print '<td colspan="3">';
print $form->showCategories($object->id, 'supplier', 1);
print "</td></tr>";
}
}
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
{ {