Merge remote-tracking branch 'upstream/develop' into 14a2
This commit is contained in:
commit
82d1f99010
@ -1,10 +1,19 @@
|
||||
# HOW TO BUILD
|
||||
|
||||
## DEVELOPPER ACCOUNT
|
||||
|
||||
## ENABLE MODULE ZAPIER ON DOLIBARR
|
||||
|
||||
This should also enable the module API (required for authentication by Zapier service and to execute action in Dolibarr by Zapier).
|
||||
|
||||
Create the Dolibarr login that will be used by Zapier to call APIs. Give the login the permissions on the action you plan to automate.
|
||||
|
||||
|
||||
## CREATE A ZAPIER DEVELOPPER ACCOUNT
|
||||
|
||||
At first, you need to have a Zapier developper acoount, create it here [Zapier Platform](https://developer.zapier.com/)
|
||||
|
||||
## BUILD INTEGRATION
|
||||
|
||||
## INSTALL ZAPIER COMMAND LINE TOOLS WITH LINK TO ZAPIER ONLINE ACCOUNT
|
||||
|
||||
### Install Node.js
|
||||
|
||||
@ -17,7 +26,7 @@ After installation, confirm that Node.js is ready to use:
|
||||
|
||||
Next let's install the Zapier CLI tools. The CLI will allow you to build your app, deploy it to the Zapier platform, do local testing, manage users and testers, view remote logs, collaborate with your team, and more:
|
||||
|
||||
`cd dev/exemples/zapier`
|
||||
`cd dev/examples/zapier`
|
||||
|
||||
`npm install -g zapier-platform-cli` to install the CLI globally
|
||||
|
||||
@ -27,13 +36,15 @@ Next let's install the Zapier CLI tools. The CLI will allow you to build your ap
|
||||
|
||||
Let's configure authentication between your dev environment and the Zapier platform. You'll use the email address and password you use to log in to the Zapier application.
|
||||
|
||||
`zapier --version`
|
||||
`zapier login`
|
||||
|
||||
This command will set up a .zapierrc file in your home directory.
|
||||
|
||||
### Install the Project
|
||||
|
||||
In zapier exemple directory, run:
|
||||
In zapier example directory, run:
|
||||
|
||||
`cd dev/examples/zapier`
|
||||
|
||||
`npm install`
|
||||
|
||||
@ -41,8 +52,17 @@ In zapier exemple directory, run:
|
||||
|
||||
Let's deploy it! When you're ready to try your code out on the Zapier platform use the push command. Only you will be able to see the app until you invite testers.
|
||||
|
||||
`zapier register` (the first time, choose name for example "Dolibarr")
|
||||
|
||||
`zapier push`
|
||||
|
||||
### More info
|
||||
After a push, the Application, with the name you defined during the register step, is available when creating a Zap.
|
||||
|
||||
You will find original tutorial here : [https://zapier.com/developer/start/introduction](https://zapier.com/developer/start/introduction)
|
||||
|
||||
|
||||
### Create a Zap
|
||||
|
||||
Create a ZAP that use the application you registered.
|
||||
For authentication, you must enter the login / pass of account used by Zapier to call APIs.
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*jshint esversion: 6 */
|
||||
const testAuth = (z , bundle) => {
|
||||
const url = bundle.authData.url+'/api/index.php/login';
|
||||
const test = (z , bundle) => {
|
||||
const url = bundle.authData.url+'/api/index.php/status';
|
||||
// Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that
|
||||
// every user will have access to, such as an account or profile endpoint like /me.
|
||||
// In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path
|
||||
@ -11,67 +11,92 @@ const testAuth = (z , bundle) => {
|
||||
// This method can return any truthy value to indicate the credentials are valid.
|
||||
// Raise an error to show
|
||||
return promise.then((response) => {
|
||||
if (response.status === 401) {
|
||||
throw new Error('The Session Key you supplied is invalid');
|
||||
if (response.status === 400) {
|
||||
throw new Error('400 -The Session Key you supplied is invalid');
|
||||
}
|
||||
if (response.status === 403) {
|
||||
throw new Error('403 -The Session Key you supplied is invalid');
|
||||
}
|
||||
return response;
|
||||
});
|
||||
};
|
||||
|
||||
const getSessionKey = (z, bundle) => {
|
||||
// To include the session key header on all outbound requests, simply define a function here.
|
||||
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
|
||||
const includeSessionKeyHeader = (request, z, bundle) => {
|
||||
if (bundle.authData.sessionKey) {
|
||||
request.headers = request.headers || {};
|
||||
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
|
||||
}
|
||||
return request;
|
||||
};
|
||||
|
||||
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
|
||||
const sessionRefreshIf401 = (response, z, bundle) => {
|
||||
if (bundle.authData.sessionKey) {
|
||||
if (response.status === 401) {
|
||||
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
|
||||
}
|
||||
}
|
||||
return response;
|
||||
};
|
||||
|
||||
const getSessionKey = async (z, bundle) => {
|
||||
const url = bundle.authData.url + '/api/index.php/login';
|
||||
|
||||
const promise = z.request({
|
||||
method: 'POST',
|
||||
const response = await z.request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: {
|
||||
login: bundle.authData.login,
|
||||
password: bundle.authData.password,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return promise.then((response) => {
|
||||
if (response.status === 401) {
|
||||
throw new Error('The login/password you supplied is invalid');
|
||||
}
|
||||
const json = JSON.parse(response.content);
|
||||
return {
|
||||
sessionKey: json.success.token || 'secret'
|
||||
};
|
||||
});
|
||||
// if (response.status === 401) {
|
||||
// throw new Error('The login/password you supplied is invalid');
|
||||
// }
|
||||
const json = JSON.parse(response.content);
|
||||
return {
|
||||
sessionKey: json.success.token || '',
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
type: 'session',
|
||||
// Define any auth fields your app requires here. The user will be prompted to enter this info when
|
||||
// they connect their account.
|
||||
fields: [
|
||||
{
|
||||
key: 'url',
|
||||
label: 'Url of service',
|
||||
required: true,
|
||||
type: 'string'
|
||||
config: {
|
||||
type: 'session',
|
||||
sessionConfig: {
|
||||
perform: getSessionKey
|
||||
},
|
||||
{
|
||||
key: 'login',
|
||||
label: 'Login',
|
||||
required: true,
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
label: 'Password',
|
||||
required: true,
|
||||
type: 'password'
|
||||
}
|
||||
],
|
||||
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
|
||||
// method whenever a user connects their account for the first time.
|
||||
test: testAuth,
|
||||
// The method that will exchange the fields provided by the user for session credentials.
|
||||
sessionConfig: {
|
||||
perform: getSessionKey
|
||||
// Define any auth fields your app requires here. The user will be prompted to enter this info when
|
||||
// they connect their account.
|
||||
fields: [
|
||||
{
|
||||
key: 'url',
|
||||
label: 'Url of service without trailing-slash',
|
||||
required: true,
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'login',
|
||||
label: 'Login',
|
||||
required: true,
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'password',
|
||||
label: 'Password',
|
||||
required: true,
|
||||
type: 'password'
|
||||
}
|
||||
],
|
||||
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
|
||||
// method whenever a user connects their account for the first time.
|
||||
test,
|
||||
// The method that will exchange the fields provided by the user for session credentials.
|
||||
// assuming "login" is a key returned from the test
|
||||
connectionLabel: '{{login}}'
|
||||
},
|
||||
// assuming "login" is a key returned from the test
|
||||
connectionLabel: '{{login}}'
|
||||
befores: [includeSessionKeyHeader],
|
||||
afters: [sessionRefreshIf401],
|
||||
};
|
||||
|
||||
@ -72,7 +72,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
outputFields: [
|
||||
{key: 'id', label: 'ID'},
|
||||
{key: 'id', type: "integer", label: 'ID'},
|
||||
{key: 'name', label: 'Name'},
|
||||
{key: 'name_alias', label: 'Name alias'},
|
||||
{key: 'address', label: 'Address'},
|
||||
@ -81,8 +81,8 @@ module.exports = {
|
||||
{key: 'phone', label: 'Phone'},
|
||||
{key: 'fax', label: 'Fax'},
|
||||
{key: 'email', label: 'Email'},
|
||||
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
|
||||
{key: 'fournisseur', label: 'Supplier 0/1'},
|
||||
{key: 'client', type: "integer", label: 'Customer/Prospect 0/1/2/3'},
|
||||
{key: 'fournisseur', type: "integer", label: 'Supplier 0/1'},
|
||||
{key: 'code_client', label: 'Customer code'},
|
||||
{key: 'code_fournisseur', label: 'Supplier code'}
|
||||
]
|
||||
|
||||
@ -1,33 +1,39 @@
|
||||
/*jshint esversion: 6 */
|
||||
const triggerThirdparty = require('./triggers/thirdparty');
|
||||
const triggerOrder = require('./triggers/order');
|
||||
const triggerAction = require('./triggers/action');
|
||||
const triggerOrder = require('./triggers/order');
|
||||
const triggerThirdparty = require('./triggers/thirdparty');
|
||||
const triggerTicket = require('./triggers/ticket');
|
||||
const triggerUser = require('./triggers/user');
|
||||
|
||||
const searchThirdparty = require('./searches/thirdparty');
|
||||
|
||||
const createThirdparty = require('./creates/thirdparty');
|
||||
|
||||
const authentication = require('./authentication');
|
||||
const {
|
||||
config: authentication,
|
||||
befores = [],
|
||||
afters = [],
|
||||
} = require('./authentication');
|
||||
|
||||
// To include the session key header on all outbound requests, simply define a function here.
|
||||
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
|
||||
const includeSessionKeyHeader = (request, z, bundle) => {
|
||||
if (bundle.authData.sessionKey) {
|
||||
request.headers = request.headers || {};
|
||||
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
|
||||
}
|
||||
return request;
|
||||
};
|
||||
// const includeSessionKeyHeader = (request, z, bundle) => {
|
||||
// if (bundle.authData.sessionKey) {
|
||||
// request.headers = request.headers || {};
|
||||
// request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
|
||||
// }
|
||||
// return request;
|
||||
// };
|
||||
|
||||
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
|
||||
const sessionRefreshIf401 = (response, z, bundle) => {
|
||||
if (bundle.authData.sessionKey) {
|
||||
if (response.status === 401) {
|
||||
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
|
||||
}
|
||||
}
|
||||
return response;
|
||||
};
|
||||
// const sessionRefreshIf401 = (response, z, bundle) => {
|
||||
// if (bundle.authData.sessionKey) {
|
||||
// if (response.status === 401) {
|
||||
// throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
|
||||
// }
|
||||
// }
|
||||
// return response;
|
||||
// };
|
||||
|
||||
// We can roll up all our behaviors in an App.
|
||||
const App = {
|
||||
@ -40,11 +46,11 @@ const App = {
|
||||
|
||||
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
|
||||
beforeRequest: [
|
||||
includeSessionKeyHeader
|
||||
...befores
|
||||
],
|
||||
|
||||
afterResponse: [
|
||||
sessionRefreshIf401
|
||||
...afters
|
||||
],
|
||||
|
||||
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
|
||||
@ -53,9 +59,11 @@ const App = {
|
||||
|
||||
// If you want your trigger to show up, you better include it here!
|
||||
triggers: {
|
||||
[triggerThirdparty.key]: triggerThirdparty,
|
||||
[triggerAction.key]: triggerAction,
|
||||
[triggerOrder.key]: triggerOrder,
|
||||
[triggerAction.key]: triggerAction
|
||||
[triggerThirdparty.key]: triggerThirdparty,
|
||||
[triggerTicket.key]: triggerTicket,
|
||||
[triggerUser.key]: triggerUser,
|
||||
},
|
||||
|
||||
// If you want your searches to show up, you better include it here!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dolibarr",
|
||||
"version": "1.0.0",
|
||||
"version": "1.13.0",
|
||||
"description": "An app for connecting Dolibarr to the Zapier platform.",
|
||||
"repository": "Dolibarr/dolibarr",
|
||||
"homepage": "https://www.dolibarr.org/",
|
||||
@ -15,7 +15,7 @@
|
||||
"npm": ">=5.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"zapier-platform-core": "8.0.1"
|
||||
"zapier-platform-core": "10.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
|
||||
@ -54,13 +54,20 @@ module.exports = {
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{key: 'id', label: 'ID'},
|
||||
{key: 'createdAt', label: 'Created At'},
|
||||
{
|
||||
key: 'id',
|
||||
type: "integer",
|
||||
label: 'ID'
|
||||
},
|
||||
{key: 'createdAt', type: "integer", label: 'Created At'},
|
||||
{key: 'name', label: 'Name'},
|
||||
{key: 'firstname', label: 'Firstname'},
|
||||
{key: 'directions', label: 'Directions'},
|
||||
{key: 'authorId', label: 'Author ID'},
|
||||
{key: 'style', label: 'Style'}
|
||||
{key: 'authorId', type: "integer", label: 'Author ID'},
|
||||
{
|
||||
key: 'style',
|
||||
label: 'Style'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@ -10,14 +10,14 @@ const subscribeHook = (z, bundle) => {
|
||||
action: bundle.inputData.action
|
||||
};
|
||||
|
||||
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
|
||||
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
|
||||
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
body: data,
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
|
||||
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
|
||||
method: 'DELETE',
|
||||
};
|
||||
|
||||
@ -74,7 +74,7 @@ const getFallbackRealAction = (z, bundle) => {
|
||||
// For the test poll, you should get some real data, to aid the setup process.
|
||||
const module = bundle.inputData.module;
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/agendaevents/0',
|
||||
url: bundle.authData.url + '/api/index.php/agendaevents/0',
|
||||
};
|
||||
|
||||
return z.request(options).then((response) => [JSON.parse(response.content)]);
|
||||
@ -100,7 +100,7 @@ module.exports = {
|
||||
noun: 'Action',
|
||||
display: {
|
||||
label: 'New Agenda',
|
||||
description: 'Trigger when a new agenda with action is done in Dolibarr.'
|
||||
description: 'Triggers when a new agenda with action is done in Dolibarr.'
|
||||
},
|
||||
|
||||
// `operation` is where the business logic goes.
|
||||
@ -111,6 +111,7 @@ module.exports = {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'action',
|
||||
required: true,
|
||||
type: 'string',
|
||||
helpText: 'Which action of agenda this should trigger on.',
|
||||
choices: {
|
||||
@ -145,12 +146,33 @@ module.exports = {
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{key: 'id', label: 'ID'},
|
||||
{key: 'createdAt', label: 'Created At'},
|
||||
{key: 'name', label: 'Name'},
|
||||
{key: 'usertodo__name', label: 'UserToDo Name'},
|
||||
{key: 'authorId', label: 'Author ID'},
|
||||
{key: 'action', label: 'Action'}
|
||||
{
|
||||
key: 'id',
|
||||
type: "integer",
|
||||
label: 'ID'
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
type: "integer",
|
||||
label: 'Created At'
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
label: 'Name'
|
||||
},
|
||||
{
|
||||
key: 'usertodo__name',
|
||||
label: 'UserToDo Name'
|
||||
},
|
||||
{
|
||||
key: 'authorId',
|
||||
type: "integer",
|
||||
label: 'Author ID'
|
||||
},
|
||||
{
|
||||
key: 'action',
|
||||
label: 'Action'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
body: data,
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
@ -90,7 +90,7 @@ module.exports = {
|
||||
noun: 'Order',
|
||||
display: {
|
||||
label: 'New Order',
|
||||
description: 'Trigger when a new order with action is done in Dolibarr.'
|
||||
description: 'Triggers when a new order with action is done in Dolibarr.'
|
||||
},
|
||||
|
||||
// `operation` is where the business logic goes.
|
||||
@ -101,6 +101,7 @@ module.exports = {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'action',
|
||||
required: true,
|
||||
type: 'string',
|
||||
helpText: 'Which action of order this should trigger on.',
|
||||
choices: {
|
||||
@ -136,11 +137,11 @@ module.exports = {
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{key: 'id', label: 'ID'},
|
||||
{key: 'createdAt', label: 'Created At'},
|
||||
{key: 'id', type: "integer", label: 'ID'},
|
||||
{key: 'createdAt', type: "integer", label: 'Created At'},
|
||||
{key: 'name', label: 'Name'},
|
||||
{key: 'directions', label: 'Directions'},
|
||||
{key: 'authorId', label: 'Author ID'},
|
||||
{key: 'authorId', type: "integer", label: 'Author ID'},
|
||||
{key: 'module', label: 'Module'},
|
||||
{key: 'action', label: 'Action'}
|
||||
]
|
||||
|
||||
@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data)
|
||||
body: data,
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
@ -112,7 +112,7 @@ module.exports = {
|
||||
noun: 'Thirdparty',
|
||||
display: {
|
||||
label: 'New Thirdparty',
|
||||
description: 'Trigger when a new thirdpaty action is done in Dolibarr.'
|
||||
description: 'Triggers when a new thirdpaty action is done in Dolibarr.'
|
||||
},
|
||||
|
||||
// `operation` is where the business logic goes.
|
||||
@ -123,6 +123,7 @@ module.exports = {
|
||||
inputFields: [
|
||||
{
|
||||
key: 'action',
|
||||
required: true,
|
||||
type: 'string',
|
||||
helpText: 'Which action of thirdparty this should trigger on.',
|
||||
choices: {
|
||||
@ -159,12 +160,12 @@ module.exports = {
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{key: 'id', label: 'ID'},
|
||||
{key: 'id', type: "integer", label: 'ID'},
|
||||
{key: 'createdAt', label: 'Created At'},
|
||||
{key: 'name', label: 'Name'},
|
||||
{key: 'name_alias', label: 'Name alias'},
|
||||
{key: 'firstname', label: 'Firstame'},
|
||||
{key: 'authorId', label: 'Author ID'},
|
||||
{key: 'firstname', label: 'Firstname'},
|
||||
{key: 'authorId', type: "integer", label: 'Author ID'},
|
||||
{key: 'action', label: 'Action'},
|
||||
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
|
||||
{key: 'fournisseur', label: 'Supplier 0/1'},
|
||||
|
||||
237
dev/examples/zapier/triggers/ticket.js
Normal file
237
dev/examples/zapier/triggers/ticket.js
Normal file
@ -0,0 +1,237 @@
|
||||
const subscribeHook = (z, bundle) => {
|
||||
// `z.console.log()` is similar to `console.log()`.
|
||||
z.console.log('suscribing hook!');
|
||||
|
||||
// bundle.targetUrl has the Hook URL this app should call when an action is created.
|
||||
const data = {
|
||||
url: bundle.targetUrl,
|
||||
event: bundle.event,
|
||||
module: 'ticket',
|
||||
action: bundle.inputData.action
|
||||
};
|
||||
|
||||
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
|
||||
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: data,
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
return z.request(options).then((response) => JSON.parse(response.content));
|
||||
};
|
||||
|
||||
const unsubscribeHook = (z, bundle) => {
|
||||
// bundle.subscribeData contains the parsed response JSON from the subscribe
|
||||
// request made initially.
|
||||
z.console.log('unsuscribing hook!');
|
||||
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
|
||||
method: 'DELETE',
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
return z.request(options).then((response) => JSON.parse(response.content));
|
||||
};
|
||||
|
||||
const getTicket = (z, bundle) => {
|
||||
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
|
||||
// test poll) and also a .querystring property with the URL's query string.
|
||||
const ticket = {
|
||||
id: bundle.cleanedRequest.id,
|
||||
track_id: bundle.cleanedRequest.track_id,
|
||||
subject: bundle.cleanedRequest.subject,
|
||||
message: bundle.cleanedRequest.message,
|
||||
lastname: bundle.cleanedRequest.lastname,
|
||||
firstname: bundle.cleanedRequest.firstname,
|
||||
address: bundle.cleanedRequest.address,
|
||||
zip: bundle.cleanedRequest.zip,
|
||||
town: bundle.cleanedRequest.town,
|
||||
email_from: bundle.cleanedRequest.email_from,
|
||||
login: bundle.cleanedRequest.login,
|
||||
authorId: bundle.cleanedRequest.authorId,
|
||||
createdAt: bundle.cleanedRequest.createdAt,
|
||||
action: bundle.cleanedRequest.action
|
||||
};
|
||||
|
||||
return [ticket];
|
||||
};
|
||||
|
||||
const getFallbackRealTicket = (z, bundle) => {
|
||||
// For the test poll, you should get some real data, to aid the setup process.
|
||||
const module = bundle.inputData.module;
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/tickets/0',
|
||||
};
|
||||
|
||||
return z.request(options).then((response) => [JSON.parse(response.content)]);
|
||||
};
|
||||
|
||||
// const getModulesChoices = (z/*, bundle*/) => {
|
||||
// // For the test poll, you should get some real data, to aid the setup process.
|
||||
// const options = {
|
||||
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
|
||||
// };
|
||||
|
||||
// return z.request(options).then((response) => JSON.parse(response.content));
|
||||
// };
|
||||
// const getModulesChoices = () => {
|
||||
|
||||
// return {
|
||||
// orders: "Order",
|
||||
// invoices: "Invoice",
|
||||
// thirdparties: "Thirdparty",
|
||||
// users: "User",
|
||||
// tickets: "Ticket",
|
||||
// contacts: "Contacts"
|
||||
// };
|
||||
// };
|
||||
|
||||
// const getActionsChoices = (z, bundle) => {
|
||||
// // For the test poll, you should get some real data, to aid the setup process.
|
||||
// const module = bundle.inputData.module;
|
||||
// const options = {
|
||||
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
|
||||
// };
|
||||
|
||||
// return z.request(options).then((response) => JSON.parse(response.content));
|
||||
// };
|
||||
|
||||
// We recommend writing your triggers separate like this and rolling them
|
||||
// into the App definition at the end.
|
||||
module.exports = {
|
||||
key: 'ticket',
|
||||
|
||||
// You'll want to provide some helpful display labels and descriptions
|
||||
// for tickets. Zapier will put them into the UX.
|
||||
noun: 'Ticket',
|
||||
display: {
|
||||
label: 'New Ticket',
|
||||
description: 'Triggers when a new ticket action is done in Dolibarr.'
|
||||
},
|
||||
|
||||
// `operation` is where the business logic goes.
|
||||
operation: {
|
||||
|
||||
// `inputFields` can define the fields a ticket could provide,
|
||||
// we'll pass them in as `bundle.inputData` later.
|
||||
inputFields: [
|
||||
{
|
||||
key: 'action',
|
||||
type: 'string',
|
||||
required: true,
|
||||
helpText: 'Which action of ticket this should trigger on.',
|
||||
choices: {
|
||||
create: "Create",
|
||||
modify: "Modify",
|
||||
validate: "Validate",
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
type: 'hook',
|
||||
|
||||
performSubscribe: subscribeHook,
|
||||
performUnsubscribe: unsubscribeHook,
|
||||
|
||||
perform: getTicket,
|
||||
performList: getFallbackRealTicket,
|
||||
|
||||
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
|
||||
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
|
||||
// returned records, and have obviously dummy values that we can show to any user.
|
||||
sample: {
|
||||
id: 1,
|
||||
track_id: 'Xaz123er',
|
||||
subject: 'Subject',
|
||||
message: 'Message',
|
||||
createdAt: 1472069465,
|
||||
lastname: 'DOE',
|
||||
firstname: 'John',
|
||||
email: 'john@doe.com',
|
||||
address: 'Park Avenue',
|
||||
zip: '12345',
|
||||
town: 'NEW-YORK',
|
||||
email_from: 'doe.john@example;com',
|
||||
authorId: 1,
|
||||
action: 'create'
|
||||
},
|
||||
|
||||
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
|
||||
// field definitions. The result will be used to augment the sample.
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{
|
||||
key: 'id',
|
||||
type: "integer",
|
||||
label: 'ID'
|
||||
},
|
||||
{
|
||||
key: 'track_id',
|
||||
type: "string",
|
||||
label: 'TrackID'
|
||||
},
|
||||
{
|
||||
key: 'subject',
|
||||
type: "string",
|
||||
label: 'Subject'
|
||||
},
|
||||
{
|
||||
key: 'message',
|
||||
type: "string",
|
||||
label: 'Message'
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
type: "integer",
|
||||
label: 'Created At'
|
||||
},
|
||||
{
|
||||
key: 'lastname',
|
||||
label: 'Lastname'
|
||||
},
|
||||
{
|
||||
key: 'firstname',
|
||||
label: 'Firstname'
|
||||
},
|
||||
{
|
||||
key: 'email',
|
||||
label: 'Email'
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
label: 'Address'
|
||||
},
|
||||
{
|
||||
key: 'zip',
|
||||
label: 'Zip'
|
||||
},
|
||||
{
|
||||
key: 'town',
|
||||
label: 'Town'
|
||||
},
|
||||
{
|
||||
key: 'email_from',
|
||||
type: 'string',
|
||||
label: 'Email from'
|
||||
},
|
||||
{
|
||||
key: 'authorId',
|
||||
type: "integer",
|
||||
label: 'Author ID'
|
||||
},
|
||||
{
|
||||
key: 'action',
|
||||
type: 'string',
|
||||
label: 'Action'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
177
dev/examples/zapier/triggers/user.js
Normal file
177
dev/examples/zapier/triggers/user.js
Normal file
@ -0,0 +1,177 @@
|
||||
const subscribeHook = (z, bundle) => {
|
||||
// `z.console.log()` is similar to `console.log()`.
|
||||
z.console.log('suscribing hook!');
|
||||
|
||||
// bundle.targetUrl has the Hook URL this app should call when an action is created.
|
||||
const data = {
|
||||
url: bundle.targetUrl,
|
||||
event: bundle.event,
|
||||
module: 'user',
|
||||
action: bundle.inputData.action
|
||||
};
|
||||
|
||||
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
|
||||
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'POST',
|
||||
body: data,
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
return z.request(options).then((response) => JSON.parse(response.content));
|
||||
};
|
||||
|
||||
const unsubscribeHook = (z, bundle) => {
|
||||
// bundle.subscribeData contains the parsed response JSON from the subscribe
|
||||
// request made initially.
|
||||
z.console.log('unsuscribing hook!');
|
||||
|
||||
// You can build requests and our client will helpfully inject all the variables
|
||||
// you need to complete. You can also register middleware to control this.
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
|
||||
method: 'DELETE',
|
||||
};
|
||||
|
||||
// You may return a promise or a normal data structure from any perform method.
|
||||
return z.request(options).then((response) => JSON.parse(response.content));
|
||||
};
|
||||
|
||||
const getUser = (z, bundle) => {
|
||||
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
|
||||
// test poll) and also a .querystring property with the URL's query string.
|
||||
const user = {
|
||||
id: bundle.cleanedRequest.id,
|
||||
lastname: bundle.cleanedRequest.lastname,
|
||||
firstname: bundle.cleanedRequest.firstname,
|
||||
address: bundle.cleanedRequest.address,
|
||||
zip: bundle.cleanedRequest.zip,
|
||||
town: bundle.cleanedRequest.town,
|
||||
email: bundle.cleanedRequest.email,
|
||||
login: bundle.cleanedRequest.login,
|
||||
authorId: bundle.cleanedRequest.authorId,
|
||||
createdAt: bundle.cleanedRequest.createdAt,
|
||||
action: bundle.cleanedRequest.action
|
||||
};
|
||||
|
||||
return [user];
|
||||
};
|
||||
|
||||
const getFallbackRealUser = (z, bundle) => {
|
||||
// For the test poll, you should get some real data, to aid the setup process.
|
||||
const module = bundle.inputData.module;
|
||||
const options = {
|
||||
url: bundle.authData.url + '/api/index.php/users/0',
|
||||
};
|
||||
|
||||
return z.request(options).then((response) => [JSON.parse(response.content)]);
|
||||
};
|
||||
|
||||
// const getModulesChoices = (z/*, bundle*/) => {
|
||||
// // For the test poll, you should get some real data, to aid the setup process.
|
||||
// const options = {
|
||||
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
|
||||
// };
|
||||
|
||||
// return z.request(options).then((response) => JSON.parse(response.content));
|
||||
// };
|
||||
// const getModulesChoices = () => {
|
||||
|
||||
// return {
|
||||
// orders: "Order",
|
||||
// invoices: "Invoice",
|
||||
// thirdparties: "Thirdparty",
|
||||
// users: "User",
|
||||
// contacts: "Contacts"
|
||||
// };
|
||||
// };
|
||||
|
||||
// const getActionsChoices = (z, bundle) => {
|
||||
// // For the test poll, you should get some real data, to aid the setup process.
|
||||
// const module = bundle.inputData.module;
|
||||
// const options = {
|
||||
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
|
||||
// };
|
||||
|
||||
// return z.request(options).then((response) => JSON.parse(response.content));
|
||||
// };
|
||||
|
||||
// We recommend writing your triggers separate like this and rolling them
|
||||
// into the App definition at the end.
|
||||
module.exports = {
|
||||
key: 'user',
|
||||
|
||||
// You'll want to provide some helpful display labels and descriptions
|
||||
// for users. Zapier will put them into the UX.
|
||||
noun: 'User',
|
||||
display: {
|
||||
label: 'New User',
|
||||
description: 'Triggers when a new user action is done in Dolibarr.'
|
||||
},
|
||||
|
||||
// `operation` is where the business logic goes.
|
||||
operation: {
|
||||
|
||||
// `inputFields` can define the fields a user could provide,
|
||||
// we'll pass them in as `bundle.inputData` later.
|
||||
inputFields: [
|
||||
{
|
||||
key: 'action',
|
||||
required: true,
|
||||
type: 'string',
|
||||
helpText: 'Which action of user this should trigger on.',
|
||||
choices: {
|
||||
create: "Create",
|
||||
modify: "Modify",
|
||||
validate: "Validate",
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
type: 'hook',
|
||||
|
||||
performSubscribe: subscribeHook,
|
||||
performUnsubscribe: unsubscribeHook,
|
||||
|
||||
perform: getUser,
|
||||
performList: getFallbackRealUser,
|
||||
|
||||
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
|
||||
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
|
||||
// returned records, and have obviously dummy values that we can show to any user.
|
||||
sample: {
|
||||
id: 1,
|
||||
createdAt: 1472069465,
|
||||
lastname: 'DOE',
|
||||
firstname: 'John',
|
||||
email: 'john@doe.com',
|
||||
address: 'Park Avenue',
|
||||
zip: '12345',
|
||||
town: 'NEW-YORK',
|
||||
login: 'doe.john',
|
||||
authorId: 1,
|
||||
action: 'create'
|
||||
},
|
||||
|
||||
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
|
||||
// field definitions. The result will be used to augment the sample.
|
||||
// outputFields: () => { return []; }
|
||||
// Alternatively, a static field definition should be provided, to specify labels for the fields
|
||||
outputFields: [
|
||||
{key: 'id', type: "integer", label: 'ID'},
|
||||
{key: 'createdAt', type: "integer", label: 'Created At'},
|
||||
{key: 'lastname', label: 'Lastname'},
|
||||
{key: 'firstname', label: 'Firstname'},
|
||||
{key: 'email', label: 'Email'},
|
||||
{key: 'address', label: 'Address'},
|
||||
{key: 'zip', label: 'Zip'},
|
||||
{key: 'town', label: 'Town'},
|
||||
{key: 'login', label: 'Login'},
|
||||
{key: 'authorId', type: "integer", label: 'Author ID'},
|
||||
{key: 'action', label: 'Action'}
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -105,7 +105,7 @@ $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
|
||||
llxHeader('', $title);
|
||||
|
||||
// Customer
|
||||
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity";
|
||||
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta <> ''";
|
||||
@ -148,7 +148,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
|
||||
|
||||
// Supplier
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta_fournisseur <> ''";
|
||||
//print $sql;
|
||||
@ -190,7 +190,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
|
||||
|
||||
// User
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
$sql .= " AND u.accountancy_code <> ''";
|
||||
//print $sql;
|
||||
@ -287,7 +287,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['subaccount']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
|
||||
if (!empty($arrayfields['label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('0'=>$langs->trans('Customer'), '1'=>$langs->trans('Supplier'), '2'=>$langs->trans('Employee')), $search_type, 1).'</td>';
|
||||
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print '<td class="liste_titre"> </td>'; }
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
@ -335,17 +335,17 @@ if ($resql)
|
||||
print '<td class="center">';
|
||||
$s = '';
|
||||
// Customer
|
||||
if ($obj->type == 0)
|
||||
if ($obj->type == 1)
|
||||
{
|
||||
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
|
||||
}
|
||||
// Supplier
|
||||
elseif ($obj->type == 1)
|
||||
elseif ($obj->type == 2)
|
||||
{
|
||||
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
|
||||
}
|
||||
// User
|
||||
elseif ($obj->type == 2)
|
||||
elseif ($obj->type == 3)
|
||||
{
|
||||
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
|
||||
}
|
||||
@ -378,17 +378,17 @@ if ($resql)
|
||||
print '<td class="center">';
|
||||
$e = '';
|
||||
// Customer
|
||||
if ($obj->type == 0)
|
||||
if ($obj->type == 1)
|
||||
{
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
// Supplier
|
||||
elseif ($obj->type == 1)
|
||||
elseif ($obj->type == 2)
|
||||
{
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
// User
|
||||
elseif ($obj->type == 2)
|
||||
elseif ($obj->type == 3)
|
||||
{
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
|
||||
@ -357,12 +357,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
/*$topicmail="Information";
|
||||
$modelmail="project";
|
||||
$objecttmp=new Project($db);
|
||||
$trackid='prj'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -285,12 +285,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport").'</span></br><br>';
|
||||
|
||||
/*$topicmail="Information";
|
||||
$modelmail="project";
|
||||
$objecttmp=new Project($db);
|
||||
$trackid='prj'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -358,12 +358,6 @@ if ($result) {
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
|
||||
|
||||
/*$topicmail="Information";
|
||||
$modelmail="project";
|
||||
$objecttmp=new Project($db);
|
||||
$trackid='prj'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -2306,14 +2306,16 @@ class Adherent extends CommonObject
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $user, $langs;
|
||||
$now = dol_now();
|
||||
|
||||
// Initialise parametres
|
||||
$this->id = 0;
|
||||
$this->entity = 1;
|
||||
$this->specimen = 1;
|
||||
$this->civility_id = 0;
|
||||
$this->lastname = 'DOLIBARR';
|
||||
@ -2330,24 +2332,30 @@ class Adherent extends CommonObject
|
||||
$this->country = 'France';
|
||||
$this->morphy = 'mor';
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->socialnetworks = array('skype' => 'skypepseudo', 'twitter' => 'twitterpseudo', 'facebook' => 'facebookpseudo', 'linkedin' => 'linkedinpseudo');
|
||||
$this->socialnetworks = array(
|
||||
'skype' => 'skypepseudo',
|
||||
'twitter' => 'twitterpseudo',
|
||||
'facebook' => 'facebookpseudo',
|
||||
'linkedin' => 'linkedinpseudo',
|
||||
);
|
||||
$this->phone = '0999999999';
|
||||
$this->phone_perso = '0999999998';
|
||||
$this->phone_mobile = '0999999997';
|
||||
$this->note_private = 'No comment';
|
||||
$this->birth = time();
|
||||
$this->note_public = 'This is a public note';
|
||||
$this->note_private = 'This is a private note';
|
||||
$this->birth = $now;
|
||||
$this->photo = '';
|
||||
$this->public = 1;
|
||||
$this->statut = 0;
|
||||
|
||||
$this->datefin = time();
|
||||
$this->datevalid = time();
|
||||
$this->datefin = $now;
|
||||
$this->datevalid = $now;
|
||||
|
||||
$this->typeid = 1; // Id type adherent
|
||||
$this->type = 'Type adherent'; // Libelle type adherent
|
||||
$this->need_subscription = 0;
|
||||
|
||||
$this->first_subscription_date = time();
|
||||
$this->first_subscription_date = $now;
|
||||
$this->first_subscription_date_start = $this->first_subscription_date;
|
||||
$this->first_subscription_date_end = dol_time_plus_duree($this->first_subscription_date_start, 1, 'y');
|
||||
$this->first_subscription_amount = 10;
|
||||
@ -2356,6 +2364,7 @@ class Adherent extends CommonObject
|
||||
$this->last_subscription_date_start = $this->first_subscription_date;
|
||||
$this->last_subscription_date_end = dol_time_plus_duree($this->last_subscription_date_start, 1, 'y');
|
||||
$this->last_subscription_amount = 10;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -67,12 +67,16 @@ class Members extends DolibarrApi
|
||||
}
|
||||
|
||||
$member = new Adherent($this->db);
|
||||
$result = $member->fetch($id);
|
||||
if ($id == 0) {
|
||||
$result = $member->initAsSpecimen();
|
||||
} else {
|
||||
$result = $member->fetch($id);
|
||||
}
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'member not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('adherent', $member->id) && $id > 0) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
||||
@ -156,7 +156,7 @@ class Subscription extends CommonObject
|
||||
} else {
|
||||
$type = $this->fk_type;
|
||||
}
|
||||
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
|
||||
$sql .= " VALUES (".$this->fk_adherent.", '".$this->db->escape($type)."', '".$this->db->idate($now)."',";
|
||||
$sql .= " '".$this->db->idate($this->dateh)."',";
|
||||
$sql .= " '".$this->db->idate($this->datef)."',";
|
||||
$sql .= " ".$this->amount.",";
|
||||
@ -174,7 +174,7 @@ class Subscription extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
$this->context = array('member'=>$member);
|
||||
$this->context = array('member' => $member);
|
||||
// Call triggers
|
||||
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
|
||||
@ -688,61 +688,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
print info_admin($debuginfo);
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
*/
|
||||
// Documents
|
||||
/*$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->emailcollector->dir_output . '/' . $objref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->emailcollector->read; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $user->rights->emailcollector->create; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('emailcollector', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
*/
|
||||
/*
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('emailcollector'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="' . dol_buildpath('/emailcollector/emailcollector_info.php', 1) . '?id=' . $object->id . '">';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'emailcollector_emailcollector', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
*/
|
||||
|
||||
//Select mail models is same action as presend
|
||||
/*
|
||||
if (GETPOST('modelselected')) $action = 'presend';
|
||||
|
||||
// Presend form
|
||||
$modelmail='inventory';
|
||||
$defaulttopic='InformationMessage';
|
||||
$diroutput = $conf->product->dir_output.'/inventory';
|
||||
$trackid = 'stockinv'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
*/
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -427,7 +427,7 @@ print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorde
|
||||
$topicmail = "Information";
|
||||
//$modelmail="subscription";
|
||||
$objecttmp = new EmailSenderProfile($db);
|
||||
//$trackid='sub'.$object->id;
|
||||
//$trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
|
||||
@ -78,15 +78,15 @@ class DolibarrApi
|
||||
* @return array
|
||||
*/
|
||||
/* Disabled, most APIs does not share same signature for method index
|
||||
function index()
|
||||
{
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => __class__.' is up and running!'
|
||||
)
|
||||
);
|
||||
}*/
|
||||
function index()
|
||||
{
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => __class__.' is up and running!'
|
||||
)
|
||||
);
|
||||
}*/
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
@ -221,11 +221,9 @@ class DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($object->thirdparty) && is_object($object->thirdparty))
|
||||
{
|
||||
if (!empty($object->thirdparty) && is_object($object->thirdparty)) {
|
||||
$this->_cleanObjectDatas($object->thirdparty);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
@ -229,9 +229,7 @@ class Documents extends DolibarrApi
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new RestException(403, 'Generation not available for this modulepart');
|
||||
}
|
||||
|
||||
@ -277,6 +275,8 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$id = (empty($id) ? 0 : $id);
|
||||
$recursive = 0;
|
||||
$type = 'files';
|
||||
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
||||
{
|
||||
@ -474,11 +474,27 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->categorie->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'category').$object->id."/photos/".dol_sanitizeFileName($object->ref);
|
||||
} elseif ($modulepart == 'ecm') {
|
||||
throw new RestException(500, 'Modulepart Ecm not implemented yet.');
|
||||
// // require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
|
||||
// if (!DolibarrApiAccess::$user->rights->ecm->read) {
|
||||
// throw new RestException(401);
|
||||
// }
|
||||
|
||||
// // $object = new EcmDirectory($this->db);
|
||||
// // $result = $object->fetch($ref);
|
||||
// // if (!$result) {
|
||||
// // throw new RestException(404, 'EcmDirectory not found');
|
||||
// // }
|
||||
// $upload_dir = $conf->ecm->dir_output;
|
||||
// $type = 'all';
|
||||
// $recursive = 0;
|
||||
} else {
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
|
||||
}
|
||||
@ -592,9 +608,7 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new RestException(500, 'Error while fetching Task '.$ref);
|
||||
}
|
||||
}
|
||||
@ -619,10 +633,8 @@ class Documents extends DolibarrApi
|
||||
$modulepart = 'propale';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$object = new Propal($this->db);
|
||||
}
|
||||
// TODO Implement additional moduleparts
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// TODO Implement additional moduleparts
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
@ -660,9 +672,7 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if ($modulepart == 'invoice') $modulepart = 'facture';
|
||||
if ($modulepart == 'member') $modulepart = 'adherent';
|
||||
|
||||
@ -700,20 +710,16 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$fhandle = @fopen($destfiletmp, 'w');
|
||||
if ($fhandle)
|
||||
{
|
||||
if ($fhandle) {
|
||||
$nbofbyteswrote = fwrite($fhandle, $newfilecontent);
|
||||
fclose($fhandle);
|
||||
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
throw new RestException(500, "Failed to move file into '".$destfile."'");
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +339,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "SendAssetsRef";
|
||||
$modelmail = "asset";
|
||||
$objecttmp = new Asset($db);
|
||||
$trackid = 'xxxx'.$object->id;
|
||||
$trackid = 'asset'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
|
||||
@ -439,7 +439,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "SendBillOfMaterialsRef";
|
||||
$modelmail = "bom";
|
||||
$objecttmp = new BOM($db);
|
||||
$trackid = 'xxxx'.$object->id;
|
||||
$trackid = 'bom'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
|
||||
@ -738,19 +738,17 @@ class BOM extends CommonObject
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("BillOfMaterials").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("BillOfMaterials").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->status)) {
|
||||
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
|
||||
|
||||
|
||||
@ -524,7 +524,7 @@ class ActionComm extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
|
||||
$this->ref =$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id");
|
||||
|
||||
// Now insert assigned users
|
||||
if (!$error)
|
||||
|
||||
@ -1613,7 +1613,6 @@ class Propal extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
|
||||
|
||||
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
|
||||
$sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
|
||||
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
|
||||
@ -1637,7 +1636,6 @@ class Propal extends CommonObject
|
||||
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
||||
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
|
||||
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
|
||||
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1273,15 +1273,6 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
if ($action == 'set_thirdparty' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
|
||||
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit();
|
||||
}
|
||||
|
||||
// add lines from objectlinked
|
||||
if ($action == 'import_lines_from_object'
|
||||
&& $usercancreate
|
||||
@ -2025,7 +2016,6 @@ if ($action == 'create' && $usercancreate)
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
|
||||
@ -3918,7 +3918,7 @@ class Commande extends CommonOrder
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'einstein';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->COMMANDE_ADDON_PDF)) {
|
||||
$modele = $conf->global->COMMANDE_ADDON_PDF;
|
||||
@ -4012,7 +4012,6 @@ class OrderLine extends CommonOrderLine
|
||||
*/
|
||||
public $commande_id;
|
||||
|
||||
// From llx_commandedet
|
||||
public $fk_parent_line;
|
||||
public $fk_facture;
|
||||
|
||||
|
||||
@ -1356,7 +1356,10 @@ class Account extends CommonObject
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$result = '';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("BankAccount").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightnow">'.$langs->trans("BankAccount").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||
$label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
|
||||
$label .= '<br><b>'.$langs->trans('IBAN').':</b> '.$this->iban;
|
||||
@ -1375,9 +1378,6 @@ class Account extends CommonObject
|
||||
$label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
|
||||
$label .= '<br><b>'.$langs->trans('AccountancyJournal').':</b> '.$this->accountancy_journal;
|
||||
}
|
||||
if (isset($this->status)) {
|
||||
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
|
||||
@ -56,9 +56,16 @@ class PaymentVarious extends CommonObject
|
||||
*/
|
||||
public $ref;
|
||||
|
||||
/**
|
||||
* @var int timestamp
|
||||
*/
|
||||
public $tms;
|
||||
public $datep;
|
||||
public $datev;
|
||||
|
||||
/**
|
||||
* @var int sens of operation
|
||||
*/
|
||||
public $sens;
|
||||
public $amount;
|
||||
public $type_payment;
|
||||
@ -90,6 +97,16 @@ class PaymentVarious extends CommonObject
|
||||
*/
|
||||
public $fk_bank;
|
||||
|
||||
/**
|
||||
* @var int transaction category
|
||||
*/
|
||||
public $categorie_transaction;
|
||||
|
||||
/**
|
||||
* @var int Account ID
|
||||
*/
|
||||
public $accountid;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
|
||||
@ -262,7 +262,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "Information";
|
||||
//$modelmail="subscription";
|
||||
$objecttmp = new Account($db);
|
||||
//$trackid='sub'.$object->id;
|
||||
$trackid = 'bank'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
|
||||
@ -343,7 +343,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "SendCashControlRef";
|
||||
$modelmail = "cashcontrol";
|
||||
$objecttmp = new CashControl($db);
|
||||
$trackid = 'xxxx'.$object->id;
|
||||
$trackid = 'cashfence'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
|
||||
@ -498,7 +498,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql .= ', f.date_lim_reglement as dlr';
|
||||
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql .= ', f.modelpdf';
|
||||
$sql .= ', f.modelpdf as model_pdf';
|
||||
$sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project';
|
||||
$sql .= ', f.fk_account';
|
||||
$sql .= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate';
|
||||
@ -562,7 +562,8 @@ class FactureRec extends CommonInvoice
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->modelpdf = $obj->modelpdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecatd
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->rang = $obj->rang;
|
||||
$this->special_code = $obj->special_code;
|
||||
$this->frequency = $obj->frequency;
|
||||
@ -1894,8 +1895,6 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
*/
|
||||
public $table_element = 'facturedet_rec';
|
||||
|
||||
public $date_start_fill;
|
||||
public $date_end_fill;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -144,8 +144,12 @@ class Facture extends CommonInvoice
|
||||
public $close_code;
|
||||
//! Commentaire si mis a paye sans paiement complet
|
||||
public $close_note;
|
||||
//! 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
|
||||
|
||||
/**
|
||||
* 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
|
||||
*/
|
||||
public $paye;
|
||||
|
||||
//! key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...)
|
||||
public $module_source;
|
||||
//! key of pos source ('0', '1', ...)
|
||||
@ -623,7 +627,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ", ".($this->remise_absolue > 0 ? $this->remise_absolue : 'NULL');
|
||||
$sql .= ", ".($this->remise_percent > 0 ? $this->remise_percent : 'NULL');
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
$sql .= ", ".(strval($this->date_pointoftax) != '' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null');
|
||||
$sql .= ", ".(empty($this->date_pointoftax) ? "null" : "'".$this->db->idate($this->date_pointoftax)."'");
|
||||
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
|
||||
@ -637,7 +641,8 @@ class Facture extends CommonInvoice
|
||||
$sql .= ", ".($this->fk_project ? $this->fk_project : "null");
|
||||
$sql .= ", ".$this->cond_reglement_id;
|
||||
$sql .= ", ".$this->mode_reglement_id;
|
||||
$sql .= ", '".$this->db->idate($this->date_lim_reglement)."', '".$this->db->escape($this->modelpdf)."'";
|
||||
$sql .= ", '".$this->db->idate($this->date_lim_reglement)."'";
|
||||
$sql .= ", ".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null");
|
||||
$sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape($this->situation_cycle_ref)."'" : "null");
|
||||
$sql .= ", ".($this->situation_counter ? "'".$this->db->escape($this->situation_counter)."'" : "null");
|
||||
$sql .= ", ".($this->situation_final ? $this->situation_final : 0);
|
||||
@ -751,7 +756,7 @@ class Facture extends CommonInvoice
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
|
||||
// Auto set date of service ?
|
||||
if ($this->lines[$i]->date_start_fill == 1 && $originaldatewhen) // $originaldatewhen is defined when generating from recurring invoice only
|
||||
if ($this->lines[$i]->date_start_fill == 1 && $originaldatewhen) // $originaldatewhen is defined when generating from recurring invoice only
|
||||
{
|
||||
$newinvoiceline->date_start = $originaldatewhen;
|
||||
}
|
||||
@ -1052,7 +1057,8 @@ class Facture extends CommonInvoice
|
||||
$facture->note_public = $this->note_public;
|
||||
$facture->note_private = $this->note_private;
|
||||
$facture->ref_client = $this->ref_client;
|
||||
$facture->modelpdf = $this->modelpdf;
|
||||
$facture->modelpdf = $this->modelpdf; // deprecated
|
||||
$facture->model_pdf = $this->modelpdf;
|
||||
$facture->fk_project = $this->fk_project;
|
||||
$facture->cond_reglement_id = $this->cond_reglement_id;
|
||||
$facture->mode_reglement_id = $this->mode_reglement_id;
|
||||
@ -2436,14 +2442,14 @@ class Facture extends CommonInvoice
|
||||
* @param string $force_number Reference to force on invoice
|
||||
* @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $batch_rule 0=do not decrement batch, else batch rule to use
|
||||
* 1=take in batches ordered by sellby and eatby dates
|
||||
* @param int $batch_rule 0=do not decrement batch, else batch rule to use, 1=take in batches ordered by sellby and eatby dates
|
||||
* @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK
|
||||
*/
|
||||
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$productStatic = null;
|
||||
$warehouseStatic = null;
|
||||
if ($batch_rule > 0) {
|
||||
@ -2488,7 +2494,7 @@ class Facture extends CommonInvoice
|
||||
// Check parameters
|
||||
if ($this->type == self::TYPE_REPLACEMENT) // if this is a replacement invoice
|
||||
{
|
||||
// Controle que facture source connue
|
||||
// Check that source invoice is known
|
||||
if ($this->fk_facture_source <= 0)
|
||||
{
|
||||
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceReplacement"));
|
||||
@ -4332,7 +4338,7 @@ class Facture extends CommonInvoice
|
||||
$modele = 'crabe';
|
||||
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$this->type;
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->$thisTypeConfName)) {
|
||||
$modele = $conf->global->$thisTypeConfName;
|
||||
|
||||
@ -77,9 +77,6 @@ $hookmanager->initHooks(array('invoiceindex'));
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$facturestatic = new Facture($db);
|
||||
$facturesupplierstatic = new FactureFournisseur($db);
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$thirdpartystatic = new Societe($db);
|
||||
@ -139,8 +136,10 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$tmpinvoice = new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.datef as date, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
|
||||
$sql .= ", f.type";
|
||||
$sql .= ", f.type, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
@ -161,9 +160,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, ";
|
||||
$sql .= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", cc.rowid, cc.code";
|
||||
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
|
||||
$sql .= " s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
|
||||
$sql .= " cc.rowid, cc.code";
|
||||
|
||||
// Add Group from hooks
|
||||
$parameters = array();
|
||||
@ -198,14 +197,16 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$facturestatic->id = $obj->rowid;
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->date = $db->jdate($obj->date);
|
||||
$facturestatic->type = $obj->type;
|
||||
$facturestatic->total_ht = $obj->total_ht;
|
||||
$facturestatic->total_tva = $obj->total_tva;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
$facturestatic->ref_client = $obj->ref_client;
|
||||
$tmpinvoice->id = $obj->rowid;
|
||||
$tmpinvoice->ref = $obj->ref;
|
||||
$tmpinvoice->date = $db->jdate($obj->date);
|
||||
$tmpinvoice->type = $obj->type;
|
||||
$tmpinvoice->total_ht = $obj->total_ht;
|
||||
$tmpinvoice->total_tva = $obj->total_tva;
|
||||
$tmpinvoice->total_ttc = $obj->total_ttc;
|
||||
$tmpinvoice->ref_client = $obj->ref_client;
|
||||
$tmpinvoice->statut = $obj->status;
|
||||
$tmpinvoice->paye = $obj->paye;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
@ -219,7 +220,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
|
||||
print $facturestatic->getNomUrl(1, '');
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">';
|
||||
print $companystatic->getNomUrl(1, 'customer');
|
||||
@ -248,7 +249,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
*/
|
||||
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier";
|
||||
$facturesupplierstatic = new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
@ -298,6 +301,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$facturesupplierstatic->total_ttc = $obj->total_ttc;
|
||||
$facturesupplierstatic->ref_supplier = $obj->ref_supplier;
|
||||
$facturesupplierstatic->type = $obj->type;
|
||||
$facturesupplierstatic->statut = $obj->status;
|
||||
$facturesupplierstatic->paye = $obj->paye;
|
||||
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
@ -343,9 +348,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
$facstatic = new Facture($db);
|
||||
$tmpinvoice = new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql .= ", f.date_lim_reglement as datelimite";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid";
|
||||
@ -400,14 +405,15 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
continue;
|
||||
}
|
||||
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->id = $obj->rowid;
|
||||
$facturestatic->total_ht = $obj->total_ht;
|
||||
$facturestatic->total_tva = $obj->total_tva;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
$facturestatic->type = $obj->type;
|
||||
$tmpinvoice->ref = $obj->ref;
|
||||
$tmpinvoice->id = $obj->rowid;
|
||||
$tmpinvoice->total_ht = $obj->total_ht;
|
||||
$tmpinvoice->total_tva = $obj->total_tva;
|
||||
$tmpinvoice->total_ttc = $obj->total_ttc;
|
||||
$tmpinvoice->statut = $obj->status;
|
||||
$tmpinvoice->paye = $obj->paye;
|
||||
$tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
$tmpinvoice->type = $obj->type;
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
@ -426,10 +432,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $facturestatic->getNomUrl(1, '');
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($facturestatic->hasDelay()) {
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
@ -437,7 +443,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print $formfile->getDocumentsLink($tmpinvoice->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
@ -447,7 +453,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="nowrap right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3, $obj->am).'</td>';
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
@ -484,7 +490,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$langs->load("boxes");
|
||||
$facstatic = new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email";
|
||||
@ -542,6 +548,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
$facstatic->statut = $obj->status;
|
||||
$facstatic->paye = $obj->paye;
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
@ -564,7 +572,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3).'</td>';
|
||||
print '<td>'.$facstatic->getLibStatut(3).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
@ -600,7 +608,7 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire)
|
||||
$langs->load("boxes");
|
||||
$donationstatic = new Don($db);
|
||||
|
||||
$sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut";
|
||||
$sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('donation').")";
|
||||
// Add where from hooks
|
||||
@ -648,6 +656,9 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire)
|
||||
$donationstatic->ref = $objp->rowid;
|
||||
$donationstatic->lastname = $objp->lastname;
|
||||
$donationstatic->firstname = $objp->firstname;
|
||||
$donationstatic->date = $objp->date;
|
||||
$donationstatic->statut = $objp->status;
|
||||
$donationstatic->status = $objp->status;
|
||||
|
||||
$label = $donationstatic->getFullName($langs);
|
||||
if ($objp->societe) $label .= ($label ? ' - ' : '').$objp->societe;
|
||||
@ -657,7 +668,7 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire)
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td class="nowrap right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
print '<td>'.$donationstatic->LibStatut($objp->fk_statut, 3).'</td>';
|
||||
print '<td>'.$donationstatic->getLibStatut(3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -737,6 +748,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$chargestatic->ref = $obj->rowid;
|
||||
$chargestatic->label = $obj->label;
|
||||
$chargestatic->paye = $obj->paye;
|
||||
$chargestatic->status = $obj->paye;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$chargestatic->getNomUrl(1).'</td>';
|
||||
@ -786,7 +798,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
$sql .= ", s.nom as name, s.email";
|
||||
$sql .= ", s.rowid as socid";
|
||||
$sql .= ", s.code_client, s.code_compta";
|
||||
$sql .= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc,";
|
||||
$sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.tva as total_tva, c.total_ttc,";
|
||||
$sql .= " cc.rowid as country_id, cc.code as country_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -860,6 +872,8 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
|
||||
$commandestatic->id = $obj->rowid;
|
||||
$commandestatic->ref = $obj->ref;
|
||||
$commandestatic->statut = $obj->status;
|
||||
$commandestatic->billed = $obj->facture;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
@ -886,7 +900,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc - $obj->tot_fttc).'</td>';
|
||||
print '<td>'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'</td>';
|
||||
print '<td>'.$commandestatic->getLibStatut(3).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ht += $obj->total_ht;
|
||||
$tot_ttc += $obj->total_ttc;
|
||||
@ -922,9 +936,9 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$facstatic = new Facture($db);
|
||||
$tmpinvoice = new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql .= ", f.date_lim_reglement as datelimite";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
@ -987,14 +1001,15 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
continue;
|
||||
}
|
||||
|
||||
$facturestatic->ref = $obj->ref;
|
||||
$facturestatic->id = $obj->rowid;
|
||||
$facturestatic->total_ht = $obj->total_ht;
|
||||
$facturestatic->total_tva = $obj->total_tva;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
$facturestatic->type = $obj->type;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
$tmpinvoice->ref = $obj->ref;
|
||||
$tmpinvoice->id = $obj->rowid;
|
||||
$tmpinvoice->total_ht = $obj->total_ht;
|
||||
$tmpinvoice->total_tva = $obj->total_tva;
|
||||
$tmpinvoice->total_ttc = $obj->total_ttc;
|
||||
$tmpinvoice->type = $obj->type;
|
||||
$tmpinvoice->statut = $obj->status;
|
||||
$tmpinvoice->paye = $obj->paye;
|
||||
$tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite);
|
||||
|
||||
$societestatic->id = $obj->socid;
|
||||
$societestatic->name = $obj->name;
|
||||
@ -1012,10 +1027,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
print $facturestatic->getNomUrl(1, '');
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($facturestatic->hasDelay()) {
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
@ -1023,7 +1038,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print $formfile->getDocumentsLink($tmpinvoice->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
@ -1034,7 +1049,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3, $obj->am, $obj->type).'</td>';
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
@ -1080,7 +1095,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
{
|
||||
$facstatic = new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
|
||||
$sql .= ", ff.date_lim_reglement";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid, s.email";
|
||||
@ -1153,6 +1168,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
$facstatic->statut = $obj->status;
|
||||
$facstatic->paye = $obj->paye;
|
||||
|
||||
$societestatic->id = $obj->socid;
|
||||
$societestatic->name = $obj->name;
|
||||
@ -1172,7 +1189,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3, $obj->am, $obj->type).'</td>';
|
||||
print '<td>'.$facstatic->getLibStatut(3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
|
||||
@ -538,10 +538,12 @@ class ChargeSociales extends CommonObject
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
|
||||
if (empty($this->ref)) $this->ref = $this->label;
|
||||
|
||||
$label = '<u>'.$langs->trans("SocialContribution").'</u>';
|
||||
$label = img_picto('', 'tax').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
|
||||
if (isset($this->paye)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
if (!empty($this->ref))
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (!empty($this->label))
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
@ -55,7 +55,7 @@ $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$object = new Contact($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -178,15 +178,15 @@ if (empty($reshook))
|
||||
|
||||
$object->entity = (GETPOSTISSET('entity') ?GETPOST('entity', 'int') : $conf->entity);
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
$object->town = GETPOST("town", 'alpha');
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
||||
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
||||
$object->civility_code = (string) GETPOST("civility_code", 'alpha');
|
||||
$object->poste = (string) GETPOST("poste", 'alpha');
|
||||
$object->address = (string) GETPOST("address", 'alpha');
|
||||
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
||||
$object->town = (string) GETPOST("town", 'alpha');
|
||||
$object->country_id = (int) GETPOST("country_id", 'int');
|
||||
$object->state_id = (int) GETPOST("state_id", 'int');
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||
@ -196,22 +196,22 @@ if (empty($reshook))
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
$object->socialnetworks[$key] = (string) GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->email = (string) GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->phone_pro = (string) GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = (string) GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = (string) GETPOST("fax", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'restricthtml');
|
||||
$object->note_private = GETPOST("note_private", 'restricthtml');
|
||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
|
||||
$object->statut = 1; //Defult status to Actif
|
||||
$object->statut = 1; //Default status to Actif
|
||||
|
||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||
$object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth", 'int'), GETPOST("birthdayday", 'int'), GETPOST("birthdayyear", 'int'));
|
||||
@ -225,9 +225,9 @@ if (empty($reshook))
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!GETPOST("lastname"))
|
||||
{
|
||||
$error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
|
||||
if (!GETPOST("lastname")) {
|
||||
$error++;
|
||||
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
@ -236,7 +236,8 @@ if (empty($reshook))
|
||||
$id = $object->create($user);
|
||||
if ($id <= 0)
|
||||
{
|
||||
$error++; $errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
|
||||
$error++;
|
||||
$errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors));
|
||||
$action = 'create';
|
||||
} else {
|
||||
// Categories association
|
||||
@ -278,14 +279,12 @@ if (empty($reshook))
|
||||
$result = $object->fetch($id);
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->old_lastname = GETPOST("old_lastname");
|
||||
$object->old_firstname = GETPOST("old_firstname");
|
||||
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
|
||||
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
|
||||
|
||||
$result = $object->delete();
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($backtopage)
|
||||
{
|
||||
if ($result > 0) {
|
||||
if ($backtopage) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
} else {
|
||||
@ -360,22 +359,22 @@ if (empty($reshook))
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->old_lastname = GETPOST("old_lastname", 'alpha');
|
||||
$object->old_firstname = GETPOST("old_firstname", 'alpha');
|
||||
$object->old_lastname = (string) GETPOST("old_lastname", 'alpha');
|
||||
$object->old_firstname = (string) GETPOST("old_firstname", 'alpha');
|
||||
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_code = GETPOST("civility_code", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
$object->lastname = (string) GETPOST("lastname", 'alpha');
|
||||
$object->firstname = (string) GETPOST("firstname", 'alpha');
|
||||
$object->civility_code = (string) GETPOST("civility_code", 'alpha');
|
||||
$object->poste = (string) GETPOST("poste", 'alpha');
|
||||
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
$object->town = GETPOST("town", 'alpha');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
$object->address = (string) GETPOST("address", 'alpha');
|
||||
$object->zip = (string) GETPOST("zipcode", 'alpha');
|
||||
$object->town = (string) GETPOST("town", 'alpha');
|
||||
$object->state_id = GETPOST("state_id", 'int');
|
||||
$object->country_id = GETPOST("country_id", 'int');
|
||||
|
||||
$object->email = GETPOST("email", 'alpha');
|
||||
$object->email = (string) GETPOST("email", 'alpha');
|
||||
$object->no_email = GETPOST("no_email", "int");
|
||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||
//$object->skype = GETPOST("skype", 'alpha');
|
||||
@ -386,17 +385,17 @@ if (empty($reshook))
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
|
||||
$object->socialnetworks[$key] = GETPOST($key, 'alphanohtml');
|
||||
$object->socialnetworks[$key] = (string) GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = GETPOST("fax", 'alpha');
|
||||
$object->priv = GETPOST("priv", 'int');
|
||||
$object->note_public = GETPOST("note_public", 'restricthtml');
|
||||
$object->note_private = GETPOST("note_private", 'restricthtml');
|
||||
$object->phone_pro = (string) GETPOST("phone_pro", 'alpha');
|
||||
$object->phone_perso = (string) GETPOST("phone_perso", 'alpha');
|
||||
$object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha');
|
||||
$object->fax = (string) GETPOST("fax", 'alpha');
|
||||
$object->priv = (string) GETPOST("priv", 'int');
|
||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -1559,7 +1558,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
$modelmail = 'contact';
|
||||
$defaulttopic = 'Information';
|
||||
$diroutput = $conf->contact->dir_output;
|
||||
$trackid = 'con'.$object->id;
|
||||
$trackid = 'ctc'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
@ -131,11 +131,18 @@ class Contact extends CommonObject
|
||||
public $civility;
|
||||
|
||||
/**
|
||||
* Address
|
||||
* @var string
|
||||
* @var string Address
|
||||
*/
|
||||
public $address;
|
||||
|
||||
/**
|
||||
* @var string zip code
|
||||
*/
|
||||
public $zip;
|
||||
|
||||
/**
|
||||
* @var string Town
|
||||
*/
|
||||
public $town;
|
||||
|
||||
public $state_id; // Id of department
|
||||
@ -201,10 +208,29 @@ class Contact extends CommonObject
|
||||
*/
|
||||
public $jabberid;
|
||||
|
||||
/**
|
||||
* @var string filename for photo
|
||||
*/
|
||||
public $photo;
|
||||
|
||||
/**
|
||||
* @var string phone pro
|
||||
*/
|
||||
public $phone_pro;
|
||||
|
||||
/**
|
||||
* @var string phone perso
|
||||
*/
|
||||
public $phone_perso;
|
||||
|
||||
/**
|
||||
* @var string phone mobile
|
||||
*/
|
||||
public $phone_mobile;
|
||||
|
||||
/**
|
||||
* @var string fax
|
||||
*/
|
||||
public $fax;
|
||||
|
||||
/**
|
||||
@ -253,9 +279,12 @@ class Contact extends CommonObject
|
||||
$this->db = $db;
|
||||
$this->statut = 1; // By default, status is enabled
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->mailing->enabled)) {
|
||||
$this->fields['no_email']['enabled'] = 0;
|
||||
}
|
||||
// typical ['s.nom'] is used for third-parties
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
$this->fields['fk_soc']['enabled'] = 0;
|
||||
@ -268,10 +297,8 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled']))
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) {
|
||||
unset($this->fields[$key]);
|
||||
}
|
||||
}
|
||||
@ -1308,7 +1335,8 @@ class Contact extends CommonObject
|
||||
$label .= '</div><div style="clear: both;"></div>';
|
||||
}
|
||||
|
||||
$label .= img_picto('', $this->picto).' <u>'.$langs->trans("Contact").'</u>';
|
||||
$label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Contact").'</u>';
|
||||
$label .= ' '.$this->getLibStatut(4);
|
||||
$label .= '<br><b>'.$langs->trans("Name").':</b> '.$this->getFullName($langs);
|
||||
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
|
||||
if (!empty($this->poste)) $label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
|
||||
@ -1474,6 +1502,7 @@ class Contact extends CommonObject
|
||||
|
||||
// Initialise parameters
|
||||
$this->id = 0;
|
||||
$this->entity = 1;
|
||||
$this->specimen = 1;
|
||||
$this->lastname = 'DOLIBARR';
|
||||
$this->firstname = 'SPECIMEN';
|
||||
|
||||
@ -891,7 +891,7 @@ while ($i < min($num, $limit))
|
||||
if (!empty($arrayfields['p.lastname']['checked']))
|
||||
{
|
||||
print '<td class="middle tdoverflowmax200">';
|
||||
print $contactstatic->getNomUrl(1, '', 0);
|
||||
print $contactstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -727,7 +727,7 @@ class Contrat extends CommonObject
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
|
||||
$this->fk_projet = $obj->fk_project; // deprecated
|
||||
$this->fk_project = $obj->fk_project;
|
||||
@ -2419,7 +2419,7 @@ class Contrat extends CommonObject
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'strato';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->CONTRACT_ADDON_PDF)) {
|
||||
$modele = $conf->global->CONTRACT_ADDON_PDF;
|
||||
|
||||
@ -60,7 +60,10 @@ if ($action == 'add' && !empty($permissiontoadd))
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
}
|
||||
// Ignore special fields
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
if (in_array($key, array('rowid', 'entity', 'import_key'))) continue;
|
||||
if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
|
||||
if (!in_array(abs($val['visible']), array(1, 3))) continue; // Only 1 and 3 that are case to create
|
||||
}
|
||||
|
||||
// Set value to insert
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
@ -141,7 +144,10 @@ if ($action == 'update' && !empty($permissiontoadd))
|
||||
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
}
|
||||
// Ignore special fields
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
|
||||
if (in_array($key, array('rowid', 'entity', 'import_key'))) continue;
|
||||
if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
|
||||
if (!in_array(abs($val['visible']), array(1, 3, 4))) continue; // Only 1 and 3 and 4 that are case to update
|
||||
}
|
||||
|
||||
// Set value to update
|
||||
if (preg_match('/^(text|html)/', $object->fields[$key]['type'])) {
|
||||
|
||||
@ -518,15 +518,17 @@ abstract class CommonInvoice extends CommonObject
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, -1 otherwise)
|
||||
* @param int $type Type invoice
|
||||
* @param int $type Type invoice. If -1, we use $this->type
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0)
|
||||
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('bills');
|
||||
|
||||
if ($type == -1) $type = $this->type;
|
||||
|
||||
$statusType = 'status0';
|
||||
$prefix = 'Short';
|
||||
if (!$paye) {
|
||||
@ -931,6 +933,9 @@ abstract class CommonInvoiceLine extends CommonObjectLine
|
||||
*/
|
||||
public $total_ttc;
|
||||
|
||||
public $date_start_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_start at creation
|
||||
public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation
|
||||
|
||||
/**
|
||||
* List of cumulative options:
|
||||
* Bit 0: 0 si TVA normal - 1 si TVA NPR
|
||||
@ -939,13 +944,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
|
||||
*/
|
||||
public $info_bits = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
public $special_code = 0;
|
||||
|
||||
public $fk_multicurrency;
|
||||
}
|
||||
|
||||
@ -347,6 +347,11 @@ abstract class CommonObject
|
||||
*/
|
||||
public $fk_account;
|
||||
|
||||
/**
|
||||
* @var string Open ID
|
||||
*/
|
||||
public $openid;
|
||||
|
||||
/**
|
||||
* @var string Public note
|
||||
* @see update_note()
|
||||
@ -7507,8 +7512,7 @@ abstract class CommonObject
|
||||
// Depending on field type ('datetime', ...)
|
||||
if ($this->isDate($info))
|
||||
{
|
||||
if (empty($this->{$field}))
|
||||
{
|
||||
if (empty($this->{$field})) {
|
||||
$queryarray[$field] = null;
|
||||
} else {
|
||||
$queryarray[$field] = $this->db->idate($this->{$field});
|
||||
@ -7526,16 +7530,27 @@ abstract class CommonObject
|
||||
} elseif ($this->isDuration($info))
|
||||
{
|
||||
// $this->{$field} may be null, '', 0, '0', 123, '123'
|
||||
if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
|
||||
if (!isset($this->{$field})) {
|
||||
$queryarray[$field] = 0;
|
||||
} else {
|
||||
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
}
|
||||
}
|
||||
else $queryarray[$field] = null;
|
||||
} elseif ($this->isInt($info) || $this->isFloat($info))
|
||||
{
|
||||
if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity;
|
||||
else {
|
||||
// $this->{$field} may be null, '', 0, '0', 123, '123'
|
||||
if ($this->{$field} != '' || !empty($info['notnull'])) {
|
||||
if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
|
||||
if (!isset($this->{$field})) {
|
||||
$queryarray[$field] = 0;
|
||||
} elseif ($this->isInt($info)) {
|
||||
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
} elseif ($this->isFloat($info)) {
|
||||
$queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
|
||||
}
|
||||
} else $queryarray[$field] = null;
|
||||
}
|
||||
} else {
|
||||
@ -7912,6 +7927,7 @@ abstract class CommonObject
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
|
||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
||||
|
||||
// Add quotes and escape on fields with type string
|
||||
$keys = array();
|
||||
$values = array();
|
||||
$tmp = array();
|
||||
@ -7922,7 +7938,7 @@ abstract class CommonObject
|
||||
$tmp[] = $k.'='.$this->quote($v, $this->fields[$k]);
|
||||
}
|
||||
|
||||
// Clean and check mandatory
|
||||
// Clean and check mandatory fields
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = ''; // This is an implicit foreign key field
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/**
|
||||
* \file htdocs/core/class/commonobjectline.class.php
|
||||
* \ingroup core
|
||||
* \brief File of the superclass of classes of lines of business objects (invoice, contract, PROPAL, commands, etc. ...)
|
||||
* \brief File of the superclass of classes of lines of business objects (invoice, contract, proposal, orders, etc. ...)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -121,6 +121,12 @@ abstract class CommonOrderLine extends CommonObjectLine
|
||||
*/
|
||||
public $remise_percent;
|
||||
|
||||
/**
|
||||
* VAT code
|
||||
* @var string
|
||||
*/
|
||||
public $vat_src_code;
|
||||
|
||||
/**
|
||||
* VAT %
|
||||
* @var float
|
||||
@ -151,4 +157,6 @@ abstract class CommonOrderLine extends CommonObjectLine
|
||||
public $info_bits = 0;
|
||||
|
||||
public $special_code = 0;
|
||||
|
||||
public $fk_multicurrency;
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ class Events // extends CommonObject
|
||||
|
||||
// Clean parameters
|
||||
$this->description = trim($this->description);
|
||||
if (empty($this->user_agent) && !empty($_SERVER['HTTP_USER_AGENT'])) $this->user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
if (empty($this->user_agent)) $this->user_agent = (empty($_SERVER['HTTP_USER_AGENT'])?'':$_SERVER['HTTP_USER_AGENT']);
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->description)) { $this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1; }
|
||||
|
||||
@ -6448,7 +6448,7 @@ class Form
|
||||
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
|
||||
*
|
||||
* @param string $htmlname Name of html select area
|
||||
* @param string $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...)
|
||||
* @param array $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...)
|
||||
* @param string $id Preselected key
|
||||
* @param string $moreparam Add more parameters onto the select tag
|
||||
* @param int $disableFiltering If set to 1, results are not filtered with searched string
|
||||
|
||||
@ -79,9 +79,10 @@ class FormFile
|
||||
* @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be)
|
||||
* @param int $usewithoutform 0=Default, 1=Disable <form> and style to use in existing area
|
||||
* @param int $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept.
|
||||
* @param int $disablemulti 0=Default, 1=Disable multiple file upload
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0)
|
||||
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0, $disablemulti = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $hookmanager;
|
||||
@ -170,7 +171,7 @@ class FormFile
|
||||
|
||||
$out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
|
||||
//$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
|
||||
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD)) ? ' name="userfile"' : ' name="userfile[]" multiple');
|
||||
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
|
||||
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
|
||||
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
|
||||
$out .= (!empty($capture) ? ' capture="capture"' : '');
|
||||
|
||||
@ -619,7 +619,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
|
||||
$specialdayrule = array();
|
||||
|
||||
// Check to ensure we use correct parameters
|
||||
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'ErrorDates must use same hours and must be GMT dates';
|
||||
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'Error Dates must use same hours and must be GMT dates';
|
||||
|
||||
if (empty($country_code)) $country_code = $mysoc->country_code;
|
||||
|
||||
|
||||
@ -6235,9 +6235,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
|
||||
if (!empty($conf->expedition->enabled) && (!is_object($object) || $object->element == 'shipping'))
|
||||
{
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__'] = 'Shipping tacking number';
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__'] = 'Shipping tracking number';
|
||||
$substitutionarray['__SHIPPINGTRACKNUMURL__'] = 'Shipping tracking url';
|
||||
}
|
||||
if (!empty($conf->reception->enabled) && (!is_object($object) || $object->element == 'reception'))
|
||||
{
|
||||
$substitutionarray['__RECEPTIONTRACKNUM__'] = 'Shippin tracking number of shipment';
|
||||
$substitutionarray['__RECEPTIONTRACKNUMURL__'] = 'Shipping tracking url';
|
||||
}
|
||||
} else {
|
||||
$substitutionarray['__ID__'] = $object->id;
|
||||
$substitutionarray['__REF__'] = $object->ref;
|
||||
@ -6359,6 +6364,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number;
|
||||
$substitutionarray['__SHIPPINGTRACKNUMURL__'] = $object->tracking_url;
|
||||
}
|
||||
if (is_object($object) && $object->element == 'reception')
|
||||
{
|
||||
$substitutionarray['__RECEPTIONTRACKNUM__'] = $object->tracking_number;
|
||||
$substitutionarray['__RECEPTIONTRACKNUMURL__'] = $object->tracking_url;
|
||||
}
|
||||
|
||||
if (is_object($object) && $object->element == 'contrat' && $object->id > 0 && is_array($object->lines))
|
||||
{
|
||||
|
||||
@ -944,9 +944,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
|
||||
|
||||
// Define $sqlstring
|
||||
if (function_exists('mb_strrpos'))
|
||||
{
|
||||
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
|
||||
if (function_exists('mb_strrpos')) {
|
||||
$posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 0, 'UTF-8');
|
||||
} else {
|
||||
$posnumstart = strrpos($maskwithnocode, $maskcounter);
|
||||
} // Pos of counter in final string (from 0 to ...)
|
||||
|
||||
@ -1319,11 +1319,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
|
||||
global $daytoparse;
|
||||
$tmparray = dol_getdate($daytoparse, true); // detail of current day
|
||||
$idw = $tmparray['wday'];
|
||||
|
||||
$idw = ($tmparray['wday'] - (empty($conf->global->MAIN_START_WEEK)?0:1));
|
||||
global $numstartworkingday, $numendworkingday;
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
@ -1702,12 +1702,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
global $numstartworkingday, $numendworkingday;
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
$tableCell = '<td class="center hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">';
|
||||
//$tableCell .= 'idw='.$idw.' '.$conf->global->MAIN_START_WEEK.' '.$numstartworkingday.'-'.$numendworkingday;
|
||||
$placeholder = '';
|
||||
if ($alreadyspent)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -84,8 +84,7 @@ function ticket_prepare_head($object)
|
||||
$head[$h][2] = 'tabTicket';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid)) {
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
@ -133,10 +132,8 @@ function ticket_prepare_head($object)
|
||||
$head[$h][2] = 'tabTicketLogs';
|
||||
$h++;
|
||||
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ticket', 'remove');
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -159,13 +156,11 @@ function showDirectPublicLink($object)
|
||||
}
|
||||
|
||||
$out = '';
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
{
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
$out .= '<span class="opacitymedium">'.$langs->trans("PublicInterfaceNotEnabled").'</span>';
|
||||
} else {
|
||||
$out .= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").':<br>';
|
||||
if ($url)
|
||||
{
|
||||
if ($url) {
|
||||
$out .= '<input type="text" id="directpubliclink" class="quatrevingtpercent" value="'.$url.'">';
|
||||
$out .= ajax_autoselect("directpubliclink", 0);
|
||||
} else {
|
||||
@ -208,7 +203,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
{
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers
|
||||
|
||||
print '<body id="mainbody" class="publicnewticketform">';
|
||||
print '<div class="center">';
|
||||
@ -216,8 +211,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
// Define urllogo
|
||||
if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
|
||||
// Print logo
|
||||
if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO))
|
||||
{
|
||||
if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) {
|
||||
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
|
||||
|
||||
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||
@ -231,8 +225,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
}
|
||||
|
||||
// Output html code for logo
|
||||
if ($urllogo || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC))
|
||||
{
|
||||
if ($urllogo || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
|
||||
print '<div class="backgreypublicpayment">';
|
||||
print '<div class="logopublicpayment">';
|
||||
if ($urllogo) {
|
||||
@ -246,7 +239,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
}
|
||||
print '</div>';
|
||||
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
@ -317,13 +310,21 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$sql .= " a.fk_contact,";
|
||||
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= ", sp.lastname, sp.firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", m.lastname, m.firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql .= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql .= ", o.ref";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
$sql .= ", sp.lastname, sp.firstname";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
|
||||
$sql .= ", m.lastname, m.firstname";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
|
||||
$sql .= ", o.ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
|
||||
$sql .= ", o.ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
|
||||
$sql .= ", o.ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
|
||||
$sql .= ", o.ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
|
||||
$sql .= ", o.ref";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
@ -335,60 +336,67 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".$objcon->id;
|
||||
}
|
||||
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
|
||||
$sql .= " ON er.resource_type = 'dolresource'";
|
||||
$sql .= " AND er.element_id = a.id";
|
||||
$sql .= " AND er.resource_id = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", ".MAIN_DB_PREFIX."product as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", ".MAIN_DB_PREFIX."ticket as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql .= ", ".MAIN_DB_PREFIX."contrat as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."ticket as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
|
||||
}
|
||||
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if ($force_filter_contact === false) {
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql .= " AND a.fk_soc = ".$filterobj->id;
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id;
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
|
||||
{
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
|
||||
$sql .= " AND a.fk_soc = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) {
|
||||
$sql .= " AND a.fk_project = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
|
||||
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
|
||||
{
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
|
||||
{
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket')
|
||||
{
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM')
|
||||
{
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat')
|
||||
{
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
|
||||
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
|
||||
if ($filterobj->id) $sql .= " AND a.fk_element = ".$filterobj->id;
|
||||
}
|
||||
}
|
||||
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'";
|
||||
else {
|
||||
if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'";
|
||||
if (!empty($actioncode)) {
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
$sql .= " AND c.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND c.type = 'systemauto'";
|
||||
} else {
|
||||
if ($actioncode == 'AC_OTH') {
|
||||
$sql .= " AND c.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_OTH_AUTO') {
|
||||
$sql .= " AND c.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'";
|
||||
@ -411,11 +419,17 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$sql2 .= ", null as fk_element, '' as elementtype, null as contact_id";
|
||||
$sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
|
||||
$sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
$sql2 .= ", '' as lastname, '' as firstname";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
|
||||
$sql2 .= ", '' as lastname, '' as firstname";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
|
||||
$sql2 .= ", '' as ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
|
||||
$sql2 .= ", '' as ref";
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
|
||||
$sql2 .= ", '' as ref";
|
||||
}
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
|
||||
$sql2 .= " AND mc.statut = 1";
|
||||
@ -434,13 +448,11 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if ($obj->type == 'action') {
|
||||
@ -512,8 +524,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email)))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {
|
||||
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
@ -533,8 +544,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
if ($objcon && get_class($objcon) == 'Contact' &&
|
||||
(is_null($filterobj) || get_class($filterobj) == 'Societe'))
|
||||
{
|
||||
(is_null($filterobj) || get_class($filterobj) == 'Societe')) {
|
||||
$out .= '<input type="hidden" name="id" value="'.$objcon->id.'" />';
|
||||
} else {
|
||||
$out .= '<input type="hidden" name="id" value="'.$filterobj->id.'" />';
|
||||
@ -553,8 +563,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
//$out.='</td>';
|
||||
|
||||
$out .= '<th class="liste_titre"><strong>'.$langs->trans("Search").' : </strong></th>';
|
||||
if ($donetodo)
|
||||
{
|
||||
if ($donetodo) {
|
||||
$out .= '<th class="liste_titre"></th>';
|
||||
}
|
||||
$out .= '<th class="liste_titre">'.$langs->trans("Type").' ';
|
||||
@ -581,8 +590,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
|
||||
$out .= '<ul class="timeline">';
|
||||
|
||||
if ($donetodo)
|
||||
{
|
||||
if ($donetodo) {
|
||||
$tmp = '';
|
||||
if (get_class($filterobj) == 'Societe') $tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&socid='.$filterobj->id.'&status=done">';
|
||||
$tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
|
||||
@ -625,53 +633,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$out .= '<!-- timeline item -->'."\n";
|
||||
$out .= '<li class="timeline-code-'.strtolower($actionstatic->code).'">';
|
||||
|
||||
|
||||
$out .= '<!-- timeline icon -->'."\n";
|
||||
$iconClass = 'fa fa-comments';
|
||||
$img_picto = '';
|
||||
$colorClass = '';
|
||||
$pictoTitle = '';
|
||||
|
||||
if ($histo[$key]['percent'] == -1) {
|
||||
$colorClass = 'timeline-icon-not-applicble';
|
||||
$pictoTitle = $langs->trans('StatusNotApplicable');
|
||||
} elseif ($histo[$key]['percent'] == 0) {
|
||||
$colorClass = 'timeline-icon-todo';
|
||||
$pictoTitle = $langs->trans('StatusActionToDo').' (0%)';
|
||||
} elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) {
|
||||
$colorClass = 'timeline-icon-in-progress';
|
||||
$pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)';
|
||||
} elseif ($histo[$key]['percent'] >= 100) {
|
||||
$colorClass = 'timeline-icon-done';
|
||||
$pictoTitle = $langs->trans('StatusActionDone').' (100%)';
|
||||
}
|
||||
|
||||
|
||||
if ($actionstatic->code == 'AC_TICKET_CREATE') {
|
||||
$iconClass = 'fa fa-ticket';
|
||||
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
|
||||
$iconClass = 'fa fa-pencil';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG') {
|
||||
$iconClass = 'fa fa-comments';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
|
||||
$iconClass = 'fa fa-mask';
|
||||
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actionstatic->type_picto) $img_picto = img_picto('', $actionstatic->type_picto);
|
||||
else {
|
||||
if ($actionstatic->type_code == 'AC_RDV') $iconClass = 'fa fa-handshake';
|
||||
elseif ($actionstatic->type_code == 'AC_TEL') $iconClass = 'fa fa-phone';
|
||||
elseif ($actionstatic->type_code == 'AC_FAX') $iconClass = 'fa fa-fax';
|
||||
elseif ($actionstatic->type_code == 'AC_EMAIL') $iconClass = 'fa fa-envelope';
|
||||
elseif ($actionstatic->type_code == 'AC_INT') $iconClass = 'fa fa-shipping-fast';
|
||||
elseif ($actionstatic->type_code == 'AC_OTH_AUTO') $iconClass = 'fa fa-robot';
|
||||
elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) $iconClass = 'fa fa-robot';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$out .= '<i class="'.$iconClass.' '.$colorClass.'" title="'.$pictoTitle.'">'.$img_picto.'</i>'."\n";
|
||||
$out .= getTicketTimelineIcon($actionstatic, $histo, $key);
|
||||
|
||||
$out .= '<div class="timeline-item">'."\n";
|
||||
|
||||
@ -690,24 +652,24 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
|
||||
//}
|
||||
|
||||
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->rights->agenda->myactions->create))
|
||||
{
|
||||
$out .= '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/card.php?action=edit&id='.$actionstatic->id.'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>';
|
||||
}
|
||||
|
||||
|
||||
$out .= '</span>';
|
||||
// Date
|
||||
$out .= '<span class="time"><i class="fa fa-clock-o"></i> ';
|
||||
$out .= dol_print_date($histo[$key]['datestart'], 'dayhour');
|
||||
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart'])
|
||||
{
|
||||
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
|
||||
$tmpa = dol_getdate($histo[$key]['datestart'], true);
|
||||
$tmpb = dol_getdate($histo[$key]['dateend'], true);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour');
|
||||
else $out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour');
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
|
||||
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour');
|
||||
} else {
|
||||
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour');
|
||||
}
|
||||
}
|
||||
$late = 0;
|
||||
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late = 1;
|
||||
@ -755,7 +717,6 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$out .= '</span>';
|
||||
|
||||
$out .= '</h3>';
|
||||
@ -770,7 +731,6 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
// Timeline footer
|
||||
$footer = '';
|
||||
|
||||
@ -781,8 +741,9 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$contact = new Contact($db);
|
||||
$result = $contact->fetch($cid);
|
||||
|
||||
if ($result < 0)
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $contact->error);
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$contactList .= !empty($contactList) ? ', ' : '';
|
||||
@ -795,8 +756,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
}
|
||||
|
||||
$footer .= $langs->trans('ActionOnContact').' : '.$contactList;
|
||||
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0)
|
||||
{
|
||||
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
|
||||
$contact = new Contact($db);
|
||||
$result = $contact->fetch($histo[$key]['contact_id']);
|
||||
|
||||
@ -846,17 +806,10 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$footer .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!empty($footer)) {
|
||||
$out .= '<div class="timeline-footer">'.$footer.'</div>';
|
||||
}
|
||||
|
||||
|
||||
$out .= '</div>'."\n"; // end timeline-item
|
||||
|
||||
$out .= '</li>';
|
||||
@ -867,11 +820,73 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
|
||||
$out .= "</ul>\n";
|
||||
}
|
||||
|
||||
|
||||
if ($noprint) return $out;
|
||||
else print $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get timeline icon
|
||||
* @param ActionComm $actionstatic actioncomm
|
||||
* @param array $histo histo
|
||||
* @param int $key key
|
||||
* @return string
|
||||
*/
|
||||
function getTicketTimelineIcon($actionstatic, &$histo, $key)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$out = '<!-- timeline icon -->'."\n";
|
||||
$iconClass = 'fa fa-comments';
|
||||
$img_picto = '';
|
||||
$colorClass = '';
|
||||
$pictoTitle = '';
|
||||
|
||||
if ($histo[$key]['percent'] == -1) {
|
||||
$colorClass = 'timeline-icon-not-applicble';
|
||||
$pictoTitle = $langs->trans('StatusNotApplicable');
|
||||
} elseif ($histo[$key]['percent'] == 0) {
|
||||
$colorClass = 'timeline-icon-todo';
|
||||
$pictoTitle = $langs->trans('StatusActionToDo').' (0%)';
|
||||
} elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) {
|
||||
$colorClass = 'timeline-icon-in-progress';
|
||||
$pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)';
|
||||
} elseif ($histo[$key]['percent'] >= 100) {
|
||||
$colorClass = 'timeline-icon-done';
|
||||
$pictoTitle = $langs->trans('StatusActionDone').' (100%)';
|
||||
}
|
||||
|
||||
if ($actionstatic->code == 'AC_TICKET_CREATE') {
|
||||
$iconClass = 'fa fa-ticket';
|
||||
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
|
||||
$iconClass = 'fa fa-pencil';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG') {
|
||||
$iconClass = 'fa fa-comments';
|
||||
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
|
||||
$iconClass = 'fa fa-mask';
|
||||
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
if ($actionstatic->type_picto) {
|
||||
$img_picto = img_picto('', $actionstatic->type_picto);
|
||||
} else {
|
||||
if ($actionstatic->type_code == 'AC_RDV') {
|
||||
$iconClass = 'fa fa-handshake';
|
||||
} elseif ($actionstatic->type_code == 'AC_TEL') {
|
||||
$iconClass = 'fa fa-phone';
|
||||
} elseif ($actionstatic->type_code == 'AC_FAX') {
|
||||
$iconClass = 'fa fa-fax';
|
||||
} elseif ($actionstatic->type_code == 'AC_EMAIL') {
|
||||
$iconClass = 'fa fa-envelope';
|
||||
} elseif ($actionstatic->type_code == 'AC_INT') {
|
||||
$iconClass = 'fa fa-shipping-fast';
|
||||
} elseif ($actionstatic->type_code == 'AC_OTH_AUTO') {
|
||||
$iconClass = 'fa fa-robot';
|
||||
} elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) {
|
||||
$iconClass = 'fa fa-robot';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$out .= '<i class="'.$iconClass.' '.$colorClass.'" title="'.$pictoTitle.'">'.$img_picto.'</i>'."\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTicketActionCommEcmList
|
||||
|
||||
@ -81,7 +81,7 @@ class modApi extends DolibarrModules
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->requiredby = array('modZapier'); // List of modules id to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
||||
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("other");
|
||||
|
||||
@ -628,7 +628,7 @@ class modProduct extends DolibarrModules
|
||||
$this->import_label[$r] = "SuppliersPricesOfProductsOrServices"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price');
|
||||
$this->import_tables_array[$r] = array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price', 'extra'=>MAIN_DB_PREFIX.'product_fournisseur_price_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('sp'=>'fk_user');
|
||||
$this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields
|
||||
'sp.fk_product'=>"ProductOrService*",
|
||||
@ -664,6 +664,23 @@ class modProduct extends DolibarrModules
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.packaging' => 'PackagingForThisProduct'));
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product_fournisseur_price'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'sp.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'),
|
||||
'sp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
|
||||
|
||||
@ -49,7 +49,7 @@ class modZapier extends DolibarrModules
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "interface";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '22';
|
||||
$this->module_position = '26';
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module label (no space allowed), used if translation string 'ModuleZapierName' not found (Zapier is name of module).
|
||||
@ -116,7 +116,7 @@ class modZapier extends DolibarrModules
|
||||
// A condition to hide module
|
||||
$this->hidden = false;
|
||||
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->depends = array();
|
||||
$this->depends = array('modApi');
|
||||
// List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->requiredby = array();
|
||||
// List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
|
||||
@ -75,7 +75,7 @@ if ($action == 'presend')
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions'));
|
||||
$outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions', 'receptions'));
|
||||
}
|
||||
|
||||
$topicmail = '';
|
||||
|
||||
@ -174,7 +174,7 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$event->dateevent = $date;
|
||||
$event->label = $text;
|
||||
$event->description = $desc;
|
||||
$event->user_agent = $_SERVER["HTTP_USER_AGENT"];
|
||||
$event->user_agent = (empty($_SERVER["HTTP_USER_AGENT"])?'':$_SERVER["HTTP_USER_AGENT"]);
|
||||
|
||||
$result = $event->create($user);
|
||||
if ($result > 0) {
|
||||
|
||||
@ -554,9 +554,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$member = $this->context['member'];
|
||||
if (!is_object($member)) { // This should not happen
|
||||
dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object");
|
||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member = new Adherent($this->db);
|
||||
$member->fetch($this->fk_adherent);
|
||||
$member->fetch($object->fk_adherent);
|
||||
}
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
|
||||
@ -733,6 +734,29 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
// If trackid is not defined, we set it
|
||||
if (empty($object->trackid)) {
|
||||
// See also similar list into emailcollector.class.php
|
||||
if (preg_match('/^COMPANY_/', $action)) { $object->trackid = 'thi'.$object->id; }
|
||||
elseif (preg_match('/^CONTACT_/', $action)) { $object->trackid = 'ctc'.$object->id; }
|
||||
elseif (preg_match('/^CONTRACT_/', $action)) { $object->trackid = 'con'.$object->id; }
|
||||
elseif (preg_match('/^PROPAL_/', $action)) { $object->trackid = 'pro'.$object->id; }
|
||||
elseif (preg_match('/^ORDER_/', $action)) { $object->trackid = 'ord'.$object->id; }
|
||||
elseif (preg_match('/^BILL_/', $action)) { $object->trackid = 'inv'.$object->id; }
|
||||
elseif (preg_match('/^FICHINTER_/', $action)) { $object->trackid = 'int'.$object->id; }
|
||||
elseif (preg_match('/^SHIPPING_/', $action)) { $object->trackid = 'shi'.$object->id; }
|
||||
elseif (preg_match('/^RECEPTION_/', $action)) { $object->trackid = 'rec'.$object->id; }
|
||||
elseif (preg_match('/^PROPOSAL_SUPPLIER/', $action)) { $object->trackid = 'spr'.$object->id; }
|
||||
elseif (preg_match('/^ORDER_SUPPLIER_/', $action)) { $object->trackid = 'sor'.$object->id; }
|
||||
elseif (preg_match('/^BILL_SUPPLIER_/', $action)) { $object->trackid = 'sin'.$object->id; }
|
||||
elseif (preg_match('/^MEMBER_SUBSCRIPTION_/', $action)) { $object->trackid = 'sub'.$object->id; }
|
||||
elseif (preg_match('/^MEMBER_/', $action)) { $object->trackid = 'mem'.$object->id; }
|
||||
elseif (preg_match('/^PROJECT_/', $action)) { $object->trackid = 'proj'.$object->id; }
|
||||
elseif (preg_match('/^TASK_/', $action)) { $object->trackid = 'tas'.$object->id; }
|
||||
elseif (preg_match('/^TICKET_/', $action)) { $object->trackid = 'tic'.$object->id; }
|
||||
else $object->trackid = '';
|
||||
}
|
||||
|
||||
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg);
|
||||
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
@ -766,7 +790,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$elementid = $object->id; // id of object
|
||||
$elementtype = $object->element;
|
||||
$elementmodule = $object->module;
|
||||
$elementmodule = (empty($object->module) ? '' : $object->module);
|
||||
if ($object->element == 'subscription') {
|
||||
$elementid = $object->fk_adherent;
|
||||
$elementtype = 'member';
|
||||
@ -790,14 +814,14 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
|
||||
$actioncomm->email_msgid = $object->email_msgid;
|
||||
$actioncomm->email_from = $object->email_from;
|
||||
$actioncomm->email_sender = $object->email_sender;
|
||||
$actioncomm->email_to = $object->email_to;
|
||||
$actioncomm->email_tocc = $object->email_tocc;
|
||||
$actioncomm->email_tobcc = $object->email_tobcc;
|
||||
$actioncomm->email_subject = $object->email_subject;
|
||||
$actioncomm->errors_to = $object->errors_to;
|
||||
$actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
|
||||
$actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
|
||||
$actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
|
||||
$actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
|
||||
$actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
|
||||
$actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
|
||||
$actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
|
||||
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
|
||||
|
||||
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
|
||||
// for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.
|
||||
@ -820,7 +844,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$ret = $actioncomm->create($user); // User creating action
|
||||
|
||||
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO) {
|
||||
if ($ret > 0 && !empty($conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)) {
|
||||
if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
|
||||
foreach ($object->attachedfiles['paths'] as $key=>$filespath) {
|
||||
$srcfile = $filespath;
|
||||
|
||||
@ -85,8 +85,28 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
|
||||
switch ($action) {
|
||||
// Users
|
||||
//case 'USER_CREATE':
|
||||
//case 'USER_MODIFY':
|
||||
case 'USER_CREATE':
|
||||
$resql = $this->db->query($sql);
|
||||
// TODO voir comment regrouper les webhooks en un post
|
||||
while ($resql && $obj = $this->db->fetch_array($resql)) {
|
||||
$cleaned = cleanObjectDatas(dol_clone($object));
|
||||
$json = json_encode($cleaned);
|
||||
// call the zapierPostWebhook() function
|
||||
zapierPostWebhook($obj['url'], $json);
|
||||
}
|
||||
$logtriggeraction = true;
|
||||
break;
|
||||
case 'USER_MODIFY':
|
||||
$resql = $this->db->query($sql);
|
||||
// TODO voir comment regrouper les webhooks en un post
|
||||
while ($resql && $obj = $this->db->fetch_array($resql)) {
|
||||
$cleaned = cleanObjectDatas(dol_clone($object));
|
||||
$json = json_encode($cleaned);
|
||||
// call the zapierPostWebhook() function
|
||||
zapierPostWebhook($obj['url'], $json);
|
||||
}
|
||||
$logtriggeraction = true;
|
||||
break;
|
||||
//case 'USER_NEW_PASSWORD':
|
||||
//case 'USER_ENABLEDISABLE':
|
||||
//case 'USER_DELETE':
|
||||
@ -124,6 +144,12 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
//case 'USERGROUP_MODIFY':
|
||||
//case 'USERGROUP_DELETE':
|
||||
|
||||
// Categories
|
||||
// case 'CATEGORY_CREATE':
|
||||
// case 'CATEGORY_MODIFY':
|
||||
// case 'CATEGORY_DELETE':
|
||||
// case 'CATEGORY_SET_MULTILANGS':
|
||||
|
||||
// Companies
|
||||
case 'COMPANY_CREATE':
|
||||
$resql = $this->db->query($sql);
|
||||
@ -305,12 +331,6 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
// case 'MEMBER_RESILIATE':
|
||||
// case 'MEMBER_DELETE':
|
||||
|
||||
// Categories
|
||||
// case 'CATEGORY_CREATE':
|
||||
// case 'CATEGORY_MODIFY':
|
||||
// case 'CATEGORY_DELETE':
|
||||
// case 'CATEGORY_SET_MULTILANGS':
|
||||
|
||||
// Projects
|
||||
// case 'PROJECT_CREATE':
|
||||
// case 'PROJECT_MODIFY':
|
||||
@ -325,6 +345,21 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
||||
// case 'TASK_TIMESPENT_CREATE':
|
||||
// case 'TASK_TIMESPENT_MODIFY':
|
||||
// case 'TASK_TIMESPENT_DELETE':
|
||||
case 'TICKET_CREATE':
|
||||
$resql = $this->db->query($sql);
|
||||
// TODO voir comment regrouper les webhooks en un post
|
||||
while ($resql && $obj = $this->db->fetch_array($resql)) {
|
||||
$cleaned = cleanObjectDatas(dol_clone($object));
|
||||
$json = json_encode($cleaned);
|
||||
// call the zapierPostWebhook() function
|
||||
zapierPostWebhook($obj['url'], $json);
|
||||
}
|
||||
$logtriggeraction = true;
|
||||
break;
|
||||
// case 'TICKET_MODIFY':
|
||||
// break;
|
||||
// case 'TICKET_DELETE':
|
||||
// break;
|
||||
|
||||
// Shipping
|
||||
// case 'SHIPPING_CREATE':
|
||||
@ -439,13 +474,13 @@ function cleanObjectDatas($toclean)
|
||||
|
||||
// If object has linked objects, remove $db property
|
||||
/*
|
||||
if(isset($toclean->linkedObjects) && count($toclean->linkedObjects) > 0) {
|
||||
foreach($toclean->linkedObjects as $type_object => $linked_object) {
|
||||
foreach($linked_object as $toclean2clean) {
|
||||
$this->cleanObjectDatas($toclean2clean);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if(isset($toclean->linkedObjects) && count($toclean->linkedObjects) > 0) {
|
||||
foreach($toclean->linkedObjects as $type_object => $linked_object) {
|
||||
foreach($linked_object as $toclean2clean) {
|
||||
$this->cleanObjectDatas($toclean2clean);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return $toclean;
|
||||
}
|
||||
@ -453,7 +488,7 @@ function cleanObjectDatas($toclean)
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $toclean Object to clean
|
||||
* @param Object $toclean Object to clean
|
||||
* @return Object Object with cleaned properties
|
||||
*/
|
||||
function cleanAgendaEventsDatas($toclean)
|
||||
|
||||
@ -152,8 +152,8 @@ class Don extends CommonObject
|
||||
/**
|
||||
* Returns the donation status label (draft, valid, abandoned, paid)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @return string Libelle
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
@ -164,9 +164,9 @@ class Don extends CommonObject
|
||||
/**
|
||||
* Return the label of a given status
|
||||
*
|
||||
* @param int $status Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Libelle du statut
|
||||
* @param int $status Id statut
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
@ -922,7 +922,10 @@ class Don extends CommonObject
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Donation").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Donation").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
if (!empty($this->id)) {
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
|
||||
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
|
||||
|
||||
@ -1342,6 +1342,15 @@ class EmailCollector extends CommonObject
|
||||
$trackid = $reg[1].$reg[2];
|
||||
|
||||
$objectid = $reg[2];
|
||||
// See also list into interface_50_modAgenda_ActionsAuto
|
||||
if ($reg[1] == 'thi')
|
||||
{
|
||||
$objectemail = new Societe($this->db);
|
||||
}
|
||||
if ($reg[1] == 'ctc')
|
||||
{
|
||||
$objectemail = new Contact($this->db);
|
||||
}
|
||||
if ($reg[1] == 'inv')
|
||||
{
|
||||
$objectemail = new Facture($this->db);
|
||||
@ -1350,14 +1359,14 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
$objectemail = new Project($this->db);
|
||||
}
|
||||
if ($reg[1] == 'tas')
|
||||
{
|
||||
$objectemail = new Task($this->db);
|
||||
}
|
||||
if ($reg[1] == 'con')
|
||||
{
|
||||
$objectemail = new Contact($this->db);
|
||||
}
|
||||
if ($reg[1] == 'thi')
|
||||
{
|
||||
$objectemail = new Societe($this->db);
|
||||
}
|
||||
if ($reg[1] == 'use')
|
||||
{
|
||||
$objectemail = new User($this->db);
|
||||
@ -1370,6 +1379,10 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
$objectemail = new RecruitmentCandidature($this->db);
|
||||
}
|
||||
if ($reg[1] == 'mem')
|
||||
{
|
||||
$objectemail = new Adherent($this->db);
|
||||
}
|
||||
} elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) {
|
||||
// This is an external reference, we check if we have it in our database
|
||||
if (!is_object($objectemail)) {
|
||||
|
||||
@ -2495,7 +2495,7 @@ class Expedition extends CommonObject
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'rouget';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->EXPEDITION_ADDON_PDF)) {
|
||||
$modele = $conf->global->EXPEDITION_ADDON_PDF;
|
||||
|
||||
@ -2207,7 +2207,7 @@ class ExpenseReport extends CommonObject
|
||||
$langs->load("trips");
|
||||
|
||||
if (!dol_strlen($modele)) {
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->EXPENSEREPORT_ADDON_PDF)) {
|
||||
$modele = $conf->global->EXPENSEREPORT_ADDON_PDF;
|
||||
|
||||
@ -689,7 +689,7 @@ class Fichinter extends CommonObject
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'soleil';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->FICHEINTER_ADDON_PDF)) {
|
||||
$modele = $conf->global->FICHEINTER_ADDON_PDF;
|
||||
|
||||
@ -281,7 +281,7 @@ class FichinterRec extends Fichinter
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->user_author = $obj->fk_user_author;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
$this->rang = $obj->rang;
|
||||
$this->special_code = $obj->special_code;
|
||||
$this->frequency = $obj->frequency;
|
||||
|
||||
@ -123,7 +123,6 @@ class FactureFournisseur extends CommonInvoice
|
||||
/**
|
||||
* Set to 1 if the invoice is completely paid, otherwise is 0
|
||||
* @var int
|
||||
* @deprecated Use statuses stored in self::statut
|
||||
*/
|
||||
public $paye;
|
||||
|
||||
|
||||
@ -1084,7 +1084,7 @@ if (empty($reshook))
|
||||
// Actions to send emails
|
||||
$triggersendname = 'ORDER_SUPPLIER_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO';
|
||||
$trackid = 'sor'.$object->id;
|
||||
$trackid = 'sord'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
@ -2875,7 +2875,7 @@ if ($action == 'create')
|
||||
$defaulttopic = 'SendOrderRef';
|
||||
$diroutput = $conf->fournisseur->commande->dir_output;
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO';
|
||||
$trackid = 'sor'.$object->id;
|
||||
$trackid = 'sord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
@ -1548,7 +1548,7 @@ if (empty($reshook))
|
||||
$triggersendname = 'BILL_SUPPLIER_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
|
||||
$trackid = 'sin'.$object->id;
|
||||
$trackid = 'sinv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
@ -3308,7 +3308,7 @@ if ($action == 'create')
|
||||
$defaulttopic = 'SendBillRef';
|
||||
$diroutput = $conf->fournisseur->facture->dir_output;
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
|
||||
$trackid = 'sin'.$object->id;
|
||||
$trackid = 'sinv'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
@ -109,6 +109,7 @@ $year_lim = GETPOST('year_lim', 'int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$search_btn = GETPOST('button_search', 'alpha');
|
||||
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
||||
$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') {
|
||||
@ -260,6 +261,7 @@ if (empty($reshook))
|
||||
$filter = '';
|
||||
$option = '';
|
||||
$socid = "";
|
||||
$search_categ_sup = 0;
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -304,6 +306,7 @@ $sql .= " u.login";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (!$search_all) $sql .= ', SUM(pf.amount) as dynamount_payed';
|
||||
if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
@ -316,6 +319,8 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
|
||||
|
||||
$sql .= ', '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
|
||||
if (!$search_all) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
|
||||
@ -376,6 +381,8 @@ $sql .= dolSqlDateFilter("f.datef", $day, $month, $year);
|
||||
$sql .= dolSqlDateFilter("f.date_lim_reglement", $day_lim, $month_lim, $year_lim);
|
||||
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
|
||||
if ($search_label) $sql .= natural_search('f.libelle', $search_label);
|
||||
if ($search_categ_sup > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup);
|
||||
if ($search_categ_sup == -2) $sql .= " AND cs.fk_categorie IS NULL";
|
||||
if ($search_status != '' && $search_status >= 0)
|
||||
{
|
||||
$sql .= " AND f.fk_statut = ".$search_status;
|
||||
@ -497,6 +504,8 @@ if ($resql)
|
||||
if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
||||
if ($option) $param .= "&option=".urlencode($option);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($search_categ_sup > 0) $param .= '&search_categ_sup='.urlencode($search_categ_sup);
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -608,6 +617,15 @@ if ($resql)
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('SuppliersCategoriesShort').': ';
|
||||
$moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
|
||||
@ -55,8 +55,8 @@ $now = dol_now();
|
||||
|
||||
$childids = $user->getAllChildIds(1);
|
||||
|
||||
$morefilter = 'AND employee = 1';
|
||||
if (!empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
$morefilter = '';
|
||||
if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) $morefilter = 'AND employee = 1';
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
@ -1102,7 +1102,7 @@ class Holiday extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Check that a user is not on holiday for a particular timestamp
|
||||
* Check that a user is not on holiday for a particular timestamp. Can check approved leave requests and not into public holidays of company.
|
||||
*
|
||||
* @param int $fk_user Id user
|
||||
* @param integer $timestamp Time stamp date for a day (YYYY-MM-DD) without hours (= 12:00AM in english and not 12:00PM that is 12:00)
|
||||
@ -1117,6 +1117,7 @@ class Holiday extends CommonObject
|
||||
$isavailablemorning = true;
|
||||
$isavailableafternoon = true;
|
||||
|
||||
// Check into leave requests
|
||||
$sql = "SELECT cp.rowid, cp.date_debut as date_start, cp.date_fin as date_end, cp.halfday, cp.statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as cp";
|
||||
$sql .= " WHERE cp.entity IN (".getEntity('holiday').")";
|
||||
@ -1161,7 +1162,10 @@ class Holiday extends CommonObject
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
|
||||
return array('morning'=>$isavailablemorning, 'afternoon'=>$isavailableafternoon);
|
||||
$result = array('morning'=>$isavailablemorning, 'afternoon'=>$isavailableafternoon);
|
||||
if (!$isavailablemorning) $result['morning_reason'] = 'leave_request';
|
||||
if (!$isavailableafternoon) $result['afternoon_reason'] = 'leave_request';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -487,8 +487,8 @@ if ($resql)
|
||||
|
||||
if (!empty($arrayfields['cp.fk_user']['checked']))
|
||||
{
|
||||
$morefilter = 'AND employee = 1';
|
||||
if (!empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
$morefilter = '';
|
||||
if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) $morefilter = 'AND employee = 1';
|
||||
|
||||
// User
|
||||
$disabled = 0;
|
||||
|
||||
@ -294,6 +294,7 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
$expensereportstatic->id = $obj->rowid;
|
||||
$expensereportstatic->ref = $obj->ref;
|
||||
$expensereportstatic->statut = $obj->status;
|
||||
$expensereportstatic->status = $obj->status;
|
||||
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
|
||||
@ -30,7 +30,7 @@ CREATE TABLE llx_ecm_directories
|
||||
fullpath varchar(750),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
date_c datetime,
|
||||
date_m timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_user_c integer,
|
||||
fk_user_m integer,
|
||||
acl text
|
||||
|
||||
@ -35,7 +35,7 @@ CREATE TABLE llx_ecm_files
|
||||
gen_or_uploaded varchar(12), -- 'generated' or 'uploaded'
|
||||
extraparams varchar(255), -- for stocking other parameters with json format
|
||||
date_c datetime,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_user_c integer,
|
||||
fk_user_m integer,
|
||||
acl text -- for future permission 'per file'
|
||||
|
||||
@ -29,7 +29,7 @@ create table llx_reception
|
||||
fk_projet integer DEFAULT NULL,
|
||||
|
||||
ref_ext varchar(30), -- reference into an external system (not used by dolibarr)
|
||||
ref_int varchar(30), -- reference into an internal system (used by dolibarr to store extern id like paypal info)
|
||||
ref_int varchar(30), -- reference into an internal system (deprecated)
|
||||
ref_supplier varchar(30), -- customer number
|
||||
|
||||
date_creation datetime, -- date de creation
|
||||
|
||||
@ -71,3 +71,5 @@ YourCandidature=Your application
|
||||
YourCandidatureAnswerMessage=Thanks you for your application.<br>...
|
||||
JobClosedTextCandidateFound=The job position is closed. The position has been filled.
|
||||
JobClosedTextCanceled=The job position is closed.
|
||||
ExtrafieldsJobPosition=Complementary attributes (job positions)
|
||||
ExtrafieldsCandidatures=Complementary attributes (job applications)
|
||||
|
||||
@ -1092,14 +1092,15 @@ if (!function_exists("llxHeader"))
|
||||
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
|
||||
* @param string $morecssonbody More CSS on body tag.
|
||||
* @param string $replacemainareaby Replace call to main_area() by a print of this string
|
||||
* @param int $disablenofollow Disable the "nofollow" on page
|
||||
* @return void
|
||||
*/
|
||||
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '')
|
||||
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// html header
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow);
|
||||
|
||||
$tmpcsstouse = 'sidebar-collapse'.($morecssonbody ? ' '.$morecssonbody : '');
|
||||
// If theme MD and classic layer, we open the menulayer by default.
|
||||
@ -1557,7 +1558,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
|
||||
// For backward compatibility with old modules
|
||||
if (empty($conf->headerdone))
|
||||
{
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
$disablenofollow = 0;
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow);
|
||||
print '<body id="mainbody">';
|
||||
}
|
||||
|
||||
|
||||
@ -308,11 +308,12 @@ class MyObject extends CommonObject
|
||||
unset($object->fk_user_creat);
|
||||
unset($object->import_key);
|
||||
|
||||
|
||||
// Clear fields
|
||||
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
|
||||
if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
|
||||
if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
|
||||
if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
|
||||
if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
|
||||
@ -987,12 +987,12 @@ class Mo extends CommonObject
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("ManufacturingOrder").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ManufacturingOrder").'</u>';
|
||||
if (isset($this->status)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (isset($this->status)) {
|
||||
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id;
|
||||
if ($option == 'production') $url = dol_buildpath('/mrp/mo_production.php', 1).'?id='.$this->id;
|
||||
|
||||
@ -37,10 +37,10 @@ $langs->loadLangs(array("mrp", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
|
||||
@ -345,7 +345,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "SendMoRef";
|
||||
$modelmail = "mo";
|
||||
$objecttmp = new Mo($db);
|
||||
$trackid = 'xxxx'.$object->id;
|
||||
$trackid = 'mo'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
|
||||
@ -628,46 +628,48 @@ class MultiCurrency extends CommonObject
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
$urlendpoint = 'http://apilayer.net/api/live?access_key='.$key;
|
||||
//$urlendpoint.='&format=1';
|
||||
$urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE);
|
||||
|
||||
dol_syslog("Call url endpoint ".$urlendpoint);
|
||||
|
||||
// FIXME Use getURLContent() function instead.
|
||||
$ch = curl_init($urlendpoint);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$response = json_decode($response);
|
||||
$resget = getURLContent($urlendpoint, 'GET', '', 1, array(), array('http', 'https'), 1);
|
||||
|
||||
if ($response->success)
|
||||
{
|
||||
$TRate = $response->quotes;
|
||||
$timestamp = $response->timestamp;
|
||||
if ($resget['content']) {
|
||||
$response = $resget['content'];
|
||||
$response = json_decode($response);
|
||||
|
||||
if (self::recalculRates($TRate) >= 0)
|
||||
if ($response->success)
|
||||
{
|
||||
foreach ($TRate as $currency_code => $rate)
|
||||
$TRate = $response->quotes;
|
||||
$timestamp = $response->timestamp;
|
||||
|
||||
if (self::recalculRates($TRate) >= 0)
|
||||
{
|
||||
$code = substr($currency_code, 3, 3);
|
||||
$obj = new MultiCurrency($db);
|
||||
if ($obj->fetch(null, $code) > 0)
|
||||
foreach ($TRate as $currency_code => $rate)
|
||||
{
|
||||
$obj->updateRate($rate);
|
||||
} elseif ($addifnotfound)
|
||||
{
|
||||
self::addRateFromDolibarr($code, $rate);
|
||||
$code = substr($currency_code, 3, 3);
|
||||
$obj = new MultiCurrency($db);
|
||||
if ($obj->fetch(null, $code) > 0)
|
||||
{
|
||||
$obj->updateRate($rate);
|
||||
} elseif ($addifnotfound)
|
||||
{
|
||||
self::addRateFromDolibarr($code, $rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING);
|
||||
setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING);
|
||||
setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors');
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = "cr.date_sync";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||
@ -233,7 +233,7 @@ print dol_get_fiche_head($head, 'ratelist', $langs->trans("ModuleSetup"), -1, "m
|
||||
|
||||
// ACTION
|
||||
|
||||
if ($action != "updateRate" && $action != "deleteRate") {
|
||||
if ($action != "updateRate") {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("FormCreateRate").'</td>'."\n";
|
||||
@ -252,7 +252,7 @@ if ($action != "updateRate" && $action != "deleteRate") {
|
||||
print '<td>'.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 0, " code != '".$conf->currency."'", true).'</td>';
|
||||
|
||||
print ' <td>'.$langs->trans('Rate').'</td>';
|
||||
print ' <td><input type="number" min ="0" step="any" class="minwidth200" name="rateinput" value="'.dol_escape_htmltag($rateinput).'"></td>';
|
||||
print ' <td><input type="number" min="0" step="any" class="maxwidth75" name="rateinput" value="'.dol_escape_htmltag($rateinput).'"></td>';
|
||||
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
@ -521,9 +521,9 @@ if ($resql)
|
||||
{
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=updateRate&id_rate='.$obj->rowid.'" class="like-link " style="margin-right:15px;important">'.img_picto('edit', 'edit').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deleteRate&id_rate='.$obj->rowid.'" class="like-link" style="margin-right:45px;important">'.img_picto('delete', 'delete').'</a>';
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=updateRate&id_rate='.$obj->rowid.'">'.img_picto('edit', 'edit').'</a>';
|
||||
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=deleteRate&id_rate='.$obj->rowid.'">'.img_picto('delete', 'delete').'</a>';
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
@ -77,11 +77,10 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
|
||||
//$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
|
||||
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers
|
||||
|
||||
print '<body id="mainbody" class="publicnewmemberform">';
|
||||
|
||||
|
||||
|
||||
print '<span id="dolpaymentspan"></span>'."\n";
|
||||
print '<div class="center">'."\n";
|
||||
print '<form name="formulaire" action="studs.php?sondage='.urlencode($numsondage).'#bas" method="POST">'."\n";
|
||||
@ -116,7 +115,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
print '>';
|
||||
print '</div>';
|
||||
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ class FormProduct
|
||||
/**
|
||||
* Return list of warehouses
|
||||
*
|
||||
* @param string|int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value)
|
||||
* @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone'=select value if one value otherwise no value, '-2' to use the default value from setup)
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
@ -250,10 +250,10 @@ class FormProduct
|
||||
|
||||
if (strpos($htmlname, 'search_') !== 0) {
|
||||
if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) {
|
||||
if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE;
|
||||
if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE;
|
||||
}
|
||||
else {
|
||||
if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $selected = $user->fk_warehouse;
|
||||
if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $selected = $user->fk_warehouse;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -300,9 +300,9 @@ if (empty($reshook))
|
||||
$multicurrency_price = price2num(GETPOST("multicurrency_price", 'alpha'));
|
||||
$multicurrency_code = GETPOST("multicurrency_code", 'alpha');
|
||||
|
||||
$ret = $object->update_buyprice($quantity, $newprice, $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', $multicurrency_price, $_POST["multicurrency_price_base_type"], $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type);
|
||||
$ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', $multicurrency_price, GETPOST("multicurrency_price_base_type"), $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type);
|
||||
} else {
|
||||
$ret = $object->update_buyprice($quantity, $newprice, $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', 0, 'HT', 1, '', $supplier_description, $barcode, $fk_barcode_type);
|
||||
$ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', 0, 'HT', 1, '', $supplier_description, $barcode, $fk_barcode_type);
|
||||
}
|
||||
if ($ret < 0)
|
||||
{
|
||||
@ -655,7 +655,7 @@ if ($id > 0 || $ref)
|
||||
}
|
||||
$currencies = json_encode($currencies);
|
||||
|
||||
print <<<SCRIPT
|
||||
print <<<END
|
||||
<script type="text/javascript">
|
||||
function update_price_from_multicurrency() {
|
||||
var multicurrency_price = $('input[name="multicurrency_price"]').val();
|
||||
@ -695,7 +695,7 @@ if ($id > 0 || $ref)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
SCRIPT;
|
||||
END;
|
||||
} else {
|
||||
// Price qty min
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
|
||||
@ -120,7 +120,7 @@ if (empty($reshook))
|
||||
// Actions to send emails
|
||||
/*$triggersendname = 'MYOBJECT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid='myobject'.$object->id;
|
||||
$trackid='stockinv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';*/
|
||||
|
||||
if (GETPOST('addline', 'alpha')) {
|
||||
|
||||
@ -324,7 +324,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
$topicmail = "Information";
|
||||
$modelmail = "inventory";
|
||||
$objecttmp = new Inventory($db);
|
||||
$trackid = 'inve'.$object->id;
|
||||
$trackid = 'stockinv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
|
||||
@ -258,7 +258,7 @@ if ($action == 'create')
|
||||
|
||||
// Parent entrepot
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $formproduct->selectWarehouses('ifone', 'fk_parent', '', 1);
|
||||
print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOSTISSET('fk_parent') ? GETPOST('fk_parent', 'int') : 'ifone'), 'fk_parent', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
@ -690,7 +690,7 @@ if ($action == 'create')
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.$object->lieu.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" class="minwidth300" value="'.$object->lieu.'"></td></tr>';
|
||||
|
||||
// Parent entrepot
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
|
||||
@ -707,14 +707,14 @@ class Entrepot extends CommonObject
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Warehouse").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Warehouse").'</u>';
|
||||
if (isset($this->statut)) {
|
||||
$label .= ' '.$this->getLibStatut(5);
|
||||
}
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.(empty($this->ref) ? (empty($this->label) ? $this->libelle : $this->label) : $this->ref);
|
||||
if (!empty($this->lieu)) {
|
||||
$label .= '<br><b>'.$langs->trans('LocationSummary').':</b> '.$this->lieu;
|
||||
}
|
||||
if (isset($this->statut)) {
|
||||
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;
|
||||
|
||||
|
||||
@ -530,7 +530,6 @@ if ($num)
|
||||
$warehouse->{$key} = $obj->{$key};
|
||||
}
|
||||
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
@ -345,7 +345,7 @@ print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly margin
|
||||
$form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
|
||||
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddinrightonly"> </span> '.$langs->trans('Warehouse').'</span> ';
|
||||
print $formproduct->selectWarehouses($fk_warehouse, 'fk_warehouse', '', 1);
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1);
|
||||
print '</div>';
|
||||
|
||||
$parameters = array();
|
||||
|
||||
@ -48,8 +48,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'per
|
||||
$mine = 0;
|
||||
if ($mode == 'mine') $mine = 1;
|
||||
|
||||
$projectid = '';
|
||||
$projectid = isset($_GET["id"]) ? $_GET["id"] : $_POST["projectid"];
|
||||
$projectid = isset($_GET["id"]) ? GETPOST("id", "int", 1) : GETPOST("projectid", "int");
|
||||
|
||||
$hookmanager->initHooks(array('timesheetperdaycard'));
|
||||
|
||||
@ -612,20 +611,24 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
|
||||
}
|
||||
}
|
||||
|
||||
$statusofholidaytocheck = '3';
|
||||
$statusofholidaytocheck = Holiday::STATUS_APPROVED;
|
||||
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
|
||||
$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
||||
|
||||
$tmparray = dol_getdate($daytoparse, true); // detail of current day
|
||||
$idw = $tmparray['wday'];
|
||||
$test = num_public_holiday($daytoparse, $daytoparse + 86400, $mysoc->country_code);
|
||||
if ($test) $isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
||||
|
||||
$tmparray = dol_getdate($daytoparse, true); // detail of current day
|
||||
// For monday, must be 0 for monday if MAIN_START_WEEK = 1, must be 1 for monday if MAIN_START_WEEK = 0
|
||||
$idw = ($tmparray['wday'] - (empty($conf->global->MAIN_START_WEEK)?0:1));
|
||||
// numstartworkingday and numendworkingday are default start and end date of working days (1 means sunday if MAIN_START_WEEK is 0, 1 means monday if MAIN_START_WEEK is 1)
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
$tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||
$tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
|
||||
|
||||
$cssonholiday = '';
|
||||
if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
|
||||
@ -651,20 +654,6 @@ if ($conf->use_javascript_ajax)
|
||||
//print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
||||
print '</td>';
|
||||
|
||||
$tmparray = dol_getdate($daytoparse, true); // detail of current day
|
||||
$idw = $tmparray['wday'];
|
||||
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
$cssonholiday = '';
|
||||
if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
|
||||
elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
|
||||
elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
|
||||
|
||||
print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0"> </div></td>';
|
||||
|
||||
print '<td class="liste_total"></td>';
|
||||
@ -752,20 +741,6 @@ if (count($tasksarray) > 0)
|
||||
//print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
||||
print '</td>';
|
||||
|
||||
$tmparray = dol_getdate($daytoparse, true); // detail of current day
|
||||
$idw = $tmparray['wday'];
|
||||
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
$cssonholiday = '';
|
||||
if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayallday ';
|
||||
elseif (!$isavailable[$daytoparse]['morning']) $cssonholiday .= 'onholidaymorning ';
|
||||
elseif (!$isavailable[$daytoparse]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
|
||||
|
||||
print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0"> </div></td>';
|
||||
|
||||
print '<td class="liste_total"></td>
|
||||
|
||||
@ -46,8 +46,7 @@ $taskid = GETPOST('taskid', 'int');
|
||||
$mine = 0;
|
||||
if ($mode == 'mine') $mine = 1;
|
||||
|
||||
$projectid = '';
|
||||
$projectid = isset($_GET["id"]) ? $_GET["id"] : $_POST["projectid"];
|
||||
$projectid = isset($_GET["id"]) ? GETPOST("id", "int", 1) : GETPOST("projectid", "int");
|
||||
|
||||
// Security check
|
||||
$socid = 0;
|
||||
@ -502,7 +501,10 @@ $colspan = 5;
|
||||
// By default, we can edit only tasks we are assigned to
|
||||
$restrictviewformytask = (empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED) ? 1 : 0);
|
||||
|
||||
// Get if user is available or not for each day
|
||||
$isavailable = array();
|
||||
// TODO See code into perweek.php to initialize isavailable array
|
||||
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
|
||||
@ -48,8 +48,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'per
|
||||
$mine = 0;
|
||||
if ($mode == 'mine') $mine = 1;
|
||||
|
||||
$projectid = '';
|
||||
$projectid = isset($_GET["id"]) ? $_GET["id"] : $_POST["projectid"];
|
||||
$projectid = isset($_GET["id"]) ? GETPOST("id", "int", 1) : GETPOST("projectid", "int");
|
||||
|
||||
$hookmanager->initHooks(array('timesheetperweekcard'));
|
||||
|
||||
@ -364,7 +363,6 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -530,11 +528,16 @@ for ($idw = 0; $idw < 7; $idw++)
|
||||
//print dol_print_date($dayinloopwithouthours, 'dayhour').' ';
|
||||
//print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour').'<br>';
|
||||
|
||||
$statusofholidaytocheck = '3';
|
||||
$statusofholidaytocheck = Holiday::STATUS_APPROVED;
|
||||
|
||||
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
|
||||
$isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
|
||||
|
||||
$test = num_public_holiday($dayinloopfromfirstdaytoshow, $dayinloopfromfirstdaytoshow + 86400, $mysoc->country_code);
|
||||
if ($test) $isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
|
||||
}
|
||||
//var_dump($isavailable);
|
||||
|
||||
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -656,7 +659,7 @@ for ($idw = 0; $idw < 7; $idw++)
|
||||
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
|
||||
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
@ -689,7 +692,7 @@ if ($conf->use_javascript_ajax)
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
@ -700,7 +703,6 @@ if ($conf->use_javascript_ajax)
|
||||
if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayallday ';
|
||||
elseif (!$isavailable[$tmpday]['morning']) $cssonholiday .= 'onholidaymorning ';
|
||||
elseif (!$isavailable[$tmpday]['afternoon']) $cssonholiday .= 'onholidayafternoon ';
|
||||
|
||||
print '<td class="liste_total hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'" align="center"><div class="totalDay'.$idw.'"> </div></td>';
|
||||
}
|
||||
print '<td class="liste_total center"><div class="totalDayAll"> </div></td>';
|
||||
@ -775,7 +777,7 @@ if (count($tasksarray) > 0)
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
@ -803,10 +805,9 @@ if (count($tasksarray) > 0)
|
||||
print '<span class="opacitymediumbycolor"> - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong></span>';
|
||||
print '</td>';
|
||||
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
for ($idw = 0; $idw < 7; $idw++) {
|
||||
$cssweekend = '';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend = 'weekend';
|
||||
}
|
||||
|
||||
@ -1900,7 +1900,7 @@ class Task extends CommonObject
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'nodefault';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
if (!empty($this->modelpdf)) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (!empty($conf->global->PROJECT_TASK_ADDON_PDF)) {
|
||||
$modele = $conf->global->PROJECT_TASK_ADDON_PDF;
|
||||
|
||||
@ -484,7 +484,7 @@ print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_
|
||||
$topicmail = "Information";
|
||||
$modelmail = "project";
|
||||
$objecttmp = new Project($db);
|
||||
$trackid = 'prj'.$object->id;
|
||||
$trackid = 'proj'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user