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

develop

Conflicts:
	htdocs/holiday/fiche.php
This commit is contained in:
Laurent Destailleur 2012-11-29 23:12:16 +01:00
commit b12469c562
22 changed files with 112 additions and 92 deletions

View File

@ -729,6 +729,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
modal: true, modal: true,
buttons: [ buttons: [
{ {
id : 'yesButton_' + code,
text : yesButton, text : yesButton,
click : function() { click : function() {
if (action == "set") { if (action == "set") {
@ -748,6 +749,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
} }
}, },
{ {
id : 'noButton_' + code,
text : noButton, text : noButton,
click : function() { click : function() {
$(this).dialog("close"); $(this).dialog("close");
@ -755,6 +757,10 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
} }
] ]
}); });
// For information dialog box only, hide the noButton
if (boxConfirm.info) {
$("#noButton_" + code).button().hide();
}
} }
/* /*

View File

@ -375,6 +375,11 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Set constant // Set constant
$("#set_" + code).click(function() { $("#set_" + code).click(function() {
if (input.alert && input.alert.set) { if (input.alert && input.alert.set) {
// Posibility to force label of buttons
if (input.alert.set.yesButton)
yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton)
noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton); confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
} else { } else {
setConstant(url, code, input, entity); setConstant(url, code, input, entity);
@ -384,6 +389,11 @@ function ajax_constantonoff($code, $input=array(), $entity=false)
// Del constant // Del constant
$("#del_" + code).click(function() { $("#del_" + code).click(function() {
if (input.alert && input.alert.del) { if (input.alert && input.alert.del) {
// Posibility to force label of buttons
if (input.alert.del.yesButton)
yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton)
noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton); confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
} else { } else {
delConstant(url, code, input, entity); delConstant(url, code, input, entity);

View File

@ -1170,7 +1170,7 @@ class CommandeFournisseur extends CommonOrder
$this->error="No price found for this quantity. Quantity may be too low ?"; $this->error="No price found for this quantity. Quantity may be too low ?";
$this->db->rollback(); $this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG); dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
return -1; return -1; // FIXME this return create an error in jenkins
} }
if ($result < -1) if ($result < -1)
{ {

View File

@ -174,36 +174,36 @@ else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
{ {
$langs->load('errors'); $langs->load('errors');
$error = false; $error = 0;
if ($_POST['pu'] < 0 && $_POST['qty'] < 0) if (GETPOST('pu') < 0 && GETPOST('qty') < 0)
{ {
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
$error = true; $error++;
} }
if (empty($_POST['idprodfournprice']) && $_POST['type'] < 0) if (! GETPOST('idprodfournprice') && GETPOST('type') < 0)
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
$error = true; $error++;
} }
if (empty($_POST['idprodfournprice']) && (! isset($_POST['pu']) || $_POST['pu']=='')) // Unit price can be 0 but not '' if (! GETPOST('idprodfournprice') && (! GETPOST('pu') || GETPOST('pu')=='')) // Unit price can be 0 but not ''
{ {
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors'); setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors');
$error = true; $error++;
} }
if (empty($_POST['idprodfournprice']) && empty($_POST['np_desc']) && empty($_POST['dp_desc'])) if (! GETPOST('idprodfournprice') && ! GETPOST('np_desc') && ! GETPOST('dp_desc'))
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
$error = true; $error++;
} }
if (empty($_POST['idprodfournprice']) && (! isset($_POST['qty']) || $_POST['qty'] == '') if (! GETPOST('idprodfournprice') && (! GETPOST('qty') || GETPOST('qty') == '')
|| ! empty($_POST['idprodfournprice']) && (! isset($_POST['pqty']) || $_POST['pqty'] == '')) || GETPOST('idprodfournprice') && (! GETPOST('pqty') || GETPOST('pqty') == ''))
{ {
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
$error = true; $error++;
} }
if (! $error && (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice']))) if (! $error && ((GETPOST('qty') || GETPOST('pqty')) && ((GETPOST('pu') && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprodfournprice'))))
{ {
if ($object->fetch($id) < 0) dol_print_error($db,$object->error); if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error); if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
@ -211,9 +211,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
// Ecrase $pu par celui du produit // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit // Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit // Ecrase $txtva par celui du produit
if ($_POST["idprodfournprice"]) // >0 or -1 if (GETPOST('idprodfournprice')) // >0 or -1
{ {
$qty = $_POST['qty'] ? $_POST['qty'] : $_POST['pqty']; $qty = GETPOST('qty') ? GETPOST('qty') : GETPOST('pqty');
$productsupplier = new ProductFournisseur($db); $productsupplier = new ProductFournisseur($db);
$idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty); // Just to see if a price exists for the quantity. Not used to found vat $idprod=$productsupplier->get_buyprice($_POST['idprodfournprice'], $qty); // Just to see if a price exists for the quantity. Not used to found vat
@ -230,9 +230,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$desc.= $productsupplier->description && $_POST['np_desc'] ? "\n" : ""; $desc.= $productsupplier->description && $_POST['np_desc'] ? "\n" : "";
$desc.= $_POST['np_desc']; $desc.= $_POST['np_desc'];
$remise_percent = $_POST["remise_percent"] ? $_POST["remise_percent"] : $_POST["p_remise_percent"]; $remise_percent = GETPOST('remise_percent') ? GETPOST('remise_percent') : GETPOST('p_remise_percent');
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
$type = $productsupplier->type; $type = $productsupplier->type;
// Local Taxes // Local Taxes
@ -241,13 +241,13 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$result=$object->addline( $result=$object->addline(
$desc, $desc,
$pu, $pu, // FIXME $pu is not defined
$qty, $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$productsupplier->id, $productsupplier->id,
$_POST['idprodfournprice'], GETPOST('idprodfournprice'),
$productsupplier->fourn_ref, $productsupplier->fourn_ref,
$remise_percent, $remise_percent,
'HT', 'HT',
@ -257,7 +257,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
if ($idprod == -1) if ($idprod == -1)
{ {
// Quantity too low // Quantity too low
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
} }
} }
else else
@ -272,7 +272,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
if (! $_POST['dp_desc']) if (! $_POST['dp_desc'])
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
} }
else else
{ {

View File

@ -259,6 +259,10 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (46
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1);
-- SOUTH AFRICA (id country=205)
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051,205, '0','0','No VAT',1);
INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1);
-- VENEZUELA (id country=232) -- VENEZUELA (id country=232)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1);