Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/facture/card.php htdocs/core/actions_sendmails.inc.php htdocs/core/class/commonobject.class.php htdocs/fourn/class/fournisseur.facture.class.php htdocs/fourn/facture/card.php
This commit is contained in:
commit
2638d4596a
@ -971,6 +971,7 @@ if (empty($reshook))
|
|||||||
elseif ($action == 'add' && $usercancreate)
|
elseif ($action == 'add' && $usercancreate)
|
||||||
{
|
{
|
||||||
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
||||||
|
$selectedLines = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -1571,8 +1572,11 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
$num = count($lines);
|
$num = count($lines);
|
||||||
|
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
|
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
|
||||||
|
|
||||||
// Don't add lines with qty 0 when coming from a shipment including all order lines
|
// Don't add lines with qty 0 when coming from a shipment including all order lines
|
||||||
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
|
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
|
||||||
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
|
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
|
||||||
@ -3623,8 +3627,6 @@ if ($action == 'create')
|
|||||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
// Show origin lines
|
// Show origin lines
|
||||||
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
|
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -3634,12 +3636,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList();
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '</form>';
|
||||||
} elseif ($id > 0 || !empty($ref))
|
} elseif ($id > 0 || !empty($ref))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -473,12 +473,16 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
|
|||||||
} else {
|
} else {
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg = '<div class="error">';
|
$mesg = '<div class="error">';
|
||||||
if ($mailfile->error)
|
if ($mailfile->error) {
|
||||||
{
|
|
||||||
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
|
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
|
||||||
$mesg .= '<br>'.$mailfile->error;
|
$mesg .= '<br>'.$mailfile->error;
|
||||||
} else {
|
} else {
|
||||||
$mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
$mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));;
|
||||||
|
if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
||||||
|
$mesg .= '<br>Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||||
|
} else {
|
||||||
|
$mesg .= '<br>Unkown Error, please refers to your administrator';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$mesg .= '</div>';
|
$mesg .= '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -2785,9 +2785,9 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public function line_max($fk_parent_line = 0)
|
public function line_max($fk_parent_line = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$positionfield = 'rang';
|
$positionfield = 'rang';
|
||||||
if ($this->table_element == 'bom') $positionfield = 'position';
|
if ($this->table_element == 'bom_bom') $positionfield = 'position';
|
||||||
|
|
||||||
// Search the last rang with fk_parent_line
|
// Search the last rang with fk_parent_line
|
||||||
if ($fk_parent_line)
|
if ($fk_parent_line)
|
||||||
|
|||||||
@ -2219,37 +2219,37 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
|
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
|
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
|
||||||
$response->label = $langs->trans("SupplierBillsToPay");
|
$response->label = $langs->trans("SupplierBillsToPay");
|
||||||
$response->labelShort = $langs->trans("StatusToPay");
|
$response->labelShort = $langs->trans("StatusToPay");
|
||||||
|
|
||||||
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
$response->img = img_object($langs->trans("Bills"), "bill");
|
$response->img = img_object($langs->trans("Bills"), "bill");
|
||||||
|
|
||||||
$facturestatic = new FactureFournisseur($this->db);
|
$facturestatic = new FactureFournisseur($this->db);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
|
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
|
||||||
$facturestatic->statut = $obj->fk_statut;
|
$facturestatic->statut = $obj->fk_statut;
|
||||||
|
|
||||||
if ($facturestatic->hasDelay()) {
|
if ($facturestatic->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error = $this->db->error();
|
$this->error = $this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
@ -2406,7 +2406,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
return $numref;
|
return $numref;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $obj->error;
|
$this->error = $obj->error;
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if (!empty($conf->variants->enabled)) {
|
|||||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
|
|
||||||
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks'));
|
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks', 'admin'));
|
||||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||||
|
|
||||||
$id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
$id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||||
@ -2303,54 +2303,59 @@ if ($action == 'create')
|
|||||||
// Confirmation de la validation
|
// Confirmation de la validation
|
||||||
if ($action == 'valid')
|
if ($action == 'valid')
|
||||||
{
|
{
|
||||||
// on verifie si l'objet est en numerotation provisoire
|
// We check if number is temporary number
|
||||||
$objectref = substr($object->ref, 1, 4);
|
if (preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
|
||||||
if ($objectref == 'PROV')
|
|
||||||
{
|
{
|
||||||
$savdate = $object->date;
|
|
||||||
$numref = $object->getNextNumRef($societe);
|
$numref = $object->getNextNumRef($societe);
|
||||||
} else {
|
} else {
|
||||||
$numref = $object->ref;
|
$numref = $object->ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = $langs->trans('ConfirmValidateBill', $numref);
|
if ($numref < 0)
|
||||||
/*if (! empty($conf->notification->enabled))
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
|
||||||
$notify=new Notify($db);
|
|
||||||
$text.='<br>';
|
|
||||||
$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object);
|
|
||||||
}*/
|
|
||||||
$formquestion = array();
|
|
||||||
|
|
||||||
$qualified_for_stock_change = 0;
|
|
||||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
|
||||||
{
|
{
|
||||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
$action = '';
|
||||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
|
||||||
{
|
{
|
||||||
$langs->load("stocks");
|
$text = $langs->trans('ConfirmValidateBill', $numref);
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
/*if (! empty($conf->notification->enabled))
|
||||||
$formproduct = new FormProduct($db);
|
{
|
||||||
$warehouse = new Entrepot($db);
|
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
|
||||||
$warehouse_array = $warehouse->list_array();
|
$notify=new Notify($db);
|
||||||
if (count($warehouse_array) == 1) {
|
$text.='<br>';
|
||||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
|
$text.=$notify->confirmMessage('BILL_SUPPLIER_VALIDATE',$object->socid, $object);
|
||||||
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
}*/
|
||||||
|
$formquestion = array();
|
||||||
|
|
||||||
|
$qualified_for_stock_change = 0;
|
||||||
|
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||||
|
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||||
} else {
|
} else {
|
||||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||||
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
|
||||||
}
|
}
|
||||||
$formquestion = array(
|
|
||||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
|
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||||
|
{
|
||||||
|
$langs->load("stocks");
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
|
$formproduct = new FormProduct($db);
|
||||||
|
$warehouse = new Entrepot($db);
|
||||||
|
$warehouse_array = $warehouse->list_array();
|
||||||
|
if (count($warehouse_array) == 1) {
|
||||||
|
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
|
||||||
|
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
||||||
|
} else {
|
||||||
|
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
||||||
|
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
||||||
|
}
|
||||||
|
$formquestion = array(
|
||||||
|
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation edit (back to draft)
|
// Confirmation edit (back to draft)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user