Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
85f5033f47
10
ChangeLog
10
ChangeLog
@ -5,6 +5,9 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.3 compared to 3.2 *****
|
||||
For users:
|
||||
- New: If field "signature" is filled into user table, text is added
|
||||
at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this
|
||||
feautre is disabled.
|
||||
- New: Add link "Back to list" on all cards.
|
||||
- New: After first install, warning are visible onto mandatory setup not
|
||||
configured. Show also total number of activated modules.
|
||||
@ -26,10 +29,11 @@ For users:
|
||||
- New: Suggest a method to generate a backup file for user with no access
|
||||
to mysqldump binary.
|
||||
- New: Can correct stock of a warehouse from warehouse card.
|
||||
- New: task #185 : Can input amount when correcting stock to recalculate PMP.
|
||||
- New: [ task #454 ] Add "No category" into filters on category.
|
||||
- New: Update language files (de, tr, pt).
|
||||
- New: [ task #185 ]: Can input amount when correcting stock to recalculate PMP.
|
||||
- New: [ task #454 ]: Add "No category" into filters on category.
|
||||
- New: Update language files (de, tr, pt, ca_ES, es_ES).
|
||||
- New: Auto check box on page to edit interface options of user.
|
||||
- New: More surface control on stock correction page.
|
||||
- New: Add great britain provinces.
|
||||
- New: Update libs/tools/logo for DoliWamp.
|
||||
- Fix: No images into product description lines as PDF generation does
|
||||
|
||||
@ -280,7 +280,7 @@ class Commande extends CommonOrder
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*');
|
||||
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,8 @@ $formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
llxHeader();
|
||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
llxHeader('',$langs->trans("Orders"),$help_url);
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||
|
||||
@ -29,10 +29,12 @@
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
||||
|
||||
$langs->load('orders');
|
||||
$langs->load('deliveries');
|
||||
@ -73,10 +75,9 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
$now=dol_now();
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -267,30 +268,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line
|
||||
);
|
||||
$result = $object->addline(
|
||||
$id,
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
$lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
$lineid=$result;
|
||||
@ -342,146 +343,149 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$mesgs[]='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$now=dol_now();
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create')
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create')
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
llxHeader();
|
||||
print_fiche_titre($langs->trans('NewBill'));
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($socid) $res=$soc->fetch($socid);
|
||||
if ($res)
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
}
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
|
||||
llxHeader();
|
||||
print_fiche_titre($langs->trans('NewBill'));
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
|
||||
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
||||
print '<table class="border" width="100%">';
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
// Tiers
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||
print '<table class="nobordernopadding">'."\n";
|
||||
// Standard invoice
|
||||
print '<tr height="18"><td width="16px" valign="middle">';
|
||||
print '<input type="radio" name="type" value="0"'.(GETPOST('type')==0?' checked="true"':'').'>';
|
||||
print '</td><td valign="middle">';
|
||||
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
|
||||
print $desc;
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Modele PDF
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php');
|
||||
$liste=ModelePDFFactures::liste_modeles($db);
|
||||
print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($socid) $res=$soc->fetch($socid);
|
||||
if ($res)
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
$commandes = $langs->trans("Orders").": ";
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$srcobject->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$cond_reglement_id = $soc->cond_reglement_id;
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$commandes.= $srcobject->ref." ";
|
||||
}
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
|
||||
}
|
||||
print $commandes;
|
||||
|
||||
$absolute_discount=$soc->getAvailableDiscounts();
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
|
||||
print '<input name="facnumber" type="hidden" value="provisoire">';
|
||||
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
|
||||
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
||||
print '<table class="border" width="100%">';
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
|
||||
// Tiers
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
|
||||
print '<table class="nobordernopadding">'."\n";
|
||||
// Standard invoice
|
||||
print '<tr height="18"><td width="16px" valign="middle">';
|
||||
print '<input type="radio" name="type" value="0"'.(GETPOST('type')==0?' checked="true"':'').'>';
|
||||
print '</td><td valign="middle">';
|
||||
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
|
||||
print $desc;
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
print '</td></tr>';
|
||||
// Payment term
|
||||
print '<tr><td nowrap>'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
|
||||
print '</td></tr>';
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects($soc->id, $projectid, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Modele PDF
|
||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||
print '<td>';
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php');
|
||||
$liste=ModelePDFFactures::liste_modeles($db);
|
||||
print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Public note
|
||||
print '</textarea></td></tr>';
|
||||
// Private note
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
dol_include_once('/commande/class/commande.class.php');
|
||||
$srcobject = new Commande($db);
|
||||
$commandes = $langs->trans("Orders").": ";
|
||||
foreach ($selected as $sel)
|
||||
{
|
||||
$result=$srcobject->fetch($sel);
|
||||
if ($result > 0)
|
||||
{
|
||||
$commandes.= $srcobject->ref." ";
|
||||
}
|
||||
}
|
||||
print $commandes;
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
// Private note
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
|
||||
|
||||
print '</textarea></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
while ($i < $n)
|
||||
{
|
||||
print '<input type="hidden" name="orders_to_invoice[]" value="'.$orders_id[$i].'">';
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
// Button "Create Draft"
|
||||
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
|
||||
//Mode liste
|
||||
else
|
||||
if (($action != 'create' && $action != 'add') || ! empty($mesgs))
|
||||
{
|
||||
llxHeader();
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#checkall").click(function() {
|
||||
jQuery(".checkformerge").attr('checked', true);
|
||||
@ -492,14 +496,34 @@ else
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ' WHERE c.fk_soc = s.rowid';
|
||||
$sql.= ' AND c.fk_statut in (1, 2) AND c.facture = 0';
|
||||
// Which invoice to show
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
if ($viewstatut < 4 && $viewstatut > -2)
|
||||
{
|
||||
$sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee
|
||||
if ($viewstatut == 3)
|
||||
{
|
||||
$sql.= ' AND c.facture = 0'; // need to create invoice
|
||||
}
|
||||
}
|
||||
if ($viewstatut == 4)
|
||||
{
|
||||
$sql.= ' AND c.facture = 1'; // invoice created
|
||||
}
|
||||
if ($viewstatut == -2) // To process
|
||||
{
|
||||
//$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
|
||||
$sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
|
||||
}
|
||||
}
|
||||
$sql.= ' AND s.entity = '.$conf->entity;
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -511,18 +535,18 @@ else
|
||||
{
|
||||
$sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
|
||||
|
||||
//Date filter
|
||||
if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'";
|
||||
if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'";
|
||||
|
||||
|
||||
if (!empty($sref_client))
|
||||
{
|
||||
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
if ($socid)
|
||||
@ -545,7 +569,7 @@ else
|
||||
print '<h3>';
|
||||
$companystatic->id=$socid;
|
||||
$companystatic->nom=$soc->nom;
|
||||
|
||||
|
||||
print $companystatic->getNomUrl(1,'customer');
|
||||
print '</h3>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -557,7 +581,7 @@ else
|
||||
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="get" action="orderstoinvoice.php">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
@ -569,52 +593,52 @@ else
|
||||
//print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="10" name="sref_client" value="'.$sref_client.'">';
|
||||
|
||||
|
||||
//DATE ORDER
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $period;
|
||||
print '</td>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
//DATE DELIVERY
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $periodely;
|
||||
print '</td>';
|
||||
|
||||
//SEARCH BUTTON
|
||||
|
||||
//SEARCH BUTTON
|
||||
print '</td><td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
|
||||
//ALL/NONE
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
|
||||
$var=True;
|
||||
$generic_commande = new Commande($db);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
|
||||
$generic_commande->id=$objp->rowid;
|
||||
$generic_commande->ref=$objp->ref;
|
||||
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding" nowrap="nowrap">';
|
||||
print $generic_commande->getNomUrl(1,$objp->fk_statut);
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
@ -622,37 +646,37 @@ else
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
|
||||
|
||||
// Order date
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_commande),'day');
|
||||
print '</td>';
|
||||
|
||||
|
||||
//Delivery date
|
||||
print '<td align="center" nowrap>';
|
||||
print dol_print_date($db->jdate($objp->date_livraison),'day');
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Statut
|
||||
print '<td align="right" nowrap="nowrap">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>';
|
||||
|
||||
|
||||
// Checkbox
|
||||
print '<td align="center">';
|
||||
print '<input class="flat checkformerge" type="checkbox" name="orders_to_invoice[]" value="'.$objp->rowid.'">';
|
||||
print '</td>' ;
|
||||
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$total = $total + $objp->price;
|
||||
$subtotal = $subtotal + $objp->price;
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<div align="right">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
@ -160,8 +160,6 @@ else
|
||||
$sql.= " AND f.fk_statut > 1";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
$sql.= " AND d.buy_price_ht IS NOT NULL AND d.buy_price_ht <> 0";
|
||||
if ($agentid > 0)
|
||||
$sql.= " AND sc.fk_user = $agentid";
|
||||
if (!empty($startdate))
|
||||
|
||||
@ -1724,7 +1724,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
|
||||
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1424,7 +1424,7 @@ class Form
|
||||
$outval='';
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
if ($selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||
if ($objp->fprice == '') $opt.=' disabled="disabled"';
|
||||
$opt.= '>';
|
||||
|
||||
|
||||
@ -601,12 +601,13 @@ class FormMail
|
||||
{
|
||||
if (! isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
|
||||
|
||||
if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0)
|
||||
if (empty($conf->global->MAIL_DO_NOT_USE_SIGN) && $this->fromid > 0)
|
||||
{
|
||||
$fuser=new User($this->db);
|
||||
$fuser->fetch($this->fromid);
|
||||
|
||||
if(!empty($fuser->signature)) {
|
||||
if(! empty($fuser->signature))
|
||||
{
|
||||
$defaultmessage.=dol_htmlentitiesbr_decode($fuser->signature);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3472,6 +3472,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
||||
*/
|
||||
function setEventMessage($mesgstring, $style='mesgs')
|
||||
{
|
||||
if (! in_array($style,array('mesgs','warnings','errors'))) dol_print_error('','Bad parameter for setEventMessage');
|
||||
$_SESSION['dol_events'][$style][] = $mesgstring;
|
||||
}
|
||||
|
||||
|
||||
@ -744,12 +744,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
||||
$newmenu->add("/societe/soc.php?action=create", $langs->trans("MenuNewThirdParty"),1);
|
||||
if (! $conf->use_javascript_ajax) $newmenu->add("/societe/soc.php?action=create&private=1",$langs->trans("MenuNewPrivateIndividual"),1);
|
||||
}
|
||||
|
||||
// TODO Avoid doing dir scan
|
||||
if(is_dir("societe/groupe"))
|
||||
{
|
||||
$newmenu->add("/societe/groupe/index.php", $langs->trans("MenuSocGroup"),1);
|
||||
}
|
||||
}
|
||||
|
||||
// Prospects
|
||||
@ -858,8 +852,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
||||
$newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders" && $conf->expedition->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=".($conf->expedition->enabled?"3":"-2"), $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
|
||||
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire);
|
||||
$newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire);
|
||||
|
||||
@ -560,7 +560,7 @@ class Expedition extends CommonObject
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($dirdest.'/'.$oldref.'.*');
|
||||
dol_delete_file($dirdest.'/'.$oldref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($dirdest.'/'.$oldref.'.*');
|
||||
dol_delete_file($dirdest.'/'.$oldref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,13 +217,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql = "SELECT l.rowid, l.ref, l.fk_product, l.description, l.subprice, sum(l.qty) as qty";
|
||||
$sql.= ", p.label";
|
||||
$sql = "SELECT l.fk_product, l.subprice, SUM(l.qty) as qty,";
|
||||
$sql.= " p.ref, p.label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
|
||||
$sql.= " WHERE l.fk_commande = ".$commande->id;
|
||||
$sql.= " GROUP BY l.fk_product";
|
||||
$sql.= " ORDER BY l.rowid";
|
||||
$sql.= " GROUP BY p.ref, p.label, l.fk_product, l.subprice"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
||||
$sql.= " ORDER BY p.ref, p.label";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -260,7 +260,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$nbproduct++;
|
||||
|
||||
$remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]);
|
||||
$remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched
|
||||
if ($remaintodispatch < 0) $remaintodispatch=0;
|
||||
|
||||
$var=!$var;
|
||||
@ -268,7 +268,9 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.'</a>';
|
||||
print ' - '.$objp->label;
|
||||
if ($objp->description) print '<br>'.nl2br($objp->description);
|
||||
// To show detail cref and description value, we must make calculation by cref
|
||||
//print ($objp->cref?' ('.$objp->cref.')':'');
|
||||
//if ($objp->description) print '<br>'.nl2br($objp->description);
|
||||
print '<input name="product_'.$i.'" type="hidden" value="'.$objp->fk_product.'">';
|
||||
print '<input name="pu_'.$i.'" type="hidden" value="'.$objp->subprice.'">';
|
||||
print "</td>\n";
|
||||
|
||||
@ -473,6 +473,8 @@ elseif ($action == 'addline')
|
||||
// cas special pour lequel on a les meme reference que le fournisseur
|
||||
// $label = '['.$product->ref.'] - '. $product->libelle;
|
||||
$label = $product->description;
|
||||
$label.= $product->description && $_POST['np_desc'] ? "\n" : "";
|
||||
$label.= $_POST['np_desc'];
|
||||
|
||||
$tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']);
|
||||
|
||||
@ -1784,12 +1786,19 @@ else
|
||||
print '<td colspan="4">';
|
||||
$form->select_produits_fournisseurs($object->socid,'','idprodfournprice');
|
||||
|
||||
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('htmlname'=>'idprodfournprice');
|
||||
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="qty" value="1" size="1"></td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin Redirect Page 2.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery Iframe Transport Plugin Redirect Page</title>
|
||||
</head>
|
||||
<body><script>document.body.innerHTML=decodeURIComponent(window.location.search.slice(1));</script></body>
|
||||
</html>
|
||||
@ -21,7 +21,7 @@ CustomersOrders=Customer's orders
|
||||
CustomersOrdersRunning=Current customer's orders
|
||||
CustomersOrdersAndOrdersLines=Customer orders and order's lines
|
||||
OrdersToValid=Customer's orders to validate
|
||||
OrdersToBill=Customer's orders to bill
|
||||
OrdersToBill=Customer's orders delivered
|
||||
OrdersInProcess=Customer's orders in process
|
||||
OrdersToProcess=Customer's orders to process
|
||||
SuppliersOrdersToProcess=Supplier's orders to process
|
||||
@ -32,7 +32,7 @@ StatusOrderSentShort=In process
|
||||
StatusOrderSent=Shipment in process
|
||||
StatusOrderOnProcessShort=Reception
|
||||
StatusOrderProcessedShort=Processed
|
||||
StatusOrderToBillShort=To bill
|
||||
StatusOrderToBillShort=Delivered
|
||||
StatusOrderApprovedShort=Approved
|
||||
StatusOrderRefusedShort=Refused
|
||||
StatusOrderToProcessShort=To process
|
||||
@ -43,7 +43,7 @@ StatusOrderDraft=Draft (needs to be validated)
|
||||
StatusOrderValidated=Validated
|
||||
StatusOrderOnProcess=Waiting to receive
|
||||
StatusOrderProcessed=Processed
|
||||
StatusOrderToBill=To bill
|
||||
StatusOrderToBill=Delivered
|
||||
StatusOrderApproved=Approved
|
||||
StatusOrderRefused=Refused
|
||||
StatusOrderReceivedPartially=Partially received
|
||||
@ -51,7 +51,7 @@ StatusOrderReceivedAll=Everything received
|
||||
ShippingExist=A shipment exists
|
||||
DraftOrWaitingApproved=Draft or approved not yet ordered
|
||||
DraftOrWaitingShipped=Draft or validated not yet shipped
|
||||
MenuOrdersToBill=Orders to bill
|
||||
MenuOrdersToBill=Orders delivered
|
||||
SearchOrder=Search order
|
||||
Sending=Sending
|
||||
Sendings=Sendings
|
||||
|
||||
@ -33,6 +33,7 @@ StockCorrection=Correct stock
|
||||
StockMovement=Transfer
|
||||
StockMovements=Stock transfers
|
||||
NumberOfUnit=Number of units
|
||||
UnitPurchaseValue=Unit purchase price
|
||||
TotalStock=Total in stock
|
||||
StockTooLow=Stock too low
|
||||
EnhancedValue=Value
|
||||
|
||||
@ -24,6 +24,7 @@ TaskRDVWith=Cita con %s
|
||||
ShowTask=Ver tarea
|
||||
ShowAction=Ver evento
|
||||
ActionsReport=Informe de eventos
|
||||
ThirdPartiesOfSaleRepresentative=Terceros cuyo representante de ventas es
|
||||
SalesRepresentative=Comercial
|
||||
SalesRepresentatives=Comerciales
|
||||
SalesRepresentativeFollowUp=Comercial (seguimiento)
|
||||
|
||||
@ -144,6 +144,7 @@ DescADHERENT_MAIL_RESIL_SUBJECT=Asunto de e-mail de baja
|
||||
DescADHERENT_MAIL_RESIL=E-mail de baja
|
||||
DescADHERENT_MAIL_FROM=E-mail emisor para los e-mails automáticos
|
||||
DescADHERENT_ETIQUETTE_TYPE=Formato páginas etiquetas
|
||||
DescADHERENT_ETIQUETTE_TEXT=Texto a imprimir en la dirección de las etiquetas de cada miembro
|
||||
DescADHERENT_CARD_TYPE=Formato páginas carné de miembro
|
||||
DescADHERENT_CARD_HEADER_TEXT=Texto a imprimir en la parte superior del carné de miembro
|
||||
DescADHERENT_CARD_TEXT=Texto a imprimir en el carné de miembro (Alineado a la izquierda)
|
||||
|
||||
@ -33,6 +33,7 @@ StockCorrection=Corrección stock
|
||||
StockMovement=Transferencia
|
||||
StockMovements=Movimientos de stock
|
||||
NumberOfUnit=Número de piezas
|
||||
UnitPurchaseValue=Precio de compra unitario
|
||||
TotalStock=Total en stock
|
||||
StockTooLow=Stock insuficiente
|
||||
EnhancedValue=Valor
|
||||
|
||||
@ -21,7 +21,7 @@ CustomersOrders=Commandes clients
|
||||
CustomersOrdersRunning=Commandes clients en cours
|
||||
CustomersOrdersAndOrdersLines=Commandes clients et lignes de commandes
|
||||
OrdersToValid=Commandes clients à valider
|
||||
OrdersToBill=Commandes clients à facturer
|
||||
OrdersToBill=Commandes clients délivrées
|
||||
OrdersInProcess=Commandes clients en traitement
|
||||
OrdersToProcess=Commandes clients à traiter
|
||||
SuppliersOrdersToProcess=Commandes fournisseurs à traiter
|
||||
@ -32,7 +32,7 @@ StatusOrderOnProcessShort=Traitement en cours
|
||||
StatusOrderSentShort=Envoi en cours
|
||||
StatusOrderSent=Envoi en cours
|
||||
StatusOrderProcessedShort=Traitée
|
||||
StatusOrderToBillShort=À facturer
|
||||
StatusOrderToBillShort=Délivrée
|
||||
StatusOrderApprovedShort=Approuvée
|
||||
StatusOrderRefusedShort=Refusée
|
||||
StatusOrderToProcessShort=A traiter
|
||||
@ -43,7 +43,7 @@ StatusOrderDraft=Brouillon (à valider)
|
||||
StatusOrderValidated=Validée
|
||||
StatusOrderOnProcess=Attente réception
|
||||
StatusOrderProcessed=Traitée
|
||||
StatusOrderToBill=À facturer
|
||||
StatusOrderToBill=Délivrée
|
||||
StatusOrderApproved=Approuvée
|
||||
StatusOrderRefused=Refusée
|
||||
StatusOrderReceivedPartially=Reçu partiellement
|
||||
@ -52,7 +52,7 @@ ShippingExist=Une expédition existe
|
||||
DraftOrWaitingApproved=Brouillon ou approuvée pas encore commandée
|
||||
DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée
|
||||
SearchOrder=Rechercher une commande
|
||||
MenuOrdersToBill=Commandes à facturer
|
||||
MenuOrdersToBill=Commandes délivrées
|
||||
Sending=Expédition
|
||||
Sendings=Expéditions
|
||||
ShipProduct=Expédier produit
|
||||
|
||||
@ -408,7 +408,7 @@ class Livraison extends CommonObject
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($dirdest.'/'.$oldref.'.*');
|
||||
dol_delete_file($dirdest.'/'.$oldref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1006,7 +1006,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-ui.js"></script>'."\n";
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-jui.js"></script>'."\n";
|
||||
print '<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->'."\n";
|
||||
'<!--[if gte IE 8]><script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/cors/jquery.xdr-transport.js"></script><![endif]-->'."\n";
|
||||
print '<!--[if gte IE 8]><script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/cors/jquery.xdr-transport.js"></script><![endif]-->'."\n";
|
||||
}
|
||||
// jQuery DataTables
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES))
|
||||
|
||||
@ -42,12 +42,12 @@ $cancel=GETPOST('cancel');
|
||||
// Security check
|
||||
$id = GETPOST('id')?GETPOST('id'):GETPOST('ref');
|
||||
$ref = GETPOST('ref');
|
||||
$stocklimit = GETPOST('stocklimit');
|
||||
$cancel = GETPOST('cancel');
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'produit&stock',$id,'product&product','','',$fieldid);
|
||||
|
||||
$mesg = '';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -59,96 +59,123 @@ if ($cancel) $action='';
|
||||
if ($action == 'setstocklimit')
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($_POST['id']);
|
||||
$product->seuil_stock_alerte=$_POST["stocklimit"];
|
||||
$result=$product->fetch($id);
|
||||
$product->seuil_stock_alerte=$stocklimit;
|
||||
$result=$product->update($product->id,$user,1,0,1);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg=join(',',$product->errors);
|
||||
}
|
||||
$POST["action"]="";
|
||||
$id=$_POST["id"];
|
||||
$_GET["id"]=$_POST["id"];
|
||||
setEventMessage($product->error, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Correct stock
|
||||
if ($action == "correct_stock" && ! $_POST["cancel"])
|
||||
if ($action == "correct_stock" && ! $cancel)
|
||||
{
|
||||
//if ($_POST["price"] == '') $_POST["price"] = 0;
|
||||
if (isset($_POST["price"])) $priceunit=price2num($_POST["price"]);
|
||||
if (is_numeric($_POST["nbpiece"]) && $id)
|
||||
if (! (GETPOST("id_entrepot") > 0))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
$error++;
|
||||
$action='correction';
|
||||
}
|
||||
if (! GETPOST("nbpiece"))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("NumberOfUnit")), 'errors');
|
||||
$error++;
|
||||
$action='correction';
|
||||
}
|
||||
|
||||
$result=$product->correct_stock(
|
||||
$user,
|
||||
$_POST["id_entrepot"],
|
||||
$_POST["nbpiece"],
|
||||
$_POST["mouvement"],
|
||||
$_POST["label"],
|
||||
$priceunit
|
||||
); // We do not change value of stock for a correction
|
||||
|
||||
if ($result > 0)
|
||||
if (! $error)
|
||||
{
|
||||
$priceunit=price2num(GETPOST("price"));
|
||||
if (is_numeric(GETPOST("nbpiece")) && $id)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
||||
exit;
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
|
||||
$result=$product->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot"),
|
||||
GETPOST("nbpiece"),
|
||||
GETPOST("mouvement"),
|
||||
GETPOST("label"),
|
||||
$priceunit
|
||||
); // We do not change value of stock for a correction
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer stock from a warehouse to another warehouse
|
||||
if ($action == "transfert_stock" && ! $_POST["cancel"])
|
||||
if ($action == "transfert_stock" && ! $cancel)
|
||||
{
|
||||
if ($_POST["id_entrepot_source"] <> $_POST["id_entrepot_destination"])
|
||||
{
|
||||
if (is_numeric($_POST["nbpiece"]) && $id)
|
||||
if (! (GETPOST("id_entrepot_source") > 0) || ! (GETPOST("id_entrepot_destination") > 0))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Warehouse")), 'errors');
|
||||
$error++;
|
||||
$action='transfert';
|
||||
}
|
||||
if (! GETPOST("nbpiece"))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("NumberOfUnit")), 'errors');
|
||||
$error++;
|
||||
$action='transfert';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (GETPOST("id_entrepot_source") <> GETPOST("id_entrepot_destination"))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$product->load_stock(); // Load array product->stock_warehouse
|
||||
|
||||
// Define value of products moved
|
||||
$pricesrc=0;
|
||||
if (isset($product->stock_warehouse[$_POST["id_entrepot_source"]]->pmp)) $pricesrc=$product->stock_warehouse[$_POST["id_entrepot_source"]]->pmp;
|
||||
$pricedest=$pricesrc;
|
||||
|
||||
//print 'price src='.$pricesrc.', price dest='.$pricedest;exit;
|
||||
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock(
|
||||
$user,
|
||||
$_POST["id_entrepot_source"],
|
||||
$_POST["nbpiece"],
|
||||
1,
|
||||
$_POST["label"],
|
||||
$pricesrc
|
||||
);
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock(
|
||||
$user,
|
||||
$_POST["id_entrepot_destination"],
|
||||
$_POST["nbpiece"],
|
||||
0,
|
||||
$_POST["label"],
|
||||
$pricedest
|
||||
);
|
||||
|
||||
if ($result1 >= 0 && $result2 >= 0)
|
||||
if (is_numeric(GETPOST("nbpiece")) && $id)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: product.php?id=".$product->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$product->error;
|
||||
$db->rollback();
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$product->load_stock(); // Load array product->stock_warehouse
|
||||
|
||||
// Define value of products moved
|
||||
$pricesrc=0;
|
||||
if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
|
||||
$pricedest=$pricesrc;
|
||||
|
||||
//print 'price src='.$pricesrc.', price dest='.$pricedest;exit;
|
||||
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot_source"),
|
||||
GETPOST("nbpiece"),
|
||||
1,
|
||||
GETPOST("label"),
|
||||
$pricesrc
|
||||
);
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot_destination"),
|
||||
GETPOST("nbpiece"),
|
||||
0,
|
||||
GETPOST("label"),
|
||||
$pricedest
|
||||
);
|
||||
|
||||
if ($result1 >= 0 && $result2 >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: product.php?id=".$product->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($product->error, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,11 +189,11 @@ if ($action == "transfert_stock" && ! $_POST["cancel"])
|
||||
$formproduct=new FormProduct($db);
|
||||
|
||||
|
||||
if ($_GET["id"] || $_GET["ref"])
|
||||
if ($id > 0 || $ref)
|
||||
{
|
||||
$product = new Product($db);
|
||||
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
|
||||
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
|
||||
if ($ref) $result = $product->fetch('',$ref);
|
||||
if ($id > 0) $result = $product->fetch($id);
|
||||
|
||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
llxHeader("",$langs->trans("CardProduct".$product->type),$help_url);
|
||||
@ -180,8 +207,6 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
print($mesg);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
@ -329,6 +354,20 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
*/
|
||||
if ($action == "correction")
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_price()
|
||||
{
|
||||
if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr(\'disabled\');
|
||||
else jQuery("#unitprice").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_price();
|
||||
jQuery("#mouvement").change(function() {
|
||||
init_price();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
print_titre($langs->trans("StockCorrection"));
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'" method="post">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -339,23 +378,23 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<tr>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td width="20%">';
|
||||
print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1);
|
||||
print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot')),'id_entrepot','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%">';
|
||||
print '<select name="mouvement" class="flat">';
|
||||
print '<select name="mouvement" id="mouvement" class="flat">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
print '<option value="1">'.$langs->trans("Delete").'</option>';
|
||||
print '</select></td>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr>';
|
||||
print '<td width="20%">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print '<input type="text" name="label" size="40" value="">';
|
||||
print '<input type="text" name="label" size="40" value="'.GETPOST("label").'">';
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans("UnitPurchaseValue").'</td><td width="20%"><input class="flat" name="price" size="10" value=""></td>';
|
||||
print '<td width="20%">'.$langs->trans("UnitPurchaseValue").'</td><td width="20%"><input class="flat" name="price" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -378,19 +417,19 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td><td width="20%">';
|
||||
print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot_source','',1);
|
||||
print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot_source')),'id_entrepot_source','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td width="20%">';
|
||||
print $formproduct->selectWarehouses('','id_entrepot_destination','',1);
|
||||
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr>';
|
||||
print '<td width="20%">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<input type="text" name="label" size="40" value="">';
|
||||
print '<input type="text" name="label" size="40" value="'.GETPOST("label").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -536,9 +575,7 @@ print "</tr>";
|
||||
print "</table>";
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -170,6 +170,7 @@ if (! empty($project_ref) && ! empty($withproject))
|
||||
llxHeader("",$langs->trans("Task"));
|
||||
|
||||
$form = new Form($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
@ -403,17 +404,17 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td>';
|
||||
|
||||
// User
|
||||
$user->id = $task_time->fk_user;
|
||||
print '<td>';
|
||||
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
|
||||
{
|
||||
print $form->select_users($user->id,'userid_line');
|
||||
print $form->select_users($task_time->fk_user,'userid_line');
|
||||
}
|
||||
else
|
||||
{
|
||||
$user->nom = $task_time->name;
|
||||
$user->prenom = $task_time->firstname;
|
||||
print $user->getNomUrl(1);
|
||||
$userstatic->id = $task_time->fk_user;
|
||||
$userstatic->nom = $task_time->name;
|
||||
$userstatic->prenom = $task_time->firstname;
|
||||
print $userstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user