Work on split module fournisseur

This commit is contained in:
Alexandre SPANGARO 2020-03-24 22:02:58 +01:00
parent e6d9f7885c
commit 5528e9ef38
11 changed files with 24 additions and 23 deletions

View File

@ -38,8 +38,8 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/com
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_invoice->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';

View File

@ -295,7 +295,7 @@ if ($object->id > 0)
print '</td>';
print '</tr>';
if (!empty($conf->fournisseur->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
{
print '<tr class="nowrap">';
print '<td>';
@ -378,7 +378,7 @@ if ($object->id > 0)
if ($link) $boxstat .= '</a>';
}
if ($conf->fournisseur->enabled)
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
{
// Box proposals
$tmp = $object->getOutstandingOrders('supplier');
@ -396,7 +396,7 @@ if ($object->id > 0)
if ($link) $boxstat .= '</a>';
}
if ($conf->fournisseur->enabled)
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
{
$tmp = $object->getOutstandingBills('supplier');
$outstandingOpened = $tmp['opened'];

View File

@ -3185,7 +3185,7 @@ class CommandeFournisseur extends CommonOrder
{
global $conf, $langs;
if (!empty($conf->fournisseur->enabled))
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';

View File

@ -97,7 +97,7 @@ else
// Draft orders
if (!empty($conf->fournisseur->enabled))
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))
{
$langs->load("orders");
@ -154,7 +154,7 @@ if (!empty($conf->fournisseur->enabled))
}
// Draft invoices
if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{
$sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type";
$sql .= ", s.nom as name, s.rowid as socid";

View File

@ -65,7 +65,7 @@ if ($socid > 0)
dol_banner_tab($societe, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
dol_fiche_end();
if (!empty($conf->fournisseur->enabled) && $user->rights->facture->lire)
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire)
{
// Invoice list
print load_fiche_titre($langs->trans("SupplierPreview"));
@ -77,7 +77,7 @@ if ($socid > 0)
$sql .= " u.login, u.rowid as userid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
$sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany
$sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Recognition of the entity attributed to this invoice for Multicompany
$sql .= " AND f.fk_user_valid = u.rowid";
$sql .= " ORDER BY f.datef DESC";

View File

@ -106,7 +106,7 @@ if ($socid > 0)
print '</td></tr>';
}
if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire))
{
print '<tr><td class="titlefield">';
print $langs->trans('SupplierCode').'</td><td colspan="3">';

View File

@ -564,7 +564,7 @@ $rowspan = 4;
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++;
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++;
if (!empty($conf->global->MAIN_MULTILANGS)) $rowspan++;
if (!empty($conf->fournisseur->enabled)) $rowspan++;
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) $rowspan++;
print '<tr class="oddeven">';
@ -680,7 +680,7 @@ if (!empty($conf->global->MAIN_MULTILANGS))
print '</tr>';
}
if (!empty($conf->fournisseur->enabled))
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled))
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseProductFournDesc").'</td>';

View File

@ -4872,19 +4872,19 @@ class Product extends CommonObject
if ($result < 0) dol_print_error($this->db, $this->error);
$stock_sending_client = $this->stats_expedition['qty'];
}
if (!empty($conf->fournisseur->enabled))
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled))
{
$result = $this->load_stats_commande_fournisseur(0, '1,2,3,4', 1);
if ($result < 0) dol_print_error($this->db, $this->error);
$stock_commande_fournisseur = $this->stats_commande_fournisseur['qty'];
}
if (!empty($conf->fournisseur->enabled) && empty($conf->reception->enabled))
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled))
{
$result = $this->load_stats_reception(0, '4', 1);
if ($result < 0) dol_print_error($this->db, $this->error);
$stock_reception_fournisseur = $this->stats_reception['qty'];
}
if (!empty($conf->fournisseur->enabled) && !empty($conf->reception->enabled))
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled))
{
$result = $this->load_stats_reception(0, '4', 1); // Use same tables than when module reception is not used.
if ($result < 0) dol_print_error($this->db, $this->error);

View File

@ -674,7 +674,8 @@ if ($id > 0 || $ref)
}
// Number of supplier order running
if (!empty($conf->fournisseur->enabled)) {
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
{
if ($found) $helpondiff .= '<br>'; else $found = 1;
$result = $object->load_stats_commande_fournisseur(0, '3,4', 1);
$helpondiff .= $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty'];
@ -684,7 +685,7 @@ if ($id > 0 || $ref)
}
// Number of product from supplier order already received (partial receipt)
if (!empty($conf->fournisseur->enabled)) {
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if ($found) $helpondiff .= '<br>'; else $found = 1;
$helpondiff .= $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty'];
}

View File

@ -134,7 +134,7 @@ else
$statstring .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=c">'.$langs->trans("Customers").'</a></td><td class="right">'.round($third['customer']).'</td>';
$statstring .= "</tr>";
}
if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire)
{
$statstring2 = "<tr>";
$statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
@ -310,7 +310,7 @@ if ($result)
$thirdparty_static->name = $langs->trans("Prospect");
print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1);
}
if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $thirdparty_static->fournisseur)
{
if ($thirdparty_static->client) print " / ";
$thirdparty_static->name = $langs->trans("Supplier");

View File

@ -178,9 +178,9 @@ $arrayfields = array(
's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1),
's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))),
's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode),
's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))),
's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode),
's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))),
's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1),
'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0),
@ -1226,7 +1226,7 @@ while ($i < min($num, $limit))
$companystatic->name_alias = '';
$s .= $companystatic->getNomUrl(0, 'prospect', 0, 1);
}
if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur)
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur)
{
if ($s) $s .= ", ";
$companystatic->name = $langs->trans("Supplier");