Skip to content

Instantly share code, notes, and snippets.

@4EverBuilder
4EverBuilder / import file for JIRA
Created January 23, 2012 12:09
SQL To get Redmine CSV export. Can be imported to JIRA
{
"field.subject" : "summary",
"project.lead" : "YOUR USERNAME",
"field.category" : "components",
"value.status.Closed" : "6",
"value.status.New" : "3",
"date.import.format" : "yyyy-MM-dd",
"value.status.Feedback" : "3",
"field.tracker" : "issuetype",
"project.name" : "Project",
@4EverBuilder
4EverBuilder / sample_timesheet_fetch.php
Last active August 20, 2020 18:55
A sample PHP file that can fetch timesheets in Deputy via API
<?php
// Just run via command line php -q sample_timesheet_fetch.php
date_default_timezone_set("Australia/Sydney");
$actual_db = array();
$total_count = 0;
// get all timesheets
//$search = array('emp_search' => array('field' => 'Employee' , 'data'=> "1" , 'type' => 'ge' ) );
// get just everything since last 1 week
$search = array('created_search' => array('field' => 'Created' , 'data'=> date("Y-m-d 00:00:00" , strtotime("-1 week")) , 'type' => 'ge' ) );
<?php
// manage session
session_start();
// constants - please update after getting credentials from https://once.deputy.com/my/oauth_clients
define('DEPUTY_API_CLIENT_ID' , 'YOUR CIENT ID HERE');
define('DEPUTY_API_CLIENT_SECRET' , 'YOUR API SECRET HERE');
define('DEPUTY_API_REDIRECT_URI' , 'YOUR SERVER ADDRESS WHERE it will redirect');
#Save it as Reccord After Save
empAgreement = db_record({system:"EmployeeAgreement" , id:CurrentRecord.EmployeeAgreement})
return 1 if !empAgreement
# is there a balance?
`<db_fetch system="LeaveAccrual" fetch="first_row" assign="lacc">
<db_condition>
<db_compare column="Employee" function="ge">
<atom var="empAgreement" index="EmployeeId"/>
return if !CurrentRecord.IsInProgress
timenow = dateprint({format:"U"})
emp = db_record({system:"Employee" , id:CurrentRecord.Employee})
contact = db_record({system:"Contact" , id:emp.Contact})
opunit = db_record({system:"OperationalUnit" , id:CurrentRecord.OperationalUnit})
ename = string({input:emp.DispayName , function:"urlencode"})
url = "https://yourtyeform.typeform.com/to/FORMID?shift_id=#{CurrentRecord.Id}&employee_id=#{CurrentRecord.Employee}&employee_name=#{ename}&location_id=#{opunit.Company}"
msg = "Hey #{emp.FirstName}, please fill out this call report #{url} ";
@4EverBuilder
4EverBuilder / generate_qr_code_gsheet.app_script.js
Created April 2, 2024 02:46
Generate QR code images from a google sheet
// Review each line. Replace the variables inline. TEST before try
// It expects a file which has name, suburb, state, url. You may have as many columns as you need.
// In a given drive, it will generate QR codes as PNG files (Name-Suburb-State.png)
// Original inspiration and instructions : https://stackoverflow.com/questions/69058384/export-images-from-google-sheets
function isImageToImage(){
const ss = SpreadsheetApp.openById('XXXXXXXX'); // replace with your spreadsheet ID
const sheet = ss.getSheetByName('YYYYY'); // replace with sheet name
// row (4) and columns (A/B/C)
const urls = sheet.getRange(4,9, sheet.getLastRow()-1).getValues() ;//.flat();