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

Conflicts:
	htdocs/accountancy/bookkeeping/balance.php
	htdocs/contrat/list.php
	htdocs/don/class/api_donations.class.php
	htdocs/societe/class/societe.class.php
This commit is contained in:
Laurent Destailleur 2021-05-25 20:17:54 +02:00
commit a09db63c7b
7 changed files with 27 additions and 13 deletions

View File

@ -183,11 +183,11 @@ if ($action == 'export_csv') {
} }
foreach ($object->lines as $line) { foreach ($object->lines as $line) {
print length_accountg($line->numero_compte).$sep; print '"'.length_accountg($line->numero_compte).'"'.$sep;
print $object->get_compte_desc($line->numero_compte).$sep; print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep;
print price($line->debit).$sep; print '"'.price($line->debit).'"'.$sep;
print price($line->credit).$sep; print '"'.price($line->credit).'"'.$sep;
print price($line->debit - $line->credit).$sep; print '"'.price($line->debit - $line->credit).'"'.$sep;
print "\n"; print "\n";
} }

View File

@ -188,7 +188,7 @@ if ($action == 'delete') {
$form = new Form($db); $form = new Form($db);
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración'; $wikihelp = 'EN:Setup_Translation|FR:Paramétrage_Traduction|ES:Configuración_Traducción';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.urlencode($mode); $param = '&mode='.urlencode($mode);

View File

@ -68,6 +68,8 @@ $modulesdir = dolGetModulesDirs('/mailings');
$object = new Mailing($db); $object = new Mailing($db);
$result = $object->fetch($id); $result = $object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ciblescard', 'globalcard'));
// Security check // Security check
if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
@ -438,6 +440,10 @@ if ($object->fetch($id) >= 0) {
} }
} // End foreach dir } // End foreach dir
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>'; print '</div>';
print '<br><br>'; print '<br><br>';

View File

@ -289,6 +289,12 @@ if (!empty($search_ref_customer)) {
if (!empty($search_ref_supplier)) { if (!empty($search_ref_supplier)) {
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
} }
if ($search_zip) {
$sql .= natural_search(array('s.zip'), $search_zip);
}
if ($search_town) {
$sql .= natural_search(array('s.town'), $search_town);
}
if ($search_sale > 0) { if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
} }

View File

@ -33,7 +33,7 @@ class Donations extends DolibarrApi
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
public static $FIELDS = array( public static $FIELDS = array(
'socid' 'amount'
); );
/** /**
@ -199,7 +199,7 @@ class Donations extends DolibarrApi
}*/ }*/
if ($this->don->create(DolibarrApiAccess::$user) < 0) { if ($this->don->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating order", array_merge(array($this->don->error), $this->don->errors)); throw new RestException(500, "Error creating donation", array_merge(array($this->don->error), $this->don->errors));
} }
return $this->don->id; return $this->don->id;
@ -311,7 +311,7 @@ class Donations extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->don->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); $result = $this->don->valid_promesse($id, DolibarrApiAccess::$user->id, $notrigger);
if ($result == 0) { if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
@ -364,7 +364,7 @@ class Donations extends DolibarrApi
private function _validate($data) private function _validate($data)
{ {
$don = array(); $don = array();
foreach (Orders::$FIELDS as $field) { foreach (Donations::$FIELDS as $field) {
if (!isset($data[$field])) { if (!isset($data[$field])) {
throw new RestException(400, $field." field missing"); throw new RestException(400, $field." field missing");
} }

View File

@ -380,7 +380,7 @@ class Don extends CommonObject
$sql .= ", phone"; $sql .= ", phone";
$sql .= ", phone_mobile"; $sql .= ", phone_mobile";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'"; $sql .= "'".$this->db->idate($this->date ? $this->date : $now)."'";
$sql .= ", ".$conf->entity; $sql .= ", ".$conf->entity;
$sql .= ", ".price2num($this->amount); $sql .= ", ".price2num($this->amount);
$sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null"); $sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");

View File

@ -1256,6 +1256,8 @@ if (empty($reshook)) {
$tva_tx = get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id); $tva_tx = get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id);
} }
$object->special_code = $lines[$i]->special_code;
$result = $object->addline( $result = $object->addline(
$desc, $desc,
$lines[$i]->subprice, $lines[$i]->subprice,