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

This commit is contained in:
Maxime Kohlhaas 2013-04-20 13:00:33 +02:00
commit cf945f0187
38 changed files with 6658 additions and 6470 deletions

View File

@ -49,6 +49,7 @@ For users:
- New: [ task #814 ] Add extrafield feature into Project/project tasks module - New: [ task #814 ] Add extrafield feature into Project/project tasks module
- New: [ task #770 ] Add ODT document generation for Projects module - New: [ task #770 ] Add ODT document generation for Projects module
- New: [ task #741 ] Add intervention box - New: [ task #741 ] Add intervention box
- New: [ task #826 ] Optionnal increase stock when deleting an invoice already validated
For translators: For translators:
- Update language files. - Update language files.

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
@ -67,6 +68,7 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_DELETE_INVOICE", '','chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity);
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
@ -239,6 +241,19 @@ if (! empty($conf->fournisseur->enabled))
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
} }
if (! empty($conf->facture->enabled))
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("ReStockOnDeleteInvoice").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_CALCULATE_ON_DELETE_INVOICE\">";
print $form->selectyesno("STOCK_CALCULATE_ON_DELETE_INVOICE",$conf->global->STOCK_CALCULATE_ON_DELETE_INVOICE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</form>\n</td>\n</tr>\n";
}
print '</table>'; print '</table>';

View File

@ -1,34 +1,34 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/commande/fiche.php * \file htdocs/commande/fiche.php
* \ingroup commande * \ingroup commande
* \brief Page to show customer order * \brief Page to show customer order
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@ -541,7 +541,7 @@ else if ($action == 'setnote_public' && $user->rights->commande->creer)
else if ($action == 'setnote_private' && $user->rights->commande->creer) else if ($action == 'setnote_private' && $user->rights->commande->creer)
{ {
$result=$object->update_note_rivate(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
@ -2135,6 +2135,7 @@ else
$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
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
if(count($extrafields->attribute_label) > 0) {
if ($action == 'edit_extras') if ($action == 'edit_extras')
{ {
@ -2144,39 +2145,13 @@ else
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
} }
// TODO : use showOptionals($extrafields) function
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
print '>'.$label.'</td><td colspan="3">';
// Convert date into timestamp format if ($action == 'edit_extras' && $user->rights->propal->creer) {
if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) print $object->showOptionals($extrafields,'edit');
{
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
} }
else {
if ($action == 'edit_extras' && $user->rights->propal->creer) print $object->showOptionals($extrafields);
{
print $extrafields->showInputField($key,$value);
} }
else
{
print $extrafields->showOutputField($key,$value);
}
print '</td></tr>'."\n";
}
}
if(count($extrafields->attribute_label) > 0) {
if ($action == 'edit_extras' && $user->rights->propal->creer) if ($action == 'edit_extras' && $user->rights->propal->creer)
{ {

View File

@ -1,34 +1,34 @@
<?php <?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr> * Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/compta/facture.php * \file htdocs/compta/facture.php
* \ingroup facture * \ingroup facture
* \brief Page to create/see an invoice * \brief Page to create/see an invoice
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
@ -99,7 +99,7 @@ $hookmanager->initHooks(array('invoicecard'));
/* /*
* Actions * Actions
*/ */
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -156,7 +156,20 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result = $object->delete();
$idwarehouse=GETPOST('idwarehouse');
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
$result = $object->delete(0,0,$idwarehouse);
if ($result > 0) if ($result > 0)
{ {
header('Location: '.DOL_URL_ROOT.'/compta/facture/list.php'); header('Location: '.DOL_URL_ROOT.'/compta/facture/list.php');
@ -389,8 +402,18 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
} }
} }
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
//Check for warehouse //Check for warehouse
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
{ {
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
@ -436,8 +459,18 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
// Check parameters // Check parameters
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
{ {
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
@ -612,7 +645,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ
/* /*
* Insert new invoice in database * Insert new invoice in database
*/ */
else if ($action == 'add' && $user->rights->facture->creer) else if ($action == 'add' && $user->rights->facture->creer)
{ {
if ($socid>0) if ($socid>0)
@ -809,11 +842,21 @@ else if ($action == 'add' && $user->rights->facture->creer)
} }
// For compatibility // For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; } if ($element == 'order') {
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } $element = $subelement = 'commande';
if ($element == 'contract') { $element = $subelement = 'contrat'; } }
if ($element == 'inter') { $element = $subelement = 'ficheinter'; } if ($element == 'propal') {
if ($element == 'shipping') { $element = $subelement = 'expedition'; } $element = 'comm/propal'; $subelement = 'propal';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
$object->origin = $_POST['origin']; $object->origin = $_POST['origin'];
$object->origin_id = $_POST['originid']; $object->origin_id = $_POST['originid'];
@ -1423,7 +1466,7 @@ else if ($action == 'down' && $user->rights->facture->creer)
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) if (GETPOST('addfile'))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1438,7 +1481,7 @@ if (GETPOST('addfile'))
/* /*
* Remove file in email form * Remove file in email form
*/ */
if (! empty($_POST['removedfile'])) if (! empty($_POST['removedfile']))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1454,7 +1497,7 @@ if (! empty($_POST['removedfile']))
/* /*
* Send mail * Send mail
*/ */
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{ {
$langs->load('mails'); $langs->load('mails');
@ -1466,11 +1509,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($result > 0) if ($result > 0)
{ {
// $ref = dol_sanitizeFileName($object->ref); // $ref = dol_sanitizeFileName($object->ref);
// $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; // $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
// if (is_readable($file)) // if (is_readable($file))
// { // {
if ($_POST['sendto']) if ($_POST['sendto'])
{ {
// Le destinataire a ete fourni via le champ libre // Le destinataire a ete fourni via le champ libre
@ -1565,7 +1608,9 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
if ($error) if ($error)
@ -1599,7 +1644,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$mesgs[]=$mesg; $mesgs[]=$mesg;
} }
} }
/* } /* }
else else
{ {
$langs->load("other"); $langs->load("other");
@ -1622,13 +1667,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
$action = 'presend'; $action = 'presend';
} }
/* /*
* Generate document * Generate document
*/ */
else if ($action == 'builddoc') // En get ou en post else if ($action == 'builddoc') // En get ou en post
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -1656,11 +1701,11 @@ else if ($action == 'builddoc') // En get ou en post
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
exit; exit;
} }
} }
// Remove file in doc form // Remove file in doc form
else if ($action == 'remove_file') else if ($action == 'remove_file')
{ {
if ($object->fetch($id)) if ($object->fetch($id))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1675,10 +1720,10 @@ else if ($action == 'remove_file')
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action=''; $action='';
} }
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
{ {
if ($action == 'addcontact') if ($action == 'addcontact')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
@ -1736,10 +1781,10 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture-
dol_print_error($db); dol_print_error($db);
} }
} }
} }
if ($action == 'update_extras') if ($action == 'update_extras')
{ {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$extralabels=$extrafields->fetch_name_optionals_label('facture'); $extralabels=$extrafields->fetch_name_optionals_label('facture');
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -1762,30 +1807,30 @@ if ($action == 'update_extras')
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
} }
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$formother=new FormOther($db); $formother=new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$bankaccountstatic=new Account($db); $bankaccountstatic=new Account($db);
$now=dol_now(); $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
/********************************************************************* /*********************************************************************
* *
* Mode creation * Mode creation
* *
**********************************************************************/ **********************************************************************/
if ($action == 'create') if ($action == 'create')
{ {
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$extralabels=$extrafields->fetch_name_optionals_label('facture'); $extralabels=$extrafields->fetch_name_optionals_label('facture');
@ -1811,10 +1856,18 @@ if ($action == 'create')
else else
{ {
// For compatibility // For compatibility
if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } if ($element == 'order' || $element == 'commande') {
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } $element = $subelement = 'commande';
if ($element == 'contract') { $element = $subelement = 'contrat'; } }
if ($element == 'shipping') { $element = $subelement = 'expedition'; } if ($element == 'propal') {
$element = 'comm/propal'; $subelement = 'propal';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
@ -2257,9 +2310,9 @@ if ($action == 'create')
print '</table>'; print '</table>';
} }
} }
else if ($id > 0 || ! empty($ref)) else if ($id > 0 || ! empty($ref))
{ {
/* /*
* Show object in view mode * Show object in view mode
*/ */
@ -2334,8 +2387,34 @@ else if ($id > 0 || ! empty($ref))
// Confirmation to delete invoice // Confirmation to delete invoice
if ($action == 'delete') if ($action == 'delete')
{ {
$text=$langs->trans('ConfirmDeleteBill'); $text=$langs->trans('ConfirmDeleteBill',$object->ref);
$formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','',0,1); $formquestion=array();
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut>=1)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
$label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease");
$formquestion=array(
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1,0,0,$langs->trans("NoStockAction"))));
$formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete',$formquestion,"yes",1);
}else {
$formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','','',1);
}
} }
// Confirmation de la validation // Confirmation de la validation
@ -2369,7 +2448,17 @@ else if ($id > 0 || ! empty($ref))
} }
$formquestion=array(); $formquestion=array();
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) $qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
{ {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
@ -2393,7 +2482,17 @@ else if ($id > 0 || ! empty($ref))
{ {
$text=$langs->trans('ConfirmUnvalidateBill',$object->ref); $text=$langs->trans('ConfirmUnvalidateBill',$object->ref);
$formquestion=array(); $formquestion=array();
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
$qualified_for_stock_change=0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$qualified_for_stock_change=$object->hasProductsOrServices(2);
}
else
{
$qualified_for_stock_change=$object->hasProductsOrServices(1);
}
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
{ {
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
@ -3604,10 +3703,10 @@ else if ($id > 0 || ! empty($ref))
{ {
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
} }
} }
dol_htmloutput_mesg('',$mesgs); dol_htmloutput_mesg('',$mesgs);
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -1,37 +1,37 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/compta/facture/class/facture.class.php * \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture * \ingroup facture
* \brief File of class to manage invoices * \brief File of class to manage invoices
*/ */
include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php';
require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php';
@ -462,7 +462,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
if (! $error) if (! $error)
@ -633,7 +635,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CLONE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_CLONE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
@ -1073,7 +1077,9 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) {
$error++; $this->errors[]="Error ".$this->db->lasterror();
}
if (! $error) if (! $error)
{ {
@ -1083,7 +1089,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_MODIFY',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// End call triggers // End call triggers
} }
} }
@ -1220,14 +1228,15 @@ class Facture extends CommonInvoice
* *
* @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice * @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($rowid=0, $notrigger=0) function delete($rowid=0, $notrigger=0, $idwarehouse=-1)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! $rowid) $rowid=$this->id; if (empty($rowid)) $rowid=$this->id;
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
@ -1288,6 +1297,26 @@ class Facture extends CommonInvoice
} }
} }
// If we decrament stock on invoice validation, we increment
if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse!=-1)
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
$num=count($this->lines);
for ($i = 0; $i < $num; $i++)
{
if ($this->lines[$i]->fk_product > 0)
{
$mouvP = new MouvementStock($this->db);
// We decrease stock for product
if ($this->type == 2) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceDeleteDolibarr",$this->ref));
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceDeleteDolibarr",$this->ref)); // we use 0 for price, to not change the weighted average value
}
}
}
// Delete invoice line // Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
if ($this->db->query($sql) && $this->delete_linked_contact()) if ($this->db->query($sql) && $this->delete_linked_contact())
@ -1453,7 +1482,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
else else
@ -1508,7 +1539,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
else else
@ -1573,7 +1606,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
$this->db->commit(); $this->db->commit();
@ -1742,7 +1777,9 @@ class Facture extends CommonInvoice
// We decrease stock for product // We decrease stock for product
if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); if ($this->type == 2) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
} }
} }
} }
@ -1794,7 +1831,9 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
} }
@ -3431,7 +3470,9 @@ class FactureLigne
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
@ -3512,7 +3553,7 @@ class FactureLigne
$sql.= ",total_localtax1=".price2num($this->total_localtax1).""; $sql.= ",total_localtax1=".price2num($this->total_localtax1)."";
$sql.= ",total_localtax2=".price2num($this->total_localtax2).""; $sql.= ",total_localtax2=".price2num($this->total_localtax2)."";
} }
$sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; $sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null");
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); $sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang; if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
@ -3528,7 +3569,9 @@ class FactureLigne
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEBILL_UPDATE',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
} }
$this->db->commit(); $this->db->commit();
@ -3564,7 +3607,9 @@ class FactureLigne
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEBILL_DELETE',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
$this->db->commit(); $this->db->commit();

View File

@ -50,7 +50,7 @@ $object->fetch($id,$ref);
if ($action == 'setnote_public' && $user->rights->contrat->creer) if ($action == 'setnote_public' && $user->rights->contrat->creer)
{ {
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_pubic'); $result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_public');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }

View File

@ -64,20 +64,23 @@ class box_produits_alerte_stock extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire) if ($user->rights->produit->lire || $user->rights->service->lire)
{ {
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, s.reel"; $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
$sql.= " AND p.tosell = 1"; $sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
$sql.= " HAVING s.reel < p.seuil_stock_alerte"; $sql.= " GROUP BY p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte";
$sql.= $db->order('s.reel', 'DESC'); $sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
$sql.= $db->order('p.seuil_stock_alerte', 'DESC');
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$langs->load("stocks");
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
@ -128,7 +131,8 @@ class box_produits_alerte_stock extends ModeleBoxes
'text' => $price_base_type); 'text' => $price_base_type);
$this->info_box_contents[$i][4] = array('td' => 'align="center"', $this->info_box_contents[$i][4] = array('td' => 'align="center"',
'text' => $objp->reel . ' / '.$objp->seuil_stock_alerte); 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte,
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit")));
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tosell,3,0)); 'text' => $productstatic->LibStatut($objp->tosell,3,0));
@ -138,7 +142,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$i++; $i++;
} }
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts")); if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts"));
} }
else else
{ {

View File

@ -165,7 +165,8 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
print '</td><td class="nocellnopadd boxclose" nowrap="nowrap">'; print '</td><td class="nocellnopadd boxclose" nowrap="nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"'); print img_picto($langs->trans("MoveBox",$this->box_id),'grip','class="boxhandle hideonsmartphone" style="cursor:move;"');
print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); print img_picto($langs->trans("Close",$this->box_id),'close','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($head['text']).'">';
print '</td></tr></table>'; print '</td></tr></table>';
} }
print '</td>'; print '</td>';

View File

@ -2310,7 +2310,7 @@ abstract class CommonObject
/** /**
* Function to say how many lines object contains * Function to say how many lines object contains
* *
* @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only * @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
* @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found * @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found
*/ */
function hasProductsOrServices($predefined=-1) function hasProductsOrServices($predefined=-1)
@ -2323,6 +2323,8 @@ abstract class CommonObject
if ($predefined == -1) $qualified=1; if ($predefined == -1) $qualified=1;
if ($predefined == 1 && $val->fk_product > 0) $qualified=1; if ($predefined == 1 && $val->fk_product > 0) $qualified=1;
if ($predefined == 0 && $val->fk_product <= 0) $qualified=1; if ($predefined == 0 && $val->fk_product <= 0) $qualified=1;
if ($predefined == 2 && $val->fk_product > 0 && $val->product_type==0) $qualified=1;
if ($predefined == 3 && $val->fk_product > 0 && $val->product_type==1) $qualified=1;
if ($qualified) $nb++; if ($qualified) $nb++;
} }
dol_syslog(get_class($this).'::hasProductsOrServices we found '.$nb.' qualified lines of products/servcies'); dol_syslog(get_class($this).'::hasProductsOrServices we found '.$nb.' qualified lines of products/servcies');

View File

@ -893,9 +893,34 @@ class FormOther
$selectboxlist=$form->selectarray('boxcombo', $arrayboxtoactivatelabel,'',1); $selectboxlist=$form->selectarray('boxcombo', $arrayboxtoactivatelabel,'',1);
} }
// Javascript code for dynamic actions
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
// To update list of activated boxes
function updateBoxOrder(closing) {
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
var right_list = cleanSerialize(jQuery("#right").sortable("serialize"));
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
{
jQuery.ajax({
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
async: false
});
// We force reload to be sure to get all boxes into list
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=delbox\';
}
else
{
jQuery.ajax({
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
async: true
});
}
}
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#boxcombo").change(function() { jQuery("#boxcombo").change(function() {
var boxid=jQuery("#boxcombo").val(); var boxid=jQuery("#boxcombo").val();
@ -912,8 +937,31 @@ class FormOther
});'; });';
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();'; if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
print ' print '
jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */
handle: \'.boxhandle\',
revert: \'invalid\',
items: \'.box\',
containment: \'.fiche\',
connectWith: \'.connectedSortable\',
stop: function(event, ui) {
updateBoxOrder(0);
}
}); });
</script>';
jQuery(".boxclose").click(function() {
var self = this; // because JQuery can modify this
var boxid=self.id.substring(8);
var label=jQuery(\'#boxlabelentry\'+boxid).val();
jQuery(\'#boxto_\'+boxid).remove();
// TODO Add id, label into combo list
updateBoxOrder(1);
});
});'."\n";
print '</script>'."\n";
} }
$nbboxactivated=count($boxidactivatedforuser); $nbboxactivated=count($boxidactivatedforuser);
@ -996,59 +1044,6 @@ class FormOther
print "</td></tr>"; print "</td></tr>";
print "</table>"; print "</table>";
if ($conf->use_javascript_ajax)
{
print "\n";
print '<script type="text/javascript" language="javascript">';
// For moving
print 'jQuery(function() {
jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */
handle: \'.boxhandle\',
revert: \'invalid\',
items: \'.box\',
containment: \'.fiche\',
connectWith: \'.connectedSortable\',
stop: function(event, ui) {
updateBoxOrder(0);
}
});
});
'."\n";
// To update list of activated boxes
print 'function updateBoxOrder(closing) {
var left_list = cleanSerialize(jQuery("#left").sortable("serialize"));
var right_list = cleanSerialize(jQuery("#right").sortable("serialize"));
var boxorder = \'A:\' + left_list + \'-B:\' + right_list;
if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
{
jQuery.ajax({
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
async: false
});
// We force reload to be sure to get all boxes into list
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=delbox\';
}
else
{
jQuery.ajax({
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
async: true
});
}
}'."\n";
// For closing
print 'jQuery(document).ready(function() {
jQuery(".boxclose").click(function() {
var self = this; // because JQuery can modify this
var boxid=self.id.substring(8);
jQuery(\'#boxto_\'+boxid).remove();
updateBoxOrder(1);
});
});'."\n";
print '</script>'."\n";
}
} }
return count($boxactivated); return count($boxactivated);

View File

@ -85,7 +85,8 @@ function user_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); complete_head_from_modules($conf,$langs,$object,$head,$h,'user');
if (! empty($user->societe_id)) //Info on users is visible only by internal user
if (empty($user->societe_id))
{ {
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Note"); $head[$h][1] = $langs->trans("Note");

View File

@ -1,7 +1,18 @@
<?php <?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* Licensed under the GNU GPL v3 or higher (See file gpl-3.0.html) * 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
@ -184,9 +195,10 @@ class modOpenSurvey extends DolibarrModules
*/ */
function init($options='') function init($options='')
{ {
$sql = array(); // Permissions
$this->remove($options);
$result=$this->load_tables(); $sql = array();
return $this->_init($sql,$options); return $this->_init($sql,$options);
} }
@ -205,20 +217,6 @@ class modOpenSurvey extends DolibarrModules
return $this->_remove($sql,$options); return $this->_remove($sql,$options);
} }
/**
* Create tables and keys required by module
* Files mymodule.sql and mymodule.key.sql with create table and create keys
* commands must be stored in directory /mymodule/sql/
* This function is called by this->init.
*
* @return int <=0 if KO, >0 if OK
*/
function load_tables()
{
return $this->_load_tables('/opensurvey/sql/');
}
} }
?> ?>

View File

@ -386,7 +386,7 @@ else if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer) else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }

View File

@ -54,9 +54,9 @@ if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public'); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }
elseif ($action == 'setnote' && $user->rights->fournisseur->commande->creer) elseif ($action == 'setnote_private' && $user->rights->fournisseur->commande->creer)
{ {
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }

View File

@ -61,10 +61,10 @@ padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
input[type=text] { input[type=text], input[type=password] {
border: 1px solid #ACBCBB; border: 1px solid #ACBCBB;
} }
input[type=text]:focus, textarea:focus, select:focus { input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus {
border: 1px solid #ACBCBB; border: 1px solid #ACBCBB;
box-shadow: 0 0 5px #C091AF; box-shadow: 0 0 5px #C091AF;
} }

View File

@ -406,7 +406,7 @@ if (! empty($force_install_message))
<tr class="hidesqlite"> <tr class="hidesqlite">
<td class="label" valign="top"><b><?php echo $langs->trans("Password"); ?></b> <td class="label" valign="top"><b><?php echo $langs->trans("Password"); ?></b>
</td> </td>
<td class="label" valign="top"><input type="text" id="db_pass" autocomplete="off" <td class="label" valign="top"><input type="password" id="db_pass" autocomplete="off"
name="db_pass" name="db_pass"
value="<?php value="<?php
//$autofill=((! empty($dolibarr_main_db_pass))?$dolibarr_main_db_pass:$force_install_databasepass); //$autofill=((! empty($dolibarr_main_db_pass))?$dolibarr_main_db_pass:$force_install_databasepass);
@ -460,7 +460,7 @@ if (! empty($force_install_message))
<tr class="hidesqlite hideroot"> <tr class="hidesqlite hideroot">
<td class="label" valign="top"><b><?php echo $langs->trans("Password"); ?></b> <td class="label" valign="top"><b><?php echo $langs->trans("Password"); ?></b>
</td> </td>
<td class="label" valign="top"><input type="text" autocomplete="off" <td class="label" valign="top"><input type="password" autocomplete="off"
id="db_pass_root" name="db_pass_root" class="needroot" id="db_pass_root" name="db_pass_root" class="needroot"
value="<?php value="<?php
$autofill=((! empty($db_pass_root))?$db_pass_root:$force_install_databaserootpass); $autofill=((! empty($db_pass_root))?$db_pass_root:$force_install_databaserootpass);

View File

@ -306,3 +306,44 @@ create table llx_projet_task_extrafields
import_key varchar(14) -- import key import_key varchar(14) -- import key
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_projet_task_extrafields ADD INDEX idx_projet_task_extrafields (fk_object); ALTER TABLE llx_projet_task_extrafields ADD INDEX idx_projet_task_extrafields (fk_object);
CREATE TABLE llx_opensurvey_comments (
id_comment INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_sondage CHAR(16) NOT NULL,
comment text NOT NULL,
tms timestamp,
usercomment text
) ENGINE=InnoDB;
CREATE TABLE llx_opensurvey_sondage (
id_sondage VARCHAR(16) PRIMARY KEY,
id_sondage_admin CHAR(24),
commentaires text,
mail_admin VARCHAR(128),
nom_admin VARCHAR(64),
titre text,
date_fin datetime,
format VARCHAR(2),
mailsonde varchar(2) DEFAULT '0',
survey_link_visible integer DEFAULT 1,
canedit integer DEFAULT 0,
origin varchar(64),
tms timestamp,
sujet TEXT
) ENGINE=InnoDB;
CREATE TABLE llx_opensurvey_user_studs (
id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
nom VARCHAR(64) NOT NULL,
id_sondage VARCHAR(16) NOT NULL,
reponses VARCHAR(100) NOT NULL,
tms timestamp
) ENGINE=InnoDB;
ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment (id_comment);
ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage (id_sondage);
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin);
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin);
ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users);
ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom);
ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage);

View File

@ -15,8 +15,8 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- ============================================================================ -- ============================================================================
ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment id_comment; ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment (id_comment);
ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage id_sondage; ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage (id_sondage);

View File

@ -15,5 +15,5 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
-- ============================================================================ -- ============================================================================
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin id_sondage_admin; ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin);
ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin date_fin; ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin);

View File

@ -1,6 +1,6 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> -- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
@ -24,3 +24,4 @@ ALTER TABLE llx_product ADD UNIQUE INDEX uk_product_ref (ref, entity);
ALTER TABLE llx_product ADD INDEX idx_product_label (label); ALTER TABLE llx_product ADD INDEX idx_product_label (label);
ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode); ALTER TABLE llx_product ADD INDEX idx_product_barcode (barcode);
ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key); ALTER TABLE llx_product ADD INDEX idx_product_import_key (import_key);
ALTER TABLE llx_product ADD INDEX idx_product_seuil_stock_alerte (seuil_stock_alerte);

View File

@ -40,6 +40,7 @@ ActionsEvents= Events for which Dolibarr will create an action in agenda automat
PropalValidatedInDolibarr= Proposal %s validated PropalValidatedInDolibarr= Proposal %s validated
InvoiceValidatedInDolibarr= Invoice %s validated InvoiceValidatedInDolibarr= Invoice %s validated
InvoiceBackToDraftInDolibarr=Invoice %s go back to draft status InvoiceBackToDraftInDolibarr=Invoice %s go back to draft status
InvoiceDeleteDolibarr=Invoice %s deleted
OrderValidatedInDolibarr= Order %s validated OrderValidatedInDolibarr= Order %s validated
OrderApprovedInDolibarr=Order %s approved OrderApprovedInDolibarr=Order %s approved
OrderBackToDraftInDolibarr=Order %s go back to draft status OrderBackToDraftInDolibarr=Order %s go back to draft status

View File

@ -55,6 +55,7 @@ DeStockOnShipment=Decrease real stocks on shipment validation
ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation
ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation
ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving
ReStockOnDeleteInvoice=Increase real stocks on invoice deletion
OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses.
StockDiffPhysicTeoric=Reason for difference stock physical and theoretical StockDiffPhysicTeoric=Reason for difference stock physical and theoretical
NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required. NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required.
@ -86,4 +87,5 @@ PersonalStock=Personal stock %s
ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s
SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease
SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase
NoStockAction=No stock action
LastWaitingSupplierOrders=Orders waiting for receptions LastWaitingSupplierOrders=Orders waiting for receptions

View File

@ -41,6 +41,7 @@ ActionsEvents=Eventos para que Dolibarr cree una acción de forma automática
PropalValidatedInDolibarr=Presupuesto %s validado PropalValidatedInDolibarr=Presupuesto %s validado
InvoiceValidatedInDolibarr=Factura %s validada InvoiceValidatedInDolibarr=Factura %s validada
InvoiceBackToDraftInDolibarr=Factura %s devuelta a borrador InvoiceBackToDraftInDolibarr=Factura %s devuelta a borrador
InvoiceDeleteDolibarr=Factura %s eliminada
OrderValidatedInDolibarr=Pedido %s validado OrderValidatedInDolibarr=Pedido %s validado
OrderApprovedInDolibarr=Pedido %s aprobado OrderApprovedInDolibarr=Pedido %s aprobado
OrderBackToDraftInDolibarr=Pedido %s devuelto a borrador OrderBackToDraftInDolibarr=Pedido %s devuelto a borrador

View File

@ -54,6 +54,7 @@ DeStockOnShipment=Decrementar los stocks físicos sobre los envíos
ReStockOnBill=Incrementar los stocks físicos sobre las facturas/abonos de proveedores ReStockOnBill=Incrementar los stocks físicos sobre las facturas/abonos de proveedores
ReStockOnValidateOrder=Incrementar los stocks físicos sobre los pedidos a proveedores ReStockOnValidateOrder=Incrementar los stocks físicos sobre los pedidos a proveedores
ReStockOnDispatchOrder=Incrementa los stocks físicos en el desglose manual de la recepción de los pedidos a proveedores en los almacenes ReStockOnDispatchOrder=Incrementa los stocks físicos en el desglose manual de la recepción de los pedidos a proveedores en los almacenes
ReStockOnDeleteInvoice=Incrementa los stocks físicos en la eliminación de facturas
OrderStatusNotReadyToDispatch=El pedido aún no está o no tiene un estado que permita un desglose de stock. OrderStatusNotReadyToDispatch=El pedido aún no está o no tiene un estado que permita un desglose de stock.
StockDiffPhysicTeoric=Motivo de la diferencia entre valores físicos y teóricos StockDiffPhysicTeoric=Motivo de la diferencia entre valores físicos y teóricos
NoPredefinedProductToDispatch=No hay productos predefinidos en este objeto. Por lo tanto no se puede realizar un desglose de stock. NoPredefinedProductToDispatch=No hay productos predefinidos en este objeto. Por lo tanto no se puede realizar un desglose de stock.
@ -85,4 +86,5 @@ PersonalStock=Stock personal %s
ThisWarehouseIsPersonalStock=Este almacén representa el stock personal de %s %s ThisWarehouseIsPersonalStock=Este almacén representa el stock personal de %s %s
SelectWarehouseForStockDecrease=Seleccione el almacén a usar en el decremento de stock SelectWarehouseForStockDecrease=Seleccione el almacén a usar en el decremento de stock
SelectWarehouseForStockIncrease=Seleccione el almacén a usar en el incremento de stock SelectWarehouseForStockIncrease=Seleccione el almacén a usar en el incremento de stock
NoStockAction=Sin acciones sobre el stock
LastWaitingSupplierOrders=Pedidos en espera de recepción LastWaitingSupplierOrders=Pedidos en espera de recepción

View File

@ -40,6 +40,7 @@ ActionsEvents=Événements pour lesquels Dolibarr doit créer une action dans l'
PropalValidatedInDolibarr=Proposition %s validée PropalValidatedInDolibarr=Proposition %s validée
InvoiceValidatedInDolibarr=Facture %s validée InvoiceValidatedInDolibarr=Facture %s validée
InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon
InvoiceDeleteDolibarr=Facture %s supprimée
OrderValidatedInDolibarr=Commande %s validée OrderValidatedInDolibarr=Commande %s validée
OrderApprovedInDolibarr=Commande %s approuvée OrderApprovedInDolibarr=Commande %s approuvée
OrderBackToDraftInDolibarr=Commande %s repassée en brouillon OrderBackToDraftInDolibarr=Commande %s repassée en brouillon

View File

@ -55,6 +55,7 @@ DeStockOnShipment=Décrémente les stocks physiques sur validation des expéditi
ReStockOnBill=Incrémente les stocks physiques sur validation des factures/avoirs fournisseurs ReStockOnBill=Incrémente les stocks physiques sur validation des factures/avoirs fournisseurs
ReStockOnValidateOrder=Incrémente les stocks physiques sur approbation des commandes fournisseurs ReStockOnValidateOrder=Incrémente les stocks physiques sur approbation des commandes fournisseurs
ReStockOnDispatchOrder=Incrémente les stocks physiques sur ventilation manuelle de la réception des commandes fournisseurs dans les entrepôts ReStockOnDispatchOrder=Incrémente les stocks physiques sur ventilation manuelle de la réception des commandes fournisseurs dans les entrepôts
ReStockOnDeleteInvoice=Incrémente les stocks physiques sur la suppression des factures
OrderStatusNotReadyToDispatch=La commande n'a pas encore ou n'a plus un statut permettant une ventilation en stock. OrderStatusNotReadyToDispatch=La commande n'a pas encore ou n'a plus un statut permettant une ventilation en stock.
StockDiffPhysicTeoric=Raison écart stock physique-théorique StockDiffPhysicTeoric=Raison écart stock physique-théorique
NoPredefinedProductToDispatch=Pas de produits prédéfinis dans cet objet. Aucune ventilation en stock n'est donc à faire. NoPredefinedProductToDispatch=Pas de produits prédéfinis dans cet objet. Aucune ventilation en stock n'est donc à faire.
@ -86,4 +87,5 @@ PersonalStock=Stock personnel %s
ThisWarehouseIsPersonalStock=Cet entrepôt représente le stock personnel de %s %s ThisWarehouseIsPersonalStock=Cet entrepôt représente le stock personnel de %s %s
SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la décrémentation du stock SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la décrémentation du stock
SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock
NoStockAction=Pas d'action sur l'entrepot
LastWaitingSupplierOrders=Commandes en attente de réception LastWaitingSupplierOrders=Commandes en attente de réception

View File

@ -109,9 +109,10 @@ class FormProduct
* @param int $empty 1=Can be empty, 0 if not * @param int $empty 1=Can be empty, 0 if not
* @param int $disabled 1=Select is disabled * @param int $disabled 1=Select is disabled
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
* @param string $empty_label Empty label if needed (only if $empty=1)
* @return string HTML select * @return string HTML select
*/ */
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0) function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='')
{ {
global $langs,$user; global $langs,$user;
@ -120,7 +121,7 @@ class FormProduct
$this->loadWarehouses($fk_product); $this->loadWarehouses($fk_product);
$out='<select class="flat"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">'; $out='<select class="flat"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.($htmlname.($disabled?'_disabled':'')).'">';
if ($empty) $out.='<option value="-1">&nbsp;</option>'; if ($empty) $out.='<option value="-1">'.($empty_label?$empty_label:'&nbsp;').'</option>';
foreach($this->cache_warehouses as $id => $arraytypes) foreach($this->cache_warehouses as $id => $arraytypes)
{ {
$out.='<option value="'.$id.'"'; $out.='<option value="'.$id.'"';

View File

@ -693,7 +693,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.GETPOST('libelle').'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" maxlength="255" value="'.GETPOST('libelle').'"></td></tr>';
// On sell // On sell
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
@ -866,7 +866,7 @@ else
print '<tr><td width="15%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$object->ref.'"></td></tr>'; print '<tr><td width="15%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$object->ref.'"></td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="2"><input name="libelle" size="40" value="'.$object->libelle.'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="2"><input name="libelle" size="40" maxlength="255" value="'.$object->libelle.'"></td></tr>';
// Status // Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="2">';

View File

@ -1048,7 +1048,7 @@ class Project extends CommonObject
} }
$this->db->begin(); $this->db->begin();
$res=$clone_project->update_note(dol_html_entity_decode($clone_project->note_private, ENT_QUOTES)); $res=$clone_project->update_note(dol_html_entity_decode($clone_project->note_private, ENT_QUOTES), '_private');
if ($res < 0) if ($res < 0)
{ {
$this->error.=$clone_project->error; $this->error.=$clone_project->error;

View File

@ -1064,7 +1064,7 @@ class Task extends CommonObject
} }
$this->db->begin(); $this->db->begin();
$res=$clone_task->update_note(dol_html_entity_decode($clone_task->note_private, ENT_QUOTES)); $res=$clone_task->update_note(dol_html_entity_decode($clone_task->note_private, ENT_QUOTES), '_private');
if ($res < 0) if ($res < 0)
{ {
$this->error.=$clone_task->error; $this->error.=$clone_task->error;

View File

@ -63,7 +63,7 @@ if ($action == 'setnote_public' && $user->rights->projet->creer)
if ($action == 'setnote_private' && $user->rights->projet->creer) if ($action == 'setnote_private' && $user->rights->projet->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }

View File

@ -93,7 +93,7 @@ if ($action == 'setnote_public' && ! empty($permission))
else if ($action == 'setnote_private' && ! empty($permission)) else if ($action == 'setnote_private' && ! empty($permission))
{ {
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private');
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }

View File

@ -58,7 +58,7 @@ if ($action == 'update' && $user->rights->user->user->creer && ! $_POST["cancel"
{ {
$db->begin(); $db->begin();
$res=$fuser->update_note($_POST["note"],$user); $res=$fuser->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
if ($res < 0) if ($res < 0)
{ {
$mesg='<div class="error">'.$adh->error.'</div>'; $mesg='<div class="error">'.$adh->error.'</div>';

View File

@ -260,7 +260,7 @@ print '</tr>'."\n";
// Lastname // Lastname
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>'; print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
print '<td>'.$fuser->lastName.'</td>'; print '<td>'.$fuser->lastname.'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Firstname // Firstname