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

This commit is contained in:
Laurent Destailleur 2011-11-15 13:32:04 +01:00
commit 11a6bf651b
38 changed files with 476 additions and 308 deletions

View File

@ -26,6 +26,7 @@ For users:
- New: Add hidden option MAIN_DISABLE_PDF_AUTOUPDATE to avoid generating pdf each time data change. - New: Add hidden option MAIN_DISABLE_PDF_AUTOUPDATE to avoid generating pdf each time data change.
- New: Add hidden option PROJECT_HIDE_UNSELECTABLES to hide project you can't select into combo list. - New: Add hidden option PROJECT_HIDE_UNSELECTABLES to hide project you can't select into combo list.
- New: Add option INVOICE_POSITIVE_CREDIT_NOTE. - New: Add option INVOICE_POSITIVE_CREDIT_NOTE.
- New: Support zip/town autocompletion into warehouses.
- Fix: Can use POS module with several concurrent users. - Fix: Can use POS module with several concurrent users.
For developers: For developers:

View File

@ -102,7 +102,7 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("Parameters")."</td>\n"; print " <td>".$langs->trans("Parameters")."</td>\n";
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n"; print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
/* /*
@ -128,7 +128,7 @@ print "</tr>\n";
// Title rule for stock decrease // Title rule for stock decrease
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n"; print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n"; print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;
@ -178,7 +178,7 @@ if ($conf->expedition->enabled)
// Title rule for stock increase // Title rule for stock increase
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n"; print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n"; print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;

View File

@ -1045,9 +1045,7 @@ if ($id > 0 || ! empty($ref))
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline','',0,1);
} }
/* // Confirm validate proposal
* Confirmation de la validation de la propale
*/
if ($action == 'validate') if ($action == 'validate')
{ {
$error=0; $error=0;

View File

@ -108,7 +108,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,'FILE_DELETE',$object); dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
} }
} }

View File

@ -315,11 +315,13 @@ class Commande extends CommonObject
} }
/** /**
* \brief Set draft status * Set draft status
* \param user Object user that modify *
* \return int <0 if KO, >0 if OK * @param User $user Object user that modify
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/ */
function set_draft($user) function set_draft($user, $idwarehouse=-1)
{ {
global $conf,$langs; global $conf,$langs;
@ -343,7 +345,7 @@ class Commande extends CommonObject
$sql.= " SET fk_statut = 0"; $sql.= " SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("Commande::set_draft sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// If stock is decremented on validate order, we must reincrement it // If stock is decremented on validate order, we must reincrement it
@ -359,8 +361,7 @@ class Commande extends CommonObject
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }

View File

@ -111,7 +111,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,'FILE_DELETE',$object); dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
} }
} }

View File

@ -382,7 +382,7 @@ if ($action == 'setremise' && $user->rights->commande->creer)
$object->set_remise($user, $_POST['remise']); $object->set_remise($user, $_POST['remise']);
} }
if ($action == "setabsolutediscount" && $user->rights->commande->creer) if ($action == 'setabsolutediscount' && $user->rights->commande->creer)
{ {
if ($_POST["remise_id"]) if ($_POST["remise_id"])
{ {
@ -775,6 +775,45 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->command
} }
} }
// Go back to draft status
if ($action == 'confirm_modif' && $user->rights->commande->creer)
{
$idwarehouse=GETPOST('idwarehouse');
$object->fetch($id); // Load order and lines
$object->fetch_thirdparty();
// Check parameters
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1))
{
if (! $idwarehouse || $idwarehouse == -1)
{
$error++;
$errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
$action='';
}
}
if (! $error)
{
$result = $object->set_draft($user,$idwarehouse);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
}
}
}
if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->commande->cloturer) if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->commande->cloturer)
{ {
$object->fetch($id); // Load order and lines $object->fetch($id); // Load order and lines
@ -790,30 +829,6 @@ if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande-
$result = $object->cancel($user); $result = $object->cancel($user);
} }
if ($action == 'modif' && $user->rights->commande->creer)
{
/*
* Repasse la commande en mode brouillon
*/
$object->fetch($id); // Load order and lines
$object->fetch_thirdparty();
$result = $object->set_draft($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
}
}
/* /*
* Ordonnancement des lignes * Ordonnancement des lignes
@ -1492,9 +1507,30 @@ else
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
} }
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 240); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
} }
// Confirm back to draft status
if ($action == 'modif')
{
$text=$langs->trans('ConfirmUnvalidateOrder',$object->ref);
$formquestion=array();
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $object->hasProductsOrServices(1))
{
$langs->load("stocks");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
$formproduct=new FormProduct($db);
$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' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
}
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
}
/* /*
* Confirmation de la cloture * Confirmation de la cloture
*/ */

View File

@ -321,7 +321,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->v
$object->fetch_thirdparty(); $object->fetch_thirdparty();
// Check parameters // Check parameters
if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
{ {
if (! $idwarehouse || $idwarehouse == -1) if (! $idwarehouse || $idwarehouse == -1)
{ {
@ -355,56 +355,72 @@ if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->v
} }
} }
// Repasse la facture en mode brouillon (unvalidate) // Go back to draft status (unvalidate)
if ($action == 'modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
{ {
$idwarehouse=GETPOST('idwarehouse');
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
// On verifie si la facture a des paiements // Check parameters
$sql = 'SELECT pf.amount'; if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$result = $db->query($sql);
if ($result)
{ {
$i = 0; if (! $idwarehouse || $idwarehouse == -1)
$num = $db->num_rows($result);
while ($i < $num)
{ {
$objp = $db->fetch_object($result); $error++;
$totalpaye += $objp->amount; $errors[]=$langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("Warehouse"));
$i++; $action='';
} }
} }
else
if (! $error)
{ {
dol_print_error($db,''); // On verifie si la facture a des paiements
} $sql = 'SELECT pf.amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$resteapayer = $object->total_ttc - $totalpaye; $result = $db->query($sql);
if ($result)
{
$i = 0;
$num = $db->num_rows($result);
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees while ($i < $num)
$ventilExportCompta = $object->getVentilExportCompta(); {
$objp = $db->fetch_object($result);
$totalpaye += $objp->amount;
$i++;
}
}
else
{
dol_print_error($db,'');
}
// On verifie si aucun paiement n'a ete effectue $resteapayer = $object->total_ttc - $totalpaye;
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
{
$object->set_draft($user);
// Define output language // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$outputlangs = $langs; $ventilExportCompta = $object->getVentilExportCompta();
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; // On verifie si aucun paiement n'a ete effectue
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
if (! empty($newlang)) {
{ $object->set_draft($user, $idwarehouse);
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); // Define output language
} $outputlangs = $langs;
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
}
} }
} }
@ -1985,7 +2001,7 @@ else
$text.=$notify->confirmMessage('NOTIFY_VAL_FAC',$object->socid); $text.=$notify->confirmMessage('NOTIFY_VAL_FAC',$object->socid);
} }
$formquestion=array(); $formquestion=array();
if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
{ {
$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");
@ -2000,6 +2016,26 @@ else
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid',$formquestion,"yes",($conf->notification->enabled?0:2)); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid',$formquestion,"yes",($conf->notification->enabled?0:2));
} }
// Confirm back to draft status
if ($action == 'modif')
{
$text=$langs->trans('ConfirmUnvalidateBill',$object->ref);
$formquestion=array();
if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1))
{
$langs->load("stocks");
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
$formproduct=new FormProduct($db);
$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' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
}
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('UnvalidateBill'),$text,'confirm_modif',$formquestion,"yes",1);
}
// Confirmation du classement paye // Confirmation du classement paye
if ($action == 'paid' && $resteapayer <= 0) if ($action == 'paid' && $resteapayer <= 0)
{ {
@ -2877,7 +2913,8 @@ else
$delallowed=$user->rights->facture->supprimer; $delallowed=$user->rights->facture->supprimer;
print '<br>'; print '<br>';
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$hookmanager); print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$hookmanager);
$somethingshown=$formfile->numoffiles;
/* /*
* Linked object block * Linked object block

View File

@ -1249,6 +1249,7 @@ class Facture extends CommonObject
/** /**
* Renvoi une date limite de reglement de facture en fonction des * Renvoi une date limite de reglement de facture en fonction des
* conditions de reglements de la facture et date de facturation * conditions de reglements de la facture et date de facturation
*
* @param cond_reglement_id Condition de reglement a utiliser, 0=Condition actuelle de la facture * @param cond_reglement_id Condition de reglement a utiliser, 0=Condition actuelle de la facture
* @return date Date limite de reglement si ok, <0 si ko * @return date Date limite de reglement si ok, <0 si ko
*/ */
@ -1308,11 +1309,12 @@ class Facture extends CommonObject
} }
/** /**
* Tag la facture comme paye completement (close_code non renseigne) ou partiellement (close_code renseigne) + appel trigger BILL_PAYED * Tag la facture comme paye completement (close_code non renseigne) ou partiellement (close_code renseigne) + appel trigger BILL_PAYED
* @param user Objet utilisateur qui modifie *
* @param close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param User $user Objet utilisateur qui modifie
* @param close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @return int <0 si ok, >0 si ok * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
* @return int <0 if KO, >0 if OK
*/ */
function set_paid($user,$close_code='',$close_note='') function set_paid($user,$close_code='',$close_note='')
{ {
@ -1367,11 +1369,12 @@ class Facture extends CommonObject
/** /**
* \brief Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse, * Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte. * ou quand une facture annulee et reouverte.
* \param user Object user that change status *
* \return int <0 si ok, >0 si ok * @param User $user Object user that change status
* @return int <0 if KO, >0 if OK
*/ */
function set_unpaid($user) function set_unpaid($user)
{ {
@ -1416,17 +1419,20 @@ class Facture extends CommonObject
/** /**
* \brief Tag la facture comme abandonnee, sans paiement dessus (exemple car facture de remplacement) + appel trigger BILL_CANCEL * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
* \param user Objet utilisateur qui modifie * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* \param close_code Code de fermeture * of no payment even if merchandises were sent).
* \param close_note Commentaire de fermeture *
* \return int <0 si ok, >0 si ok * @param User $user Object user making change
* @param string $close_code Code de fermeture
* @param string $close_note Comment
* @return int <0 if KO, >0 if OK
*/ */
function set_canceled($user,$close_code='',$close_note='') function set_canceled($user,$close_code='',$close_note='')
{ {
global $conf,$langs; global $conf,$langs;
dol_syslog("Facture::set_canceled rowid=".$this->id, LOG_DEBUG); dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin(); $this->db->begin();
@ -1475,6 +1481,7 @@ class Facture extends CommonObject
/** /**
* Tag invoice as validated + call trigger BILL_VALIDATE * Tag invoice as validated + call trigger BILL_VALIDATE
* Object must have lines loaded with fetch_lines
* *
* @param User $user Object user that validate * @param User $user Object user that validate
* @param string $force_number Reference to force on invoice * @param string $force_number Reference to force on invoice
@ -1488,7 +1495,7 @@ class Facture extends CommonObject
$error=0; $error=0;
// Protection // Check parameters
if (! $this->brouillon) if (! $this->brouillon)
{ {
dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING); dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING);
@ -1602,7 +1609,7 @@ class Facture extends CommonObject
$result=$this->client->set_as_client(); $result=$this->client->set_as_client();
// Si active on decremente le produit principal et ses composants a la validation de facture // Si active on decremente le produit principal et ses composants a la validation de facture
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL)
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
@ -1615,7 +1622,8 @@ class Facture extends CommonObject
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrease stock for product // We decrease stock for product
$result=$mouvP->livraison($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));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }
@ -1692,10 +1700,10 @@ class Facture extends CommonObject
* Set draft status * Set draft status
* *
* @param User $user Object user that modify * @param User $user Object user that modify
* @param int $idwarehouse Id warehouse to use for stock change * @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 set_draft($user,$idwarehouse=0) function set_draft($user,$idwarehouse=-1)
{ {
global $conf,$langs; global $conf,$langs;
@ -1714,10 +1722,11 @@ class Facture extends CommonObject
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) $result=$this->db->query($sql);
if ($result)
{ {
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement // Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL)
{ {
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda"); $langs->load("agenda");
@ -1729,8 +1738,8 @@ class Facture extends CommonObject
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We decrease stock for product // We decrease stock for product
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot if ($this->type == 2) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref)); else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
} }
} }
} }

View File

@ -113,7 +113,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,'FILE_DELETE',$object); dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
} }
} }

View File

@ -60,7 +60,8 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
$subelement = $regs[2]; $subelement = $regs[2];
} }
if ($element == 'fichinter') $element = 'ficheinter'; if ($element == 'propal') $element = 'propale';
else if ($element == 'fichinter') $element = 'ficheinter';
if ($user->rights->$element->lire || $user->rights->$element->read if ($user->rights->$element->lire || $user->rights->$element->read
|| $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read) || $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read)

View File

@ -66,7 +66,8 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
$subelement = $regs[2]; $subelement = $regs[2];
} }
if ($element == 'fichinter') $element = 'ficheinter'; if ($element == 'propal') $element = 'propale';
else if ($element == 'fichinter') $element = 'ficheinter';
if ($user->rights->$element->creer || $user->rights->$element->write if ($user->rights->$element->creer || $user->rights->$element->write
|| $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write) || $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write)

View File

@ -2242,7 +2242,7 @@ class Form
if (is_array($formquestion) && count($formquestion) > 0) if (is_array($formquestion) && count($formquestion) > 0)
{ {
$more.='<table class="nobordernopadding" width="100%">'."\n"; $more.='<table class="paddingrightonly" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n"; $more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
@ -2258,8 +2258,8 @@ class Form
} }
else if ($input['type'] == 'select') else if ($input['type'] == 'select')
{ {
$more.='<tr><td valign="top">'; $more.='<tr><td valign="top" style="padding: 4px !important;">';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">'; if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left" style="padding: 4px !important;">';
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1); $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }

View File

@ -134,7 +134,7 @@ class FormActions
$total = 0; $var=true; $total = 0; $var=true;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>'; print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans('Ref').'</th><th class="liste_titre">'.$langs->trans('Date').'</th><th class="liste_titre">'.$langs->trans('Action').'</th><th class="liste_titre">'.$langs->trans('By').'</th></tr>';
print "\n"; print "\n";
foreach($actioncomm->actions as $action) foreach($actioncomm->actions as $action)

View File

@ -369,12 +369,12 @@ class FormFile
$out.= '<div class="titre">'.$titletoshow.'</div>'; $out.= '<div class="titre">'.$titletoshow.'</div>';
$out.= '<table class="border formdoc" summary="listofdocumentstable" width="100%">'; $out.= '<table class="border formdoc" summary="listofdocumentstable" width="100%">';
$out.= '<tr '.$bc[$var].'>'; $out.= '<tr class="liste_titre">';
// Model // Model
if (! empty($modellist)) if (! empty($modellist))
{ {
$out.= '<td align="center" class="formdoc">'; $out.= '<th align="center" class="formdoc liste_titre">';
$out.= $langs->trans('Model').' '; $out.= $langs->trans('Model').' ';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{ {
@ -382,17 +382,17 @@ class FormFile
$modelselected=$arraykeys[0]; $modelselected=$arraykeys[0];
} }
$out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0); $out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0);
$out.= '</td>'; $out.= '</th>';
} }
else else
{ {
$out.= '<td align="left" class="formdoc">'; $out.= '<th align="left" class="formdoc liste_titre">';
$out.= $langs->trans("Files"); $out.= $langs->trans("Files");
$out.= '</td>'; $out.= '</th>';
} }
// Language code (if multilang) // Language code (if multilang)
$out.= '<td align="center" class="formdoc">'; $out.= '<th align="center" class="formdoc liste_titre">';
if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang) if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
{ {
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php');
@ -404,10 +404,10 @@ class FormFile
{ {
$out.= '&nbsp;'; $out.= '&nbsp;';
} }
$out.= '</td>'; $out.= '</th>';
// Button // Button
$out.= '<td align="center" colspan="'.($delallowed?'2':'1').'" class="formdocbutton">'; $out.= '<th align="center" colspan="'.($delallowed?'2':'1').'" class="formdocbutton liste_titre">';
$out.= '<input class="button" id="'.$forname.'_generatebutton"'; $out.= '<input class="button" id="'.$forname.'_generatebutton"';
$out.= ' type="submit" value="'.$buttonlabel.'"'; $out.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $out.= ' disabled="disabled"'; if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $out.= ' disabled="disabled"';
@ -417,7 +417,7 @@ class FormFile
$langs->load("errors"); $langs->load("errors");
$out.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); $out.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
} }
$out.= '</td>'; $out.= '</th>';
$out.= '</tr>'; $out.= '</tr>';

View File

@ -23,8 +23,9 @@
/** /**
* Return user/group account of web server * Return user/group account of web server
* @param $mode 'user' or 'group' *
* @return string * @param string $mode 'user' or 'group'
* @return string Return user or group of web server
*/ */
function dol_getwebuser($mode) function dol_getwebuser($mode)
{ {
@ -37,15 +38,16 @@ function dol_getwebuser($mode)
/** /**
* Scan a directory and return a list of files/directories. * Scan a directory and return a list of files/directories.
* Content for string is UTF8 and dir separator is "/". * Content for string is UTF8 and dir separator is "/".
* @param $path Starting path from which to search *
* @param $types Can be "directories", "files", or "all" * @param string $path Starting path from which to search
* @param $recursive Determines whether subdirectories are searched * @param string $types Can be "directories", "files", or "all"
* @param $filter Regex for include filter * @param int $recursive Determines whether subdirectories are searched
* @param $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.') * @param string $filter Regex for include filter
* @param $sortcriteria Sort criteria ("","name","date","size") * @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')
* @param $sortorder Sort order (SORT_ASC, SORT_DESC) * @param string $sortcriteria Sort criteria ("","name","date","size")
* @param $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only * @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file') * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
*/ */
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0) function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
{ {
@ -152,9 +154,10 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
/** /**
* Fast compare of 2 files identified by their properties ->name, ->date and ->size * Fast compare of 2 files identified by their properties ->name, ->date and ->size
* @param $a File 1 *
* @param $b File 2 * @param string $a File 1
* @return int 1, 0, 1 * @param string $b File 2
* @return int 1, 0, 1
*/ */
function dol_compare_file($a, $b) function dol_compare_file($a, $b)
{ {
@ -186,12 +189,11 @@ function dol_compare_file($a, $b)
/** /**
* Return mime type of a file * Return mime type of a file
* *
* @param file Filename we looking for MIME type * @param string $file Filename we looking for MIME type
* @param default Default mime type if extension not found in known list * @param string $default Default mime type if extension not found in known list
* @param mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language
* @return string Return a mime type family * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive)
* (text/xxx, application/xxx, image/xxx, audio, video, archive) * @see image_format_supported (images.lib.php)
* @see image_format_supported (images.lib.php)
*/ */
function dol_mimetype($file,$default='application/octet-stream',$mode=0) function dol_mimetype($file,$default='application/octet-stream',$mode=0)
{ {
@ -295,10 +297,10 @@ function dol_mimetype($file,$default='application/octet-stream',$mode=0)
/** /**
* Test if filename is a directory * Test if filename is a directory
* *
* @param folder Name of folder * @param string $folder Name of folder
* @return boolean True if it's a directory, False if not found * @return boolean True if it's a directory, False if not found
*/ */
function dol_is_dir($folder) function dol_is_dir($folder)
{ {
@ -310,8 +312,8 @@ function dol_is_dir($folder)
/** /**
* Return if path is a file * Return if path is a file
* *
* @param $pathoffile * @param string $pathoffile Path of file
* @return boolean True or false * @return boolean True or false
*/ */
function dol_is_file($pathoffile) function dol_is_file($pathoffile)
{ {
@ -322,8 +324,8 @@ function dol_is_file($pathoffile)
/** /**
* Return if path is an URL * Return if path is an URL
* *
* @param $url * @param string $url Url
* @return boolean True or false * @return boolean True or false
*/ */
function dol_is_url($url) function dol_is_url($url)
{ {
@ -339,8 +341,8 @@ function dol_is_url($url)
/** /**
* Test if a folder is empty * Test if a folder is empty
* *
* @param folder Name of folder * @param string $folder Name of folder
* @return boolean True if dir is empty or non-existing, False if it contains files * @return boolean True if dir is empty or non-existing, False if it contains files
*/ */
function dol_dir_is_emtpy($folder) function dol_dir_is_emtpy($folder)
{ {
@ -365,8 +367,9 @@ function dol_dir_is_emtpy($folder)
/** /**
* Count number of lines in a file * Count number of lines in a file
* @param file Filename *
* @return int <0 if KO, Number of lines in files if OK * @param string $file Filename
* @return int <0 if KO, Number of lines in files if OK
*/ */
function dol_count_nb_of_line($file) function dol_count_nb_of_line($file)
{ {
@ -395,8 +398,9 @@ function dol_count_nb_of_line($file)
/** /**
* Return size of a file * Return size of a file
* @param $pathoffile *
* @return string File size * @param tring $pathoffile Path of file
* @return string File size
*/ */
function dol_filesize($pathoffile) function dol_filesize($pathoffile)
{ {
@ -406,8 +410,9 @@ function dol_filesize($pathoffile)
/** /**
* Return time of a file * Return time of a file
* @param $pathoffile *
* @return timestamp Time of file * @param string $pathoffile Path of file
* @return timestamp Time of file
*/ */
function dol_filemtime($pathoffile) function dol_filemtime($pathoffile)
{ {
@ -446,11 +451,12 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
/** /**
* Move a file into another name * Move a file into another name
* @param $srcfile Source file (can't be a directory) *
* @param $destfile Destination file (can't be a directory) * @param string $srcfile Source file (can't be a directory)
* @param $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) * @param string $destfile Destination file (can't be a directory)
* @param $overwriteifexists Overwrite file if exists (1 by default) * @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
* @return boolean True if OK, false if KO * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return boolean True if OK, false if KO
*/ */
function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1) function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
{ {
@ -475,13 +481,14 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
/** /**
* Move an uploaded file after some controls. * Move an uploaded file after some controls.
* If there is errors (virus found, antivir in error, bad filename), file is not moved. * If there is errors (virus found, antivir in error, bad filename), file is not moved.
* @param src_file Source full path filename ($_FILES['field']['tmp_name']) *
* @param dest_file Target full path filename * @param string $src_file Source full path filename ($_FILES['field']['tmp_name'])
* @param allowoverwrite 1=Overwrite target file if it already exists * @param string $dest_file Target full path filename
* @param disablevirusscan 1=Disable virus scan * @param int $allowoverwrite 1=Overwrite target file if it already exists
* @param uploaderrorcode Value of upload error code ($_FILES['field']['error']) * @param int $disablevirusscan 1=Disable virus scan
* @param notrigger Disable all triggers * @param string $uploaderrorcode Value of upload error code ($_FILES['field']['error'])
* @return int >0 if OK, <0 or string if KO * @param int $notrigger Disable all triggers
* @return int >0 if OK, <0 or string if KO
*/ */
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0) function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $notrigger=0)
{ {
@ -606,15 +613,14 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
/** /**
* Remove a file or several files with a mask * Remove a file or several files with a mask
* *
* @param file File to delete or mask of file to delete * @param string $file File to delete or mask of file to delete
* @param disableglob Disable usage of glob like * * @param int $disableglob Disable usage of glob like *
* @param nophperrors Disable all PHP output errors * @param int $nophperrors Disable all PHP output errors
* @param notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @param triggercode Code of trigger TODO ???? why ? * @param Object $object Object
* @param object Object for trigger * @return boolean True if file is deleted, False if error
* @return boolean True if file is deleted, False if error
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$triggercode='FILE_DELETE',$object=null) function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$object=null)
{ {
global $db, $conf, $user, $langs; global $db, $conf, $user, $langs;
@ -635,10 +641,11 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$trigg
if (! is_object($object)) $object=(object) 'dummy'; if (! is_object($object)) $object=(object) 'dummy';
$object->src_file=$file; $object->src_file=$file;
// TODO Replace trigger by a hook. Triggers must be used for business events only.
// Appel des triggers // Appel des triggers
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($triggercode,$object,$user,$langs,$conf); $result=$interface->run_triggers('FILE_DELETE',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $errors=$interface->errors; } if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
} }
@ -660,9 +667,9 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$trigg
* Remove a directory (not recursive, so content must be empty). * Remove a directory (not recursive, so content must be empty).
* If directory is not empty, return false * If directory is not empty, return false
* *
* @param dir Directory to delete * @param string $dir Directory to delete
* @param nophperrors Disable all PHP output errors * @param int $nophperrors Disable all PHP output errors
* @return boolean True if success, false if error * @return boolean True if success, false if error
*/ */
function dol_delete_dir($dir,$nophperrors=0) function dol_delete_dir($dir,$nophperrors=0)
{ {
@ -886,10 +893,11 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
/** /**
* Remove an uploaded file (for example after submitting a new file a mail form). * Remove an uploaded file (for example after submitting a new file a mail form).
* All information used are in db, conf, langs, user and _FILES. * All information used are in db, conf, langs, user and _FILES.
* @param filenb File nb to delete *
* @param donotupdatesession 1=Do not edit _SESSION variable * @param int $filenb File nb to delete
* @param donotdeletefile 1=Do not delete physically file * @param int $donotupdatesession 1=Do not edit _SESSION variable
* @return string Message with result of upload and store. * @param int $donotdeletefile 1=Do not delete physically file
* @return string Message with result of upload and store.
*/ */
function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0) function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0)
{ {

View File

@ -380,11 +380,13 @@ class CommandeFournisseur extends Commande
/** /**
* Set draft status * Set draft status
* TODO This method seems to be never called.
* *
* @param User $user Object user that modify * @param User $user Object user that modify
* @return int <0 if KO, >0 if OK * @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/ */
function set_draft($user) function set_draft($user, $idwarehouse=-1)
{ {
global $conf,$langs; global $conf,$langs;
@ -424,8 +426,7 @@ class CommandeFournisseur extends Commande
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increment stock of product (and sub-products) // We increment stock of product (and sub-products)
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderBackToDraftInDolibarr",$this->ref));
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
} }
} }

View File

@ -835,11 +835,13 @@ class FactureFournisseur extends Facture
/** /**
* Set draft status * Set draft status
* @param user Object user that modify *
* @param int <0 if KO, >0 if OK * @param User $user Object user that modify
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/ */
function set_draft($user) function set_draft($user, $idwarehouse=-1)
{ {
global $conf,$langs; global $conf,$langs;
@ -847,7 +849,7 @@ class FactureFournisseur extends Facture
if ($this->statut == 0) if ($this->statut == 0)
{ {
dol_syslog("FactureFournisseur::set_draft already draft status", LOG_WARNING); dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING);
return 0; return 0;
} }
@ -857,8 +859,9 @@ class FactureFournisseur extends Facture
$sql.= " SET fk_statut = 0"; $sql.= " SET fk_statut = 0";
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog("FactureFournisseur::set_draft sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::set_draft sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) $result=$this->db->query($sql);
if ($result)
{ {
// Si on incremente le produit principal et ses composants a la validation de facture fournisseur, on decremente // Si on incremente le produit principal et ses composants a la validation de facture fournisseur, on decremente
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)
@ -873,8 +876,7 @@ class FactureFournisseur extends Facture
{ {
$mouvP = new MouvementStock($this->db); $mouvP = new MouvementStock($this->db);
// We increase stock for product // We increase stock for product
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
} }
} }
} }
@ -901,10 +903,10 @@ class FactureFournisseur extends Facture
/** /**
* Ajoute une ligne de facture (associe a aucun produit/service predefini) * Ajoute une ligne de facture (associe a aucun produit/service predefini)
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* *
* @param desc Description de la ligne * @param desc Description de la ligne
* @param pu Prix unitaire (HT ou TTC selon price_base_type) * @param pu Prix unitaire (HT ou TTC selon price_base_type)

View File

@ -1215,7 +1215,7 @@ else
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
} }
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 0, 1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $object->ref), 'confirm_valid', $formquestion, 0, 1, 240);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -38,6 +38,7 @@ InvoiceValidatedInDolibarr=Factura %s validada
InvoiceBackToDraftInDolibarr=Factura %s tornada a borrador InvoiceBackToDraftInDolibarr=Factura %s tornada a borrador
OrderValidatedInDolibarr=Comanda %s validada OrderValidatedInDolibarr=Comanda %s validada
OrderApprovedInDolibarr=Comanda %s aprovada OrderApprovedInDolibarr=Comanda %s aprovada
OrderBackToDraftInDolibarr=Comanda %s tordada a borrador
InterventionValidatedInDolibarr=Intervenció %s validada InterventionValidatedInDolibarr=Intervenció %s validada
ProposalSentByEMail=Pressupost %s enviat per e-mail ProposalSentByEMail=Pressupost %s enviat per e-mail
OrderSentByEMail=Comanda de client %s enviada per e-mail OrderSentByEMail=Comanda de client %s enviada per e-mail

View File

@ -140,6 +140,7 @@ SuppliersDraftInvoices=Factures de proveïdors esborrany
Unpaid=Pendents Unpaid=Pendents
ConfirmDeleteBill=Esteu segur de voler eliminar aquesta factura? ConfirmDeleteBill=Esteu segur de voler eliminar aquesta factura?
ConfirmValidateBill=Esteu segur de voler validar aquesta factura amb la referència <b>%s</b>? ConfirmValidateBill=Esteu segur de voler validar aquesta factura amb la referència <b>%s</b>?
ConfirmUnvalidateBill=Esteu segur de voler tornar la factura <b>%s</b> a l'estat esborrany?
ConfirmClassifyPaidBill=Esteu segur de voler classificar la factura <b>%s</b> com pagada? ConfirmClassifyPaidBill=Esteu segur de voler classificar la factura <b>%s</b> com pagada?
ConfirmCancelBill=Esteu segur de voler anul·lar la factura <b>%s</b>? ConfirmCancelBill=Esteu segur de voler anul·lar la factura <b>%s</b>?
ConfirmCancelBillQuestion=Per quina raó vol abandonar la factura? ConfirmCancelBillQuestion=Per quina raó vol abandonar la factura?
@ -162,6 +163,7 @@ ConfirmClassifyAbandonReasonOtherDesc=Aquesta elecció serà per a qualsevol alt
ConfirmCustomerPayment=¿Confirmeu el procés d'aquest pagament de <b>%s</b>%s? ConfirmCustomerPayment=¿Confirmeu el procés d'aquest pagament de <b>%s</b>%s?
ConfirmValidatePayment=Esteu segur de voler validar aquest pagament (cap modificació és possible un cop el pagament estigui validat)? ConfirmValidatePayment=Esteu segur de voler validar aquest pagament (cap modificació és possible un cop el pagament estigui validat)?
ValidateBill=Validar factura ValidateBill=Validar factura
UnvalidateBill=Tornar factura a esborrany
NumberOfBills=Nº de factures NumberOfBills=Nº de factures
NumberOfBillsByMonth=Nº de factures per mes NumberOfBillsByMonth=Nº de factures per mes
AmountOfBills=Import de les factures AmountOfBills=Import de les factures

View File

@ -59,6 +59,7 @@ CreateOrder=Crear comanda
RefuseOrder=Rebutjar la comanda RefuseOrder=Rebutjar la comanda
ApproveOrder=Acceptar la comanda ApproveOrder=Acceptar la comanda
ValidateOrder=Validar la comanda ValidateOrder=Validar la comanda
UnvalidateOrder=Desvalidar la comanda
DeleteOrder=Eliminar la comanda DeleteOrder=Eliminar la comanda
CancelOrder=Anul·lar la comanda CancelOrder=Anul·lar la comanda
AddOrder=Crear comanda AddOrder=Crear comanda
@ -83,6 +84,7 @@ ConfirmCloseOrder=Esteu segur de voler tancar aquesta comanda? Un cop tancat, ha
ConfirmCloseOrderIfSending=Esteu segur de voler tancar aquesta comanda? No ha de tancar una comanda que encara no té els seus productes enviats ConfirmCloseOrderIfSending=Esteu segur de voler tancar aquesta comanda? No ha de tancar una comanda que encara no té els seus productes enviats
ConfirmDeleteOrder=Esteu segur de voler eliminar aquest comanda? ConfirmDeleteOrder=Esteu segur de voler eliminar aquest comanda?
ConfirmValidateOrder=Esteu segur de voler validar aquesta comanda sota la referència <b>%s</b> ? ConfirmValidateOrder=Esteu segur de voler validar aquesta comanda sota la referència <b>%s</b> ?
ConfirmUnvalidateOrder=Esteu segur de voler restaurar la comanda <b>%s</b> a l'estat esborrany?
ConfirmCancelOrder=Esteu segur de voler anul lar aquesta comanda? ConfirmCancelOrder=Esteu segur de voler anul lar aquesta comanda?
ConfirmMakeOrder=Esteu segur de voler confirmar aquest comanda a data de <b>%s</b> ? ConfirmMakeOrder=Esteu segur de voler confirmar aquest comanda a data de <b>%s</b> ?
GenerateBill=Facturar GenerateBill=Facturar

View File

@ -38,6 +38,7 @@ InvoiceValidatedInDolibarr= Invoice %s validated
InvoiceBackToDraftInDolibarr=Invoice %s go back to draft status InvoiceBackToDraftInDolibarr=Invoice %s go back to draft status
OrderValidatedInDolibarr= Order %s validated OrderValidatedInDolibarr= Order %s validated
OrderApprovedInDolibarr=Order %s approved OrderApprovedInDolibarr=Order %s approved
OrderBackToDraftInDolibarr=Order %s go back to draft status
InterventionValidatedInDolibarr=Intervention %s validated InterventionValidatedInDolibarr=Intervention %s validated
ProposalSentByEMail=Commercial proposal %s sent by EMail ProposalSentByEMail=Commercial proposal %s sent by EMail
OrderSentByEMail=Customer order %s sent by EMail OrderSentByEMail=Customer order %s sent by EMail

View File

@ -144,6 +144,7 @@ SuppliersDraftInvoices=Suppliers draft invoices
Unpaid=Unpaid Unpaid=Unpaid
ConfirmDeleteBill=Are you sure you want to delete this invoice ? ConfirmDeleteBill=Are you sure you want to delete this invoice ?
ConfirmValidateBill=Are you sure you want to validate this invoice with reference <b>%s</b> ? ConfirmValidateBill=Are you sure you want to validate this invoice with reference <b>%s</b> ?
ConfirmUnvalidateBill=Are you sure you want to change invoice <b>%s</b> to draft status ?
ConfirmClassifyPaidBill=Are you sure you want to change invoice <b>%s</b> to status paid ? ConfirmClassifyPaidBill=Are you sure you want to change invoice <b>%s</b> to status paid ?
ConfirmCancelBill=Are you sure you want to cancel invoice <b>%s</b> ? ConfirmCancelBill=Are you sure you want to cancel invoice <b>%s</b> ?
ConfirmCancelBillQuestion=Why do you want to classify this invoice 'abandoned' ? ConfirmCancelBillQuestion=Why do you want to classify this invoice 'abandoned' ?
@ -166,6 +167,7 @@ ConfirmClassifyAbandonReasonOtherDesc=This choice will be used in all other case
ConfirmCustomerPayment=Do you confirm this payment input for <b>%s</b> %s ? ConfirmCustomerPayment=Do you confirm this payment input for <b>%s</b> %s ?
ConfirmValidatePayment=Are you sure you want to validate this payment ? No change can be made once payment is validated. ConfirmValidatePayment=Are you sure you want to validate this payment ? No change can be made once payment is validated.
ValidateBill=Validate invoice ValidateBill=Validate invoice
UnvalidateBill=Unvalidate invoice
NumberOfBills=Nb of invoices NumberOfBills=Nb of invoices
NumberOfBillsByMonth=Nb of invoices by month NumberOfBillsByMonth=Nb of invoices by month
AmountOfBills=Amount of invoices AmountOfBills=Amount of invoices

View File

@ -59,6 +59,7 @@ CreateOrder=Create Order
RefuseOrder=Refuse order RefuseOrder=Refuse order
ApproveOrder=Accept order ApproveOrder=Accept order
ValidateOrder=Validate order ValidateOrder=Validate order
UnvalidateOrder=Unvalidate order
DeleteOrder=Delete order DeleteOrder=Delete order
CancelOrder=Cancel order CancelOrder=Cancel order
AddOrder=Add order AddOrder=Add order
@ -83,6 +84,7 @@ ConfirmCloseOrder=Are you sure you want to close this order ? Once an order is c
ConfirmCloseOrderIfSending=Are you sure you want to close this order ? You must close an order only when all shipping are done. ConfirmCloseOrderIfSending=Are you sure you want to close this order ? You must close an order only when all shipping are done.
ConfirmDeleteOrder=Are you sure you want to delete this order ? ConfirmDeleteOrder=Are you sure you want to delete this order ?
ConfirmValidateOrder=Are you sure you want to validate this order under name <b>%s</b> ? ConfirmValidateOrder=Are you sure you want to validate this order under name <b>%s</b> ?
ConfirmUnvalidateOrder=Are you sure you want to restore order <b>%s</b> to draft status ?
ConfirmCancelOrder=Are you sure you want to cancel this order ? ConfirmCancelOrder=Are you sure you want to cancel this order ?
ConfirmMakeOrder=Are you sure you want to confirm you made this order on <b>%s</b> ? ConfirmMakeOrder=Are you sure you want to confirm you made this order on <b>%s</b> ?
GenerateBill=Generate invoice GenerateBill=Generate invoice

View File

@ -38,6 +38,7 @@ InvoiceValidatedInDolibarr=Factura %s validada
InvoiceBackToDraftInDolibarr=Factura %s devuelta a borrador InvoiceBackToDraftInDolibarr=Factura %s devuelta a borrador
OrderValidatedInDolibarr=Pedido %s validado OrderValidatedInDolibarr=Pedido %s validado
OrderApprovedInDolibarr=Pedido %s aprobado OrderApprovedInDolibarr=Pedido %s aprobado
OrderBackToDraftInDolibarr=Pedido %s devuelto a borrador
InterventionValidatedInDolibarr=Intervención %s validada InterventionValidatedInDolibarr=Intervención %s validada
ProposalSentByEMail=Presupuesto %s enviado por e-mail ProposalSentByEMail=Presupuesto %s enviado por e-mail
OrderSentByEMail=Pedido de cliente %s enviado por e-mail OrderSentByEMail=Pedido de cliente %s enviado por e-mail
@ -61,7 +62,7 @@ AgendaUrlOptions5=<b>logind=%s</b> para restringir inserciones a acciones realiz
AgendaShowBirthdayEvents=Mostrar cumpleaños de los contactos AgendaShowBirthdayEvents=Mostrar cumpleaños de los contactos
AgendaHideBirthdayEvents=Ocultar cumpleaños de los contactos AgendaHideBirthdayEvents=Ocultar cumpleaños de los contactos
ExtSites=Calendarios externos ExtSites=Calendarios externos
# External Sites ical=undefined # External Sites ical=
ExtSitesEnableThisTool=Mostrar calendarios externos en la agenda ExtSitesEnableThisTool=Mostrar calendarios externos en la agenda
ExtSitesNbOfAgenda=Número de calendarios ExtSitesNbOfAgenda=Número de calendarios
AgendaExtNb=Calendario nº %s AgendaExtNb=Calendario nº %s

View File

@ -140,6 +140,7 @@ SuppliersDraftInvoices=Facturas de proveedores borrador
Unpaid=Pendientes Unpaid=Pendientes
ConfirmDeleteBill=¿Está seguro de querer eliminar esta factura? ConfirmDeleteBill=¿Está seguro de querer eliminar esta factura?
ConfirmValidateBill=¿Está seguro de querer validar esta factura con la referencia <b>%s</b> ? ConfirmValidateBill=¿Está seguro de querer validar esta factura con la referencia <b>%s</b> ?
ConfirmUnvalidateBill=¿Está seguro de querer devolver la factura <b>%s</b> al estado borrador?
ConfirmClassifyPaidBill=¿Esta seguro de querer clasificar la factura <b>%s</b> como pagada? ConfirmClassifyPaidBill=¿Esta seguro de querer clasificar la factura <b>%s</b> como pagada?
ConfirmCancelBill=¿Está seguro de querer anular la factura <b>%s</b> ? ConfirmCancelBill=¿Está seguro de querer anular la factura <b>%s</b> ?
ConfirmCancelBillQuestion=¿Por qué razón quiere abandonar la factura? ConfirmCancelBillQuestion=¿Por qué razón quiere abandonar la factura?
@ -162,6 +163,7 @@ ConfirmClassifyAbandonReasonOtherDesc=Esta elección será para cualquier otro c
ConfirmCustomerPayment=¿Confirma el proceso de este pago de <b>%s</b> %s ? ConfirmCustomerPayment=¿Confirma el proceso de este pago de <b>%s</b> %s ?
ConfirmValidatePayment=¿Está seguro de querer validar este pago (ninguna modificación es posible una vez el pago esté validado)? ConfirmValidatePayment=¿Está seguro de querer validar este pago (ninguna modificación es posible una vez el pago esté validado)?
ValidateBill=Validar factura ValidateBill=Validar factura
UnvalidateBill=Devolver factura a borrador
NumberOfBills=Nº de facturas NumberOfBills=Nº de facturas
NumberOfBillsByMonth=Nº de facturas por mes NumberOfBillsByMonth=Nº de facturas por mes
AmountOfBills=Importe de las facturas AmountOfBills=Importe de las facturas

View File

@ -59,6 +59,7 @@ CreateOrder=Crear pedido
RefuseOrder=Rechazar el pedido RefuseOrder=Rechazar el pedido
ApproveOrder=Aceptar el pedido ApproveOrder=Aceptar el pedido
ValidateOrder=Validar el pedido ValidateOrder=Validar el pedido
UnvalidateOrder=Desvalidar el pedido
DeleteOrder=Eliminar el pedido DeleteOrder=Eliminar el pedido
CancelOrder=Anular el pedido CancelOrder=Anular el pedido
AddOrder=Crear pedido AddOrder=Crear pedido
@ -83,6 +84,7 @@ ConfirmCloseOrder=¿Está seguro de querer cerrar este pedido? Una vez cerrado,
ConfirmCloseOrderIfSending=¿Está seguro de querer cerrar este pedido? No debe cerrar un pedido que aún no tiene sus productos enviados ConfirmCloseOrderIfSending=¿Está seguro de querer cerrar este pedido? No debe cerrar un pedido que aún no tiene sus productos enviados
ConfirmDeleteOrder=¿Está seguro de querer eliminar este pedido? ConfirmDeleteOrder=¿Está seguro de querer eliminar este pedido?
ConfirmValidateOrder=¿Está seguro de querer validar este pedido bajo la referencia <b>%s</b> ? ConfirmValidateOrder=¿Está seguro de querer validar este pedido bajo la referencia <b>%s</b> ?
ConfirmUnvalidateOrder=¿Está seguro de querer restaurar el pedido <b>%s</b> al estado borrador?
ConfirmCancelOrder=¿Está seguro de querer anular este pedido? ConfirmCancelOrder=¿Está seguro de querer anular este pedido?
ConfirmMakeOrder=¿Está seguro de querer confirmar este pedido en fecha de<b>%s</b> ? ConfirmMakeOrder=¿Está seguro de querer confirmar este pedido en fecha de<b>%s</b> ?
GenerateBill=Facturar GenerateBill=Facturar

View File

@ -38,6 +38,7 @@ InvoiceValidatedInDolibarr=Facture %s validée
InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon InvoiceBackToDraftInDolibarr=Facture %s repassée en brouillon
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
InterventionValidatedInDolibarr=Intervention %s validée InterventionValidatedInDolibarr=Intervention %s validée
ProposalSentByEMail=Proposition commerciale %s envoyée par EMail ProposalSentByEMail=Proposition commerciale %s envoyée par EMail
OrderSentByEMail=Commande client %s envoyée par EMail OrderSentByEMail=Commande client %s envoyée par EMail

View File

@ -140,6 +140,7 @@ SuppliersDraftInvoices=Factures fournisseurs brouillons
Unpaid=Impayées Unpaid=Impayées
ConfirmDeleteBill=Êtes-vous sûr de vouloir supprimer cette facture ? ConfirmDeleteBill=Êtes-vous sûr de vouloir supprimer cette facture ?
ConfirmValidateBill=Êtes-vous sûr de vouloir valider cette facture sous la référence <b>%s</b> ? ConfirmValidateBill=Êtes-vous sûr de vouloir valider cette facture sous la référence <b>%s</b> ?
ConfirmUnvalidateBill=Êtes-vous sûr de vouloir repasser la facture <b>%s</b> au statut brouillon ?
ConfirmClassifyPaidBill=Êtes-vous sûr de vouloir classer la facture <b>%s</b> comme payée ? ConfirmClassifyPaidBill=Êtes-vous sûr de vouloir classer la facture <b>%s</b> comme payée ?
ConfirmCancelBill=Êtes-vous sûr de vouloir annuler la facture <b>%s</b> ? ConfirmCancelBill=Êtes-vous sûr de vouloir annuler la facture <b>%s</b> ?
ConfirmCancelBillQuestion=Pour quelle raison voulez-vous classer la facture abandonnée ? ConfirmCancelBillQuestion=Pour quelle raison voulez-vous classer la facture abandonnée ?
@ -162,6 +163,7 @@ ConfirmClassifyAbandonReasonOtherDesc=Ce choix sera celui choisi dans tout autre
ConfirmCustomerPayment=Confirmez-vous la saisie de ce règlement de <b>%s</b> %s ? ConfirmCustomerPayment=Confirmez-vous la saisie de ce règlement de <b>%s</b> %s ?
ConfirmValidatePayment=Êtes-vous sûr de vouloir valider ce paiement, aucune modification n'est possible une fois le paiement validé ? ConfirmValidatePayment=Êtes-vous sûr de vouloir valider ce paiement, aucune modification n'est possible une fois le paiement validé ?
ValidateBill=Valider facture ValidateBill=Valider facture
UnvalidateBill=Repasser facture en brouillon
NumberOfBills=Nb de factures NumberOfBills=Nb de factures
NumberOfBillsByMonth=Nb de factures par mois NumberOfBillsByMonth=Nb de factures par mois
AmountOfBills=Montant de factures AmountOfBills=Montant de factures

View File

@ -59,6 +59,7 @@ CreateOrder=Créer Commande
RefuseOrder=Refuser la commande RefuseOrder=Refuser la commande
ApproveOrder=Accepter la commande ApproveOrder=Accepter la commande
ValidateOrder=Valider la commande ValidateOrder=Valider la commande
UnvalidateOrder=Dévalider la commande
DeleteOrder=Supprimer la commande DeleteOrder=Supprimer la commande
CancelOrder=Annuler la commande CancelOrder=Annuler la commande
AddOrder=Créer commande AddOrder=Créer commande
@ -83,6 +84,7 @@ ConfirmCloseOrder=Êtes-vous sûr de vouloir clôturer cette commande ? Une fois
ConfirmCloseOrderIfSending=Êtes-vous sûr de vouloir clôturer cette commande ? Vous ne devez clôturer une commande qu'une fois les produits expédiés. ConfirmCloseOrderIfSending=Êtes-vous sûr de vouloir clôturer cette commande ? Vous ne devez clôturer une commande qu'une fois les produits expédiés.
ConfirmDeleteOrder=Êtes-vous sûr de vouloir effacer cette commande ? ConfirmDeleteOrder=Êtes-vous sûr de vouloir effacer cette commande ?
ConfirmValidateOrder=Êtes-vous sûr de vouloir valider cette commande sous la référence <b>%s</b> ? ConfirmValidateOrder=Êtes-vous sûr de vouloir valider cette commande sous la référence <b>%s</b> ?
ConfirmUnvalidateOrder=Êtes-vous sûr de vouloir restaurer la commande <b>%s</b> au statut brouillon ?
ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ? ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ?
ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du <b>%s</b> ? ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du <b>%s</b> ?
GenerateBill=Facturer GenerateBill=Facturer

View File

@ -133,6 +133,9 @@ class Entrepot extends CommonObject
$this->cp=trim($this->cp); $this->cp=trim($this->cp);
$this->ville=$this->db->escape(trim($this->ville)); $this->ville=$this->db->escape(trim($this->ville));
$this->pays_id=trim($this->pays_id?$this->pays_id:0); $this->pays_id=trim($this->pays_id?$this->pays_id:0);
$this->zip=trim($this->cp);
$this->town=$this->db->escape(trim($this->ville));
$this->country_id=trim($this->pays_id?$this->pays_id:0);
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
$sql .= " SET label = '" . $this->libelle ."'"; $sql .= " SET label = '" . $this->libelle ."'";
@ -140,9 +143,9 @@ class Entrepot extends CommonObject
$sql .= ",statut = " . $this->statut ; $sql .= ",statut = " . $this->statut ;
$sql .= ",lieu = '" . $this->lieu ."'"; $sql .= ",lieu = '" . $this->lieu ."'";
$sql .= ",address = '" . $this->address ."'"; $sql .= ",address = '" . $this->address ."'";
$sql .= ",cp = '" . $this->cp ."'"; $sql .= ",cp = '" . $this->zip ."'";
$sql .= ",ville = '" . $this->ville ."'"; $sql .= ",ville = '" . $this->town ."'";
$sql .= ",fk_pays = " . $this->pays_id; $sql .= ",fk_pays = " . $this->country_id;
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
$this->db->begin(); $this->db->begin();
@ -221,7 +224,7 @@ class Entrepot extends CommonObject
*/ */
function fetch($id) function fetch($id)
{ {
$sql = "SELECT rowid, label, description, statut, lieu, address, cp, ville, fk_pays"; $sql = "SELECT rowid, label, description, statut, lieu, address, cp as zip, ville as town, fk_pays as country_id";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
$sql .= " WHERE rowid = ".$id; $sql .= " WHERE rowid = ".$id;
@ -238,13 +241,16 @@ class Entrepot extends CommonObject
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->lieu = $obj->lieu; $this->lieu = $obj->lieu;
$this->address = $obj->address; $this->address = $obj->address;
$this->cp = $obj->cp; $this->cp = $obj->zip;
$this->ville = $obj->ville; $this->ville = $obj->town;
$this->pays_id = $obj->fk_pays; $this->pays_id = $obj->country_id;
$this->zip = $obj->zip;
$this->town = $obj->town;
$this->country_id = $obj->country_id;
if ($this->pays_id) if ($this->country_id)
{ {
$sqlp = "SELECT code,libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$this->pays_id; $sqlp = "SELECT code,libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$this->country_id;
$resql=$this->db->query($sqlp); $resql=$this->db->query($sqlp);
if ($resql) if ($resql)
{ {
@ -256,6 +262,8 @@ class Entrepot extends CommonObject
} }
$this->pays=$objp->libelle; $this->pays=$objp->libelle;
$this->pays_code=$objp->code; $this->pays_code=$objp->code;
$this->country=$objp->libelle;
$this->country_code=$objp->code;
} }
$this->db->free($result); $this->db->free($result);
@ -269,9 +277,10 @@ class Entrepot extends CommonObject
} }
/* /**
* \brief Charge les informations d'ordre info dans l'objet entrepot * Charge les informations d'ordre info dans l'objet entrepot
* \param id id de l'entrepot a charger *
* @param int $id id de l'entrepot a charger
*/ */
function info($id) function info($id)
{ {

View File

@ -78,7 +78,7 @@ class MouvementStock
$movestock=0; $movestock=0;
if ($product->type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1; if ($product->type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1;
if ($movestock) // Change stock for current product, change for subproduct is done after if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement";
$sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, label, price)"; $sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, label, price)";

View File

@ -29,6 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/stock.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/stock.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
$langs->load("products"); $langs->load("products");
$langs->load("stocks"); $langs->load("stocks");
@ -51,20 +52,23 @@ $mesg = '';
// Ajout entrepot // Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer) if ($action == 'add' && $user->rights->stock->creer)
{ {
$entrepot = new Entrepot($db); $object = new Entrepot($db);
$entrepot->ref = $_POST["ref"]; $object->ref = $_POST["ref"];
$entrepot->libelle = $_POST["libelle"]; $object->libelle = $_POST["libelle"];
$entrepot->description = $_POST["desc"]; $object->description = $_POST["desc"];
$entrepot->statut = $_POST["statut"]; $object->statut = $_POST["statut"];
$entrepot->lieu = $_POST["lieu"]; $object->lieu = $_POST["lieu"];
$entrepot->address = $_POST["address"]; $object->address = $_POST["address"];
$entrepot->cp = $_POST["cp"]; $object->cp = $_POST["zipcode"];
$entrepot->ville = $_POST["ville"]; $object->ville = $_POST["town"];
$entrepot->pays_id = $_POST["pays_id"]; $object->pays_id = $_POST["pays_id"];
$object->zip = $_POST["zipcode"];
$object->town = $_POST["town"];
$object->country_id = $_POST["pays_id"];
if ($entrepot->libelle) { if ($object->libelle) {
$id = $entrepot->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0)
{ {
header("Location: fiche.php?id=".$id); header("Location: fiche.php?id=".$id);
@ -72,7 +76,7 @@ if ($action == 'add' && $user->rights->stock->creer)
} }
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$entrepot->error.'</div>'; $mesg='<div class="error">'.$object->error.'</div>';
} }
else { else {
$mesg='<div class="error">'.$langs->trans("ErrorWarehouseRefRequired").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorWarehouseRefRequired").'</div>';
@ -83,9 +87,9 @@ if ($action == 'add' && $user->rights->stock->creer)
// Delete warehouse // Delete warehouse
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer) if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->stock->supprimer)
{ {
$entrepot = new Entrepot($db); $object = new Entrepot($db);
$entrepot->fetch($_REQUEST["id"]); $object->fetch($_REQUEST["id"]);
$result=$entrepot->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: ".DOL_URL_ROOT.'/product/stock/liste.php'); header("Location: ".DOL_URL_ROOT.'/product/stock/liste.php');
@ -93,7 +97,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right
} }
else else
{ {
$mesg='<div class="error">'.$entrepot->error.'</div>'; $mesg='<div class="error">'.$object->error.'</div>';
$action=''; $action='';
} }
} }
@ -101,19 +105,22 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->right
// Modification entrepot // Modification entrepot
if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{ {
$entrepot = new Entrepot($db); $object = new Entrepot($db);
if ($entrepot->fetch($_POST["id"])) if ($object->fetch($_POST["id"]))
{ {
$entrepot->libelle = $_POST["libelle"]; $object->libelle = $_POST["libelle"];
$entrepot->description = $_POST["desc"]; $object->description = $_POST["desc"];
$entrepot->statut = $_POST["statut"]; $object->statut = $_POST["statut"];
$entrepot->lieu = $_POST["lieu"]; $object->lieu = $_POST["lieu"];
$entrepot->address = $_POST["address"]; $object->address = $_POST["address"];
$entrepot->cp = $_POST["cp"]; $object->cp = $_POST["zipcode"];
$entrepot->ville = $_POST["ville"]; $object->ville = $_POST["town"];
$entrepot->pays_id = $_POST["pays_id"]; $object->pays_id = $_POST["pays_id"];
$object->zip = $_POST["zipcode"];
$object->town = $_POST["town"];
$object->country_id = $_POST["pays_id"];
if ( $entrepot->update($_POST["id"], $user) > 0) if ( $object->update($_POST["id"], $user) > 0)
{ {
$action = ''; $action = '';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
@ -123,14 +130,14 @@ if ($action == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{ {
$action = 'edit'; $action = 'edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = '<div class="error">'.$entrepot->error.'</div>'; $mesg = '<div class="error">'.$object->error.'</div>';
} }
} }
else else
{ {
$action = 'edit'; $action = 'edit';
$_GET["id"] = $_POST["id"]; $_GET["id"] = $_POST["id"];
$mesg = '<div class="error">'.$entrepot->error.'</div>'; $mesg = '<div class="error">'.$object->error.'</div>';
} }
} }
@ -148,6 +155,7 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
$productstatic=new Product($db); $productstatic=new Product($db);
$form=new Form($db); $form=new Form($db);
$formcompany=new FormCompany($db);
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks'; $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
llxHeader("",$langs->trans("WarehouseCard"),$help_url); llxHeader("",$langs->trans("WarehouseCard"),$help_url);
@ -169,25 +177,31 @@ if ($action == 'create')
// Ref // Ref
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>'; print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value=""></td></tr>';
print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>'; print '<tr><td >'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('desc',$entrepot->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); $doleditor=new DolEditor('desc',$object->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">'; print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
print $entrepot->address; print $object->address;
print '</textarea></td></tr>'; print '</textarea></td></tr>';
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%"><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>'; // Zip / Town
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%"><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>'; print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectpays_id','departement_id'));
print '</td></tr>';
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; // Country
$form->select_pays($entrepot->pays_id?$entrepot->pays_id:$mysoc->pays_code, 'pays_id'); print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->country_id?$object->country_id:$mysoc->country_code,'pays_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">';
@ -209,8 +223,8 @@ else
{ {
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
$entrepot = new Entrepot($db); $object = new Entrepot($db);
$result = $entrepot->fetch($_GET["id"]); $result = $object->fetch($_GET["id"]);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db); dol_print_error($db);
@ -221,7 +235,7 @@ else
*/ */
if ($action <> 'edit' && $action <> 're-edit') if ($action <> 'edit' && $action <> 're-edit')
{ {
$head = stock_prepare_head($entrepot); $head = stock_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock'); dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
@ -229,7 +243,7 @@ else
if ($action == 'delete') if ($action == 'delete')
{ {
$form = new Form($db); $form = new Form($db);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$entrepot->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$entrepot->libelle),"confirm_delete",'',0,2); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -237,34 +251,34 @@ else
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($entrepot,'id','',1,'rowid','libelle'); print $form->showrefnav($object,'id','',1,'rowid','libelle');
print '</td>'; print '</td>';
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$entrepot->lieu.'</td></tr>'; print '<tr><td>'.$langs->trans("LocationSummary").'</td><td colspan="3">'.$object->lieu.'</td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($entrepot->description).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($object->description).'</td></tr>';
// Address // Address
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
print $entrepot->address; print $object->address;
print '</td></tr>'; print '</td></tr>';
// Ville // Ville
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$entrepot->cp.'</td>'; print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$object->zip.'</td>';
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$entrepot->ville.'</td></tr>'; print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$object->town.'</td></tr>';
// Country // Country
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
$img=picto_from_langcode($entrepot->pays_code); $img=picto_from_langcode($object->country_code);
print ($img?$img.' ':''); print ($img?$img.' ':'');
print $entrepot->pays; print $object->country;
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$entrepot->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
$calcproducts=$entrepot->nb_products(); $calcproducts=$object->nb_products();
// Nb of products // Nb of products
print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NumberOfProducts").'</td><td colspan="3">';
@ -279,7 +293,7 @@ else
// Last movement // Last movement
$sql = "SELECT max(m.datem) as datem"; $sql = "SELECT max(m.datem) as datem";
$sql .= " FROM llx_stock_mouvement as m"; $sql .= " FROM llx_stock_mouvement as m";
$sql .= " WHERE m.fk_entrepot = '".$entrepot->id."'"; $sql .= " WHERE m.fk_entrepot = '".$object->id."'";
$resqlbis = $db->query($sql); $resqlbis = $db->query($sql);
if ($resqlbis) if ($resqlbis)
{ {
@ -294,7 +308,7 @@ else
if ($lastmovementdate) if ($lastmovementdate)
{ {
print dol_print_date($lastmovementdate,'dayhour').' '; print dol_print_date($lastmovementdate,'dayhour').' ';
print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$entrepot->id.'">'.$langs->trans("FullList").'</a>)'; print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?id='.$object->id.'">'.$langs->trans("FullList").'</a>)';
} }
else else
{ {
@ -318,12 +332,12 @@ else
if ($action == '') if ($action == '')
{ {
if ($user->rights->stock->creer) if ($user->rights->stock->creer)
print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$entrepot->id."\">".$langs->trans("Modify")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?action=edit&id=".$object->id."\">".$langs->trans("Modify")."</a>";
else else
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</a>"; print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</a>";
if ($user->rights->stock->supprimer) if ($user->rights->stock->supprimer)
print "<a class=\"butActionDelete\" href=\"fiche.php?action=delete&id=".$entrepot->id."\">".$langs->trans("Delete")."</a>"; print "<a class=\"butActionDelete\" href=\"fiche.php?action=delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
else else
print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>"; print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>";
} }
@ -359,7 +373,7 @@ else
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
$sql.= " WHERE ps.fk_product = p.rowid"; $sql.= " WHERE ps.fk_product = p.rowid";
$sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) $sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
$sql.= " AND ps.fk_entrepot = ".$entrepot->id; $sql.= " AND ps.fk_entrepot = ".$object->id;
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
dol_syslog('List products sql='.$sql); dol_syslog('List products sql='.$sql);
@ -426,14 +440,14 @@ else
if ($user->rights->stock->mouvement->creer) if ($user->rights->stock->mouvement->creer)
{ {
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$entrepot->id.'&amp;id='.$objp->rowid.'&amp;action=transfert">'; print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&amp;id='.$objp->rowid.'&amp;action=transfert">';
print img_picto($langs->trans("StockMovement"),'uparrow.png').' '.$langs->trans("StockMovement"); print img_picto($langs->trans("StockMovement"),'uparrow.png').' '.$langs->trans("StockMovement");
print "</a></td>"; print "</a></td>";
} }
if ($user->rights->stock->creer) if ($user->rights->stock->creer)
{ {
print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$entrepot->id.'&amp;id='.$objp->rowid.'&amp;action=correction">'; print '<td align="center"><a href="'.DOL_URL_ROOT.'/product/stock/product.php?dwid='.$object->id.'&amp;id='.$objp->rowid.'&amp;action=correction">';
print $langs->trans("StockCorrection"); print $langs->trans("StockCorrection");
print "</a></td>"; print "</a></td>";
} }
@ -475,44 +489,52 @@ else
print '<form action="fiche.php" method="POST">'; print '<form action="fiche.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$entrepot->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td width="20%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value="'.$entrepot->libelle.'"></td></tr>'; print '<tr><td width="20%" class="fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="libelle" size="20" value="'.$object->libelle.'"></td></tr>';
print '<tr><td width="20%">'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$entrepot->lieu.'"></td></tr>'; print '<tr><td width="20%">'.$langs->trans("LocationSummary").'</td><td colspan="3"><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('desc',$entrepot->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70); $doleditor=new DolEditor('desc',$object->description,'',180,'dolibarr_notes','In',false,true,$conf->fckeditor->enabled,5,70);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">'; print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="60" rows="3" wrap="soft">';
print $entrepot->address; print $object->address;
print '</textarea></td></tr>'; print '</textarea></td></tr>';
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp" value="'.$entrepot->cp.'"></td>'; // Zip / Town
print '<td>'.$langs->trans('Town').'</td><td><input type="text" name="ville" value="'.$entrepot->ville.'"></td></tr>'; print '<tr><td>'.$langs->trans('Zip').'</td><td>';
print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectpays_id','departement_id'),6);
print '</td><td>'.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectpays_id','departement_id'));
print '</td></tr>';
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; // Country
$form->select_pays($entrepot->pays_id, 'pays_id'); print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
$form->select_pays($object->country_id?$object->country_id:$mysoc->country_code,'pays_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">'; print '<tr><td width="20%">'.$langs->trans("Status").'</td><td colspan="3">';
print '<select name="statut" class="flat">'; print '<select name="statut" class="flat">';
print '<option value="0" '.($entrepot->statut == 0?'selected="selected"':'').'>'.$langs->trans("WarehouseClosed").'</option>'; print '<option value="0" '.($object->statut == 0?'selected="selected"':'').'>'.$langs->trans("WarehouseClosed").'</option>';
print '<option value="1" '.($entrepot->statut == 0?'':'selected="selected"').'>'.$langs->trans("WarehouseOpened").'</option>'; print '<option value="1" '.($object->statut == 0?'':'selected="selected"').'>'.$langs->trans("WarehouseOpened").'</option>';
print '</select>'; print '</select>';
print '</td></tr>'; print '</td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
print '</form>'; print '</form>';
} }

View File

@ -116,7 +116,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($object->fetch($socid)) if ($object->fetch($socid))
{ {
$file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,'FILE_DELETE',$object); dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
} }
} }

View File

@ -1076,6 +1076,14 @@ background-repeat: repeat-x;
*/ */
.paddingrightonly {
border-collapse: collapse;
border: 0px;
margin-left: 0px;
spacing-left: 0px;
padding-left: 0px;
padding-right: 4px;
}
.nocellnopadd { .nocellnopadd {
list-style-type:none; list-style-type:none;
margin: 0px; margin: 0px;

View File

@ -91,7 +91,6 @@ a:link, a:visited, a:hover, a:active { font-family: <?php print $fontlist ?>; fo
input:focus, textarea:focus, button:focus, select:focus { input:focus, textarea:focus, button:focus, select:focus {
box-shadow: 0 0 4px #8091BF; box-shadow: 0 0 4px #8091BF;
} }
input, input.flat, textarea, textarea.flat, form.flat select, select.flat { input, input.flat, textarea, textarea.flat, form.flat select, select.flat {
font-size: <?php print $fontsize ?>px; font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
@ -133,6 +132,9 @@ textarea:disabled {
.button:hover { .button:hover {
background: #dee7ec; background: #dee7ec;
} }
.button:disabled {
background: #ddd;
}
.buttonajax { .buttonajax {
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
border: 0px; border: 0px;
@ -155,6 +157,14 @@ div.float
{ {
float:<?php print $left; ?>; float:<?php print $left; ?>;
} }
th .button {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-moz-border-radius:0px !important;
-webkit-border-radius:0px !important;
border-radius:0px !important;
}
/* ============================================================================== */ /* ============================================================================== */
/* Styles to hide objects */ /* Styles to hide objects */
@ -166,6 +176,7 @@ div.float
<?php } ?> <?php } ?>
.linkobject { cursor: pointer; } .linkobject { cursor: pointer; }
/* ============================================================================== */ /* ============================================================================== */
/* Styles for dragging lines */ /* Styles for dragging lines */
/* ============================================================================== */ /* ============================================================================== */
@ -953,10 +964,6 @@ a.tabTitle {
margin: 0px 6px; margin: 0px 6px;
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
border-<?php print $right; ?>: 1px solid #555555;
border-<?php print $left; ?>: 1px solid #D8D8D8;
border-top: 1px solid #D8D8D8;
} }
a.tab:link { a.tab:link {
@ -1121,7 +1128,14 @@ background-repeat: repeat-x;
} }
*/ */
.paddingrightonly {
border-collapse: collapse;
border: 0px;
margin-left: 0px;
spacing-left: 0px;
padding-left: 0px;
padding-right: 4px;
}
.nocellnopadd { .nocellnopadd {
list-style-type:none; list-style-type:none;
margin: 0px; margin: 0px;

View File

@ -1318,8 +1318,8 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="addgroup" />'; print '<input type="hidden" name="action" value="addgroup" />';
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("GroupsToAdd").'</td>'."\n"; print '<tr class="liste_titre"><th class="liste_titre" width="25%">'.$langs->trans("GroupsToAdd").'</th>'."\n";
print '<td>'; print '<th>';
print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity); print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity);
print ' &nbsp; '; print ' &nbsp; ';
// Multicompany // Multicompany
@ -1341,7 +1341,7 @@ else
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />'; print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
} }
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'" />';
print '</td></tr>'."\n"; print '</th></tr>'."\n";
print '</table></form>'."\n"; print '</table></form>'."\n";
print '<br>'; print '<br>';
@ -1516,7 +1516,7 @@ else
print "</td></tr>\n"; print "</td></tr>\n";
// Administrator // Administrator
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>'; print '<tr><td valign="top">'.$langs->trans("Administrator").'</td>';
if ($fuser->societe_id > 0) if ($fuser->societe_id > 0)
{ {
print '<td>'; print '<td>';