Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
98b5247b27
@ -117,7 +117,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||||
print "<br>\n"; print "<br>\n";
|
print "<br>\n"; print "<br>\n";
|
||||||
|
|
||||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||||
|
|||||||
@ -582,36 +582,15 @@ if (empty($reshook)) {
|
|||||||
$id = $object->id;
|
$id = $object->id;
|
||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
if ($object->error) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
} else {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-create thirdparty on member creation
|
// Auto-create thirdparty on member creation
|
||||||
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
|
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// User creation
|
// Create third party out of a member
|
||||||
$company = new Societe($db);
|
$company = new Societe($db);
|
||||||
|
$result = $company->create_from_member($object);
|
||||||
$companyalias = '';
|
|
||||||
$fullname = $object->getFullName($langs);
|
|
||||||
|
|
||||||
if ($object->morphy == 'mor') {
|
|
||||||
$companyname = $object->company;
|
|
||||||
if (!empty($fullname)) {
|
|
||||||
$companyalias = $fullname;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$companyname = $fullname;
|
|
||||||
if (!empty($object->company)) {
|
|
||||||
$companyalias = $object->company;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $company->create_from_member($object, $companyname, $companyalias);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans($company->error), null, 'errors');
|
setEventMessages($langs->trans($company->error), null, 'errors');
|
||||||
|
|||||||
@ -43,10 +43,15 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
$langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
||||||
|
|
||||||
$mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common');
|
// if we set another view list mode, we keep it (till we change one more time)
|
||||||
if (empty($mode)) {
|
if (GETPOSTISSET('mode')) {
|
||||||
$mode = 'common';
|
$mode = GETPOST('mode', 'alpha');
|
||||||
|
if ($mode =='common' || $mode =='commonkanban')
|
||||||
|
dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
|
||||||
|
} else {
|
||||||
|
$mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$value = GETPOST('value', 'alpha');
|
$value = GETPOST('value', 'alpha');
|
||||||
$page_y = GETPOST('page_y', 'int');
|
$page_y = GETPOST('page_y', 'int');
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use OAuth\Common\Storage\DoliStorage;
|
use OAuth\Common\Storage\DoliStorage;
|
||||||
|
use OAuth\Common\Consumer\Credentials;
|
||||||
/**
|
/**
|
||||||
* Class to send emails (with attachments or not)
|
* Class to send emails (with attachments or not)
|
||||||
* Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto);
|
* Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto);
|
||||||
@ -981,8 +982,31 @@ class CMailFile
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||||
|
|
||||||
$storage = new DoliStorage($db, $conf);
|
$storage = new DoliStorage($db, $conf);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
||||||
|
$expire = false;
|
||||||
|
// Is token expired or will token expire in the next 30 seconds
|
||||||
|
if (is_object($tokenobj)) {
|
||||||
|
$expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30));
|
||||||
|
}
|
||||||
|
// Token expired so we refresh it
|
||||||
|
if (is_object($tokenobj) && $expire) {
|
||||||
|
$credentials = new Credentials(
|
||||||
|
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_ID'),
|
||||||
|
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_SECRET'),
|
||||||
|
getDolGlobalString('OAUTH_'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'_URLAUTHORIZE')
|
||||||
|
);
|
||||||
|
$serviceFactory = new \OAuth\ServiceFactory();
|
||||||
|
$oauthname = explode('-', $OAUTH_SERVICENAME);
|
||||||
|
// ex service is Google-Emails we need only the first part Google
|
||||||
|
$apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array());
|
||||||
|
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||||
|
$refreshtoken = $tokenobj->getRefreshToken();
|
||||||
|
$tokenobj = $apiService->refreshAccessToken($tokenobj);
|
||||||
|
$tokenobj->setRefreshToken($refreshtoken);
|
||||||
|
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
|
||||||
|
}
|
||||||
if (is_object($tokenobj)) {
|
if (is_object($tokenobj)) {
|
||||||
$this->transport->setAuthMode('XOAUTH2');
|
$this->transport->setAuthMode('XOAUTH2');
|
||||||
$this->transport->setPassword($tokenobj->getAccessToken());
|
$this->transport->setPassword($tokenobj->getAccessToken());
|
||||||
|
|||||||
@ -141,7 +141,7 @@ abstract class CommonObject
|
|||||||
public $linkedObjectsFullLoaded = array();
|
public $linkedObjectsFullLoaded = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Object To store a cloned copy of object before to edit it and keep track of old properties
|
* @var CommonObject To store a cloned copy of object before to edit it and keep track of old properties
|
||||||
*/
|
*/
|
||||||
public $oldcopy;
|
public $oldcopy;
|
||||||
|
|
||||||
|
|||||||
@ -693,7 +693,7 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
|
|||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common';
|
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT;
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
|
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
|
||||||
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
|
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
|
||||||
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
||||||
|
|||||||
@ -137,7 +137,6 @@ class printing_printgcp extends PrintingDriver
|
|||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
$token_ok = false;
|
$token_ok = false;
|
||||||
}
|
}
|
||||||
//var_dump($this->errors);exit;
|
|
||||||
|
|
||||||
$expire = false;
|
$expire = false;
|
||||||
// Is token expired or will token expire in the next 30 seconds
|
// Is token expired or will token expire in the next 30 seconds
|
||||||
|
|||||||
@ -257,7 +257,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$public = GETPOSTISSET('public') ? 1 : 0;
|
$public = GETPOSTISSET('public') ? 1 : 0;
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// email a peu pres correct et le login n'existe pas
|
// E-mail looks OK and login does not exist
|
||||||
$adh = new Adherent($db);
|
$adh = new Adherent($db);
|
||||||
$adh->statut = -1;
|
$adh->statut = -1;
|
||||||
$adh->public = $public;
|
$adh->public = $public;
|
||||||
@ -378,6 +378,16 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-create thirdparty on member creation
|
||||||
|
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
|
||||||
|
$company = new Societe($db);
|
||||||
|
$result = $company->create_from_member($adh);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
$errmsg .= join('<br>', $company->errors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
$urlback = $backtopage;
|
$urlback = $backtopage;
|
||||||
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
|
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
|
||||||
|
|||||||
@ -4024,12 +4024,25 @@ class Societe extends CommonObject
|
|||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG);
|
||||||
|
$fullname = $member->getFullName($langs);
|
||||||
|
|
||||||
$name = $socname ? $socname : $member->societe;
|
if ($member->morphy == 'mor') {
|
||||||
if (empty($name)) {
|
if (empty($socname)) {
|
||||||
$name = $member->getFullName($langs);
|
$socname = $member->company? $member->company : $member->societe;
|
||||||
|
}
|
||||||
|
if (!empty($fullname) && empty($socalias)) {
|
||||||
|
$socalias = $fullname;
|
||||||
|
}
|
||||||
|
} elseif (empty($socname) && $member->morphy == 'phy') {
|
||||||
|
if (empty($socname)) {
|
||||||
|
$socname = $fullname;
|
||||||
|
}
|
||||||
|
if (!empty($member->company) && empty($socalias)) {
|
||||||
|
$socalias = $member->company;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name = $socname;
|
||||||
$alias = $socalias ? $socalias : '';
|
$alias = $socalias ? $socalias : '';
|
||||||
|
|
||||||
// Positionne parametres
|
// Positionne parametres
|
||||||
|
|||||||
@ -564,6 +564,27 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'locatax1_tx' => $localtax1_tx, 'locatax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options);
|
$line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'locatax1_tx' => $localtax1_tx, 'locatax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options);
|
||||||
|
|
||||||
|
/* setup of margin calculation */
|
||||||
|
if (isset($conf->global->MARGIN_TYPE)) {
|
||||||
|
if ($conf->global->MARGIN_TYPE == 'pmp' && ! empty($prod->pmp)) {
|
||||||
|
$line['fk_fournprice'] = null;
|
||||||
|
$line['pa_ht'] = $prod->pmp;
|
||||||
|
} elseif ($conf->global->MARGIN_TYPE == 'costprice' && ! empty($prod->cost_price)) {
|
||||||
|
$line['fk_fournprice'] = null;
|
||||||
|
$line['pa_ht'] = $prod->cost_price;
|
||||||
|
} else {
|
||||||
|
// default is fournprice
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
|
$pf = new ProductFournisseur($db);
|
||||||
|
if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
|
||||||
|
$line['fk_fournprice'] = $pf->product_fourn_price_id;
|
||||||
|
$line['pa_ht'] = $pf->fourn_unitprice_with_discount;
|
||||||
|
if ($pf->fourn_charges > 0)
|
||||||
|
$line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// complete line by hook
|
// complete line by hook
|
||||||
$parameters = array('prod' => $prod, 'line' => $line);
|
$parameters = array('prod' => $prod, 'line' => $line);
|
||||||
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
|
||||||
@ -575,7 +596,7 @@ if (empty($reshook)) {
|
|||||||
$line = $hookmanager->resArray;
|
$line = $hookmanager->resArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
$idoflineadded = $invoice->addline($line['description'], $line['price'], $qty, $line['tva_tx'], $line['localtax1_tx'], $line['localtax2_tx'], $idproduct, $line['remise_percent'], '', 0, 0, 0, '', $price_base_type, $line['price_ttc'], $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', null, '', '', $line['array_options'], 100, '', null, 0);
|
$idoflineadded = $invoice->addline($line['description'], $line['price'], $qty, $line['tva_tx'], $line['localtax1_tx'], $line['localtax2_tx'], $idproduct, $line['remise_percent'], '', 0, 0, 0, '', $price_base_type, $line['price_ttc'], $prod->type, -1, 0, '', 0, (!empty($parent_line)) ? $parent_line : '', $line['fk_fournprice'], $line['pa_ht'], '', $line['array_options'], 100, '', null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
|
if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
|
||||||
|
|||||||
@ -669,6 +669,14 @@ if ($conf->global->TAKEPOS_DELAYED_PAYMENT) {
|
|||||||
print '<button type="button" class="calcbutton2" onclick="Validate(\'delayed\');">'.$langs->trans("Reported").'</button>';
|
print '<button type="button" class="calcbutton2" onclick="Validate(\'delayed\');">'.$langs->trans("Reported").'</button>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Add code from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$hookmanager->executeHooks('completePayment', $parameters, $invoice);
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user